Infinite image on Container

41 views
Skip to first unread message

Rocotoco Rodriguez

unread,
Sep 23, 2016, 4:47:07 PM9/23/16
to CodenameOne Discussions
HI! i want to ask you if exists the possibility to implement with the actual version an infinite image (animated) on a Container.

also, i want to know which commands locks the interfase while the original infiniteprogress runs.

thanks

If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device

Shai Almog

unread,
Sep 24, 2016, 2:00:09 AM9/24/16
to CodenameOne Discussions
Hi,
you mean replace the rotating image or something else?
The showInfiniteProgress() method creates a transparent dialog so it blocks the UI.

Rocotoco Rodriguez

unread,
Sep 24, 2016, 7:50:26 AM9/24/16
to CodenameOne Discussions
hi shai! i create a container who shows the image when you activate it (for example when you are running a query)

i choose that way because when you call showInfiniteProgress()  and you dispose it, the current form may have beheaviors unwanted. because that , i dont want to show a dialog, preferring to show a rotating image and blocking the UI.

was i clear? I need to block de UI while the rotating image is running without use the dialog method.

my code is:

/**
 *
 * @author roman
 */
public class ContainerExp extends Container
{

    Container pane = new Container();
    Container glass = new Container();

    public ContainerExp()
    {

        pane.setUIID("Container");
        glass.setUIID("InfiniteProgress");
        glass.setLayout(new BorderLayout());
        Container infiniteContainer = new Container();
        TableLayout tl = new TableLayout(1, 1);

        infiniteContainer.setLayout(tl);
        Constraint consTL = tl.createConstraint();
        consTL.setWidthPercentage(100);
        consTL.setHeightPercentage(100);
        consTL.setHorizontalAlign(Component.CENTER);
        consTL.setVerticalAlign(Component.CENTER);
        infiniteContainer.addComponent(consTL, new InfiniteProgress());
        glass.addComponent(BorderLayout.CENTER, infiniteContainer);
        //setUIID("InfiniteProgress");

        super.setLayout(new LayeredLayout());
        super.addComponent(pane);
    }

    public void showInfiniteProgress()
    {

        if (super.contains(glass))
        {
            super.removeComponent(glass);
        }

        super.addComponent(glass);

        Display.getInstance().getCurrent().setLeadComponent(this);
    }

    public void removeInfiniteProgress()
    {
        super.removeComponent(glass);
        Display.getInstance().getCurrent().setLeadComponent(null);
    }

    @Override
    public void forceRevalidate()
    {
        super.forceRevalidate(); //To change body of generated methods, choose Tools | Templates.
    }

    public void setLayout(Layout layout)
    {
        pane.setLayout(layout); //To change body of generated methods, choose Tools | Templates.
    }

    public Container add(Component cmp)
    {
        return pane.add(cmp); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Container add(Object constraint, Component cmp)
    {
        return pane.add(constraint, cmp); //To change body of generated methods, choose Tools | Templates.
    }

    public void addComponent(Component cmp)
    {
        pane.addComponent(cmp); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void addComponent(Object constraints, Component cmp)
    {
        pane.addComponent(constraints, cmp); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void removeAll()
    {
        pane.removeAll(); //To change body of generated methods, choose Tools | Templates.

Shai Almog

unread,
Sep 25, 2016, 12:19:37 AM9/25/16
to CodenameOne Discussions
Hi,
I suggest rewinding to what behaviors you are seeing that are unwanted with the infinite progress.
Reply all
Reply to author
Forward
0 new messages