Search in sources :

Example 31 with Container

use of com.codename1.ui.Container in project CodenameOne by codenameone.

the class InteractionDialog method disposeToTheLeft.

/**
 * Removes the interaction dialog from view with an animation to the left
 */
public void disposeToTheLeft() {
    disposed = true;
    final Container p = getParent();
    if (p != null) {
        final Form f = p.getComponentForm();
        if (f != null) {
            setX(-getWidth());
            if (animateShow) {
                p.animateUnlayout(400, 255, new Runnable() {

                    public void run() {
                        if (p.getParent() != null) {
                            Container pp = getLayeredPane(f);
                            remove();
                            p.remove();
                            pp.removeAll();
                            pp.revalidate();
                            cleanupLayer(f);
                        }
                    }
                });
            } else {
                p.revalidate();
                Container pp = getLayeredPane(f);
                remove();
                p.remove();
                pp.removeAll();
                pp.revalidate();
            }
        } else {
            remove();
        }
    }
}
Also used : Container(com.codename1.ui.Container) Form(com.codename1.ui.Form)

Example 32 with Container

use of com.codename1.ui.Container in project CodenameOne by codenameone.

the class InteractionDialog method deinitialize.

/**
 * {@inheritDoc}
 */
@Override
protected void deinitialize() {
    super.deinitialize();
    if (disposed) {
        Form f = getComponentForm();
        if (f != null) {
            Container pp = getLayeredPane(f);
            Container p = getParent();
            remove();
            p.remove();
            pp.removeAll();
            pp.revalidate();
            cleanupLayer(f);
        }
    }
}
Also used : Container(com.codename1.ui.Container) Form(com.codename1.ui.Form)

Example 33 with Container

use of com.codename1.ui.Container in project CodenameOne by codenameone.

the class InteractionDialog method dispose.

/**
 * Removes the interaction dialog from view
 */
public void dispose() {
    disposed = true;
    Container p = getParent();
    if (p != null) {
        Form f = p.getComponentForm();
        if (f != null) {
            if (animateShow) {
                if (repositionAnimation) {
                    setX(getX() + getWidth() / 2);
                    setY(getY() + getHeight() / 2);
                    setWidth(1);
                    setHeight(1);
                }
                p.animateUnlayoutAndWait(400, 100);
            }
            Container pp = getLayeredPane(f);
            remove();
            p.remove();
            pp.removeAll();
            pp.revalidate();
            cleanupLayer(f);
        } else {
            p.remove();
        }
    }
}
Also used : Container(com.codename1.ui.Container) Form(com.codename1.ui.Form)

Example 34 with Container

use of com.codename1.ui.Container in project CodenameOne by codenameone.

the class RSSReader method createRendererContainer.

private Container createRendererContainer() {
    Container entries = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    entries.setUIID("RSSEntry");
    Label title = new Label();
    title.setName("title");
    title.setUIID("RSSTitle");
    entries.addComponent(title);
    TextArea description = new TextArea(2, 30);
    description.setGrowByContent(false);
    description.setName("details");
    description.setUIID("RSSDescription");
    description.setScrollVisible(false);
    entries.addComponent(description);
    if (iconPlaceholder != null) {
        Container wrap = new Container(new BorderLayout());
        wrap.addComponent(BorderLayout.CENTER, entries);
        Label icon = new Label();
        icon.setIcon(iconPlaceholder);
        icon.setUIID("RSSIcon");
        icon.setName("icon");
        wrap.addComponent(BorderLayout.WEST, icon);
        entries = wrap;
    }
    return entries;
}
Also used : Container(com.codename1.ui.Container) BorderLayout(com.codename1.ui.layouts.BorderLayout) TextArea(com.codename1.ui.TextArea) BoxLayout(com.codename1.ui.layouts.BoxLayout) Label(com.codename1.ui.Label)

Example 35 with Container

use of com.codename1.ui.Container in project CodenameOne by codenameone.

the class RSSReader method updateComponentValues.

void updateComponentValues(Container root, Hashtable h) {
    int c = root.getComponentCount();
    for (int iter = 0; iter < c; iter++) {
        Component current = root.getComponentAt(iter);
        // subclasses
        if (current.getClass() == com.codename1.ui.Container.class || current.getClass() == com.codename1.ui.Tabs.class) {
            updateComponentValues((Container) current, h);
            continue;
        }
        String n = current.getName();
        if (n != null) {
            String val = (String) h.get(n);
            if (val != null) {
                if (current instanceof Button) {
                    final String url = (String) val;
                    ((Button) current).addActionListener(new Listener(url));
                    continue;
                }
                if (current instanceof Label) {
                    ((Label) current).setText(val);
                    continue;
                }
                if (current instanceof TextArea) {
                    ((TextArea) current).setText(val);
                    continue;
                }
                if (current instanceof WebBrowser) {
                    ((WebBrowser) current).setPage(val, null);
                    continue;
                }
            }
        }
    }
}
Also used : Container(com.codename1.ui.Container) ActionListener(com.codename1.ui.events.ActionListener) Button(com.codename1.ui.Button) TextArea(com.codename1.ui.TextArea) Label(com.codename1.ui.Label) Component(com.codename1.ui.Component)

Aggregations

Container (com.codename1.ui.Container)85 Component (com.codename1.ui.Component)65 BorderLayout (com.codename1.ui.layouts.BorderLayout)46 Style (com.codename1.ui.plaf.Style)38 ActionEvent (com.codename1.ui.events.ActionEvent)29 Form (com.codename1.ui.Form)26 Label (com.codename1.ui.Label)21 BoxLayout (com.codename1.ui.layouts.BoxLayout)21 Dimension (com.codename1.ui.geom.Dimension)20 ActionListener (com.codename1.ui.events.ActionListener)19 Button (com.codename1.ui.Button)15 FlowLayout (com.codename1.ui.layouts.FlowLayout)15 ArrayList (java.util.ArrayList)14 LayeredLayout (com.codename1.ui.layouts.LayeredLayout)12 TextArea (com.codename1.ui.TextArea)11 Point (com.codename1.ui.geom.Point)11 Rectangle (com.codename1.ui.geom.Rectangle)11 Dialog (com.codename1.ui.Dialog)10 RadioButton (com.codename1.ui.RadioButton)10 Vector (java.util.Vector)9