Search in sources :

Example 71 with BorderLayout

use of com.codename1.ui.layouts.BorderLayout in project codenameone-google-maps by codenameone.

the class MapInfoPanel method show.

public void show() {
    if (getParent() != null) {
        return;
    }
    Display disp = Display.getInstance();
    if (disp.isTablet()) {
        if (disp.isPortrait()) {
            markers.setLayout(new BoxLayout(BoxLayout.X_AXIS));
            for (Component marker : markers) {
                if (marker instanceof Button) {
                    Button btnMarker = (Button) marker;
                    btnMarker.setTextPosition(Label.BOTTOM);
                }
            }
            InteractionDialog dlg = new InteractionDialog("Map Info");
            dlg.setLayout(new BorderLayout());
            dlg.add(BorderLayout.CENTER, this);
            int dh = disp.getDisplayHeight();
            int dw = disp.getDisplayWidth();
            dlg.show(3 * dh / 4, 0, 0, 0);
            updateMapPosition();
        } else {
            markers.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
            for (Component marker : markers) {
                if (marker instanceof Button) {
                    Button btnMarker = (Button) marker;
                    btnMarker.setTextPosition(Label.RIGHT);
                }
            }
            InteractionDialog dlg = new InteractionDialog("Map Info");
            dlg.setLayout(new BorderLayout());
            dlg.add(BorderLayout.CENTER, this);
            int dh = disp.getDisplayHeight();
            int dw = disp.getDisplayWidth();
            // makeTransparent(dlg);
            dlg.getAllStyles().setBorder(Border.createEmpty());
            dlg.getAllStyles().setBgColor(0x0);
            dlg.getAllStyles().setBgTransparency(128);
            List<Component> dialogTitle = findByUIID("DialogTitle", dlg);
            for (Component c : dialogTitle) {
                c.getAllStyles().setFgColor(0xffffff);
            }
            List<Component> tabsContainer = findByUIID("TabsContainer", dlg);
            for (Component c : tabsContainer) {
                c.getAllStyles().setBgColor(0xEAEAEA);
                // c.getAllStyles().setBackgroundType(Style.BACKGROUND_NONE);
                c.getAllStyles().setBgTransparency(255);
            }
            ;
            dlg.show(0, 0, 0, dw * 3 / 4);
            updateMapPosition();
            System.out.println("Making transparent");
        // makeTransparent(dlg);
        }
    } else {
        if (disp.isPortrait()) {
            markers.setLayout(new BoxLayout(BoxLayout.X_AXIS));
            for (Component marker : markers) {
                if (marker instanceof Button) {
                    Button btnMarker = (Button) marker;
                    btnMarker.setTextPosition(Label.BOTTOM);
                }
            }
            InteractionDialog dlg = new InteractionDialog("Map Info");
            dlg.setLayout(new BorderLayout());
            dlg.add(BorderLayout.CENTER, this);
            int dh = disp.getDisplayHeight();
            int dw = disp.getDisplayWidth();
            dlg.show(dh / 2, 0, 0, 0);
            updateMapPosition();
        } else {
            markers.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
            for (Component marker : markers) {
                if (marker instanceof Button) {
                    Button btnMarker = (Button) marker;
                    btnMarker.setTextPosition(Label.RIGHT);
                }
            }
            InteractionDialog dlg = new InteractionDialog("Map Info");
            dlg.setLayout(new BorderLayout());
            dlg.add(BorderLayout.CENTER, this);
            int dh = disp.getDisplayHeight();
            int dw = disp.getDisplayWidth();
            dlg.show(0, dw / 2, 0, 0);
            updateMapPosition();
        }
    }
}
Also used : InteractionDialog(com.codename1.components.InteractionDialog) BorderLayout(com.codename1.ui.layouts.BorderLayout) Button(com.codename1.ui.Button) BoxLayout(com.codename1.ui.layouts.BoxLayout) Component(com.codename1.ui.Component) Display(com.codename1.ui.Display)

Aggregations

BorderLayout (com.codename1.ui.layouts.BorderLayout)64 ActionEvent (com.codename1.ui.events.ActionEvent)27 Container (com.codename1.ui.Container)21 Form (com.codename1.ui.Form)18 ActionListener (com.codename1.ui.events.ActionListener)18 Component (com.codename1.ui.Component)15 BoxLayout (com.codename1.ui.layouts.BoxLayout)14 Label (com.codename1.ui.Label)12 Button (com.codename1.ui.Button)10 IOException (java.io.IOException)9 Dialog (com.codename1.ui.Dialog)8 Hashtable (java.util.Hashtable)8 Command (com.codename1.ui.Command)6 TextArea (com.codename1.ui.TextArea)6 FlowLayout (com.codename1.ui.layouts.FlowLayout)6 LayeredLayout (com.codename1.ui.layouts.LayeredLayout)6 Vector (java.util.Vector)6 RadioButton (com.codename1.ui.RadioButton)5 Animation (com.codename1.ui.animations.Animation)4 Style (com.codename1.ui.plaf.Style)4