Search in sources :

Example 26 with BoxLayout

use of com.codename1.ui.layouts.BoxLayout 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

BoxLayout (com.codename1.ui.layouts.BoxLayout)24 BorderLayout (com.codename1.ui.layouts.BorderLayout)16 Container (com.codename1.ui.Container)13 Label (com.codename1.ui.Label)8 Button (com.codename1.ui.Button)7 FlowLayout (com.codename1.ui.layouts.FlowLayout)6 LayeredLayout (com.codename1.ui.layouts.LayeredLayout)6 Layout (com.codename1.ui.layouts.Layout)6 CheckBox (com.codename1.ui.CheckBox)5 Component (com.codename1.ui.Component)5 Form (com.codename1.ui.Form)5 TextArea (com.codename1.ui.TextArea)5 RadioButton (com.codename1.ui.RadioButton)4 ActionListener (com.codename1.ui.events.ActionListener)4 GridLayout (com.codename1.ui.layouts.GridLayout)4 Dialog (com.codename1.ui.Dialog)3 Image (com.codename1.ui.Image)3 Slider (com.codename1.ui.Slider)3 TextField (com.codename1.ui.TextField)3 ActionEvent (com.codename1.ui.events.ActionEvent)3