Example usage for com.google.gwt.user.client.ui PopupPanel setVisible

List of usage examples for com.google.gwt.user.client.ui PopupPanel setVisible

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui PopupPanel setVisible.

Prototype

@Override
public void setVisible(boolean visible) 

Source Link

Document

Sets whether this object is visible.

Usage

From source file:com.google.gwt.sample.stockwatcher.client.NotificationServer.java

private static void renderPopup(String title, PopupPanel popup, ScrollPanel scrollPanel, FlexTable table,
        Button closeButton) {//from   w w w . ja va2s . co  m
    scrollPanel.clear();
    scrollPanel.setHeight("400px");
    scrollPanel.add(table);

    VerticalPanel lol = new VerticalPanel();
    lol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    lol.setSpacing(10);
    lol.add(new HTML(title));
    lol.add(scrollPanel);
    lol.add(closeButton);

    popup.clear();
    popup.setVisible(true);
    popup.add(lol);
    popup.show();
    popup.center();
    popup.setVisible(false);

    popupList.add(popup);
}

From source file:com.google.gwt.sample.stockwatcher.client.NotificationServer.java

private static void hideAllPopup() {
    for (PopupPanel popup : popupList) {
        popup.setVisible(false);
    }
}

From source file:com.google.gwt.sample.stockwatcher.client.SitePage.java

private static void renderActuatorPopups() {
    stop();/*from ww  w .j  a  va2s  . c o  m*/
    for (String controller : Data.controllerActuatorList.keySet()) {
        ArrayList<PopupPanel> popups = new ArrayList<>();
        for (String actuators : Data.controllerActuatorList.get(controller)) {
            ArrayList<String> attributes = Data.actuatorAttributeList.get(actuators);
            String name = attributes.get(0);
            String status = attributes.get(2);
            final double x = Double.parseDouble(attributes.get(3));
            final double y = Double.parseDouble(attributes.get(4));
            String controlType = attributes.get(5);

            String icon = Images.getImage(Images.ACTUATOR_CURRENT_ICON, 25);

            Actuator temp = new Actuator(icon, name, status, controlType);

            final PopupPanel container = new PopupPanel();

            actuatorIcons.add(container);

            container.add(temp);
            container.getElement().getStyle().setBackgroundColor("rgba(255,0,0,0.0)");
            container.getElement().getStyle().setBorderWidth(0, Unit.PX);
            container.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
                public void setPosition(int offsetWidth, int offsetHeight) {
                    int left = sitePic.getAbsoluteLeft() + (int) (x * (double) sitePic.getWidth());
                    int top = sitePic.getAbsoluteTop() + (int) (y * (double) sitePic.getHeight());
                    container.setPopupPosition(left, top);
                }
            });
            container.setVisible(false);
            popups.add(container);
        }
        controllerActuatorPopupList.put(controller, popups);
    }
}

From source file:com.google.gwt.sample.stockwatcher.client.SitePage.java

private static void renderControllerPopups() {
    for (String site : Data.siteControllerList.keySet()) {
        ArrayList<PopupPanel> popups = new ArrayList<>();

        for (String controller : Data.siteControllerList.get(site)) {
            ArrayList<String> attributes = Data.controllerAttributeList.get(controller);

            final String name = attributes.get(0);
            final double x = Double.parseDouble(attributes.get(2));
            final double y = Double.parseDouble(attributes.get(3));

            Controller cToggle = new Controller(controller);

            final PopupPanel container = new PopupPanel();

            controllerIcons.add(container);

            container.add(cToggle);/*from w  w  w. j a  v a 2 s .c om*/
            container.getElement().getStyle().setBackgroundColor("rgba(255,0,0,0.0)");
            container.getElement().getStyle().setBorderWidth(0, Unit.PX);
            container.setTitle(name);

            container.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
                public void setPosition(int offsetWidth, int offsetHeight) {
                    int left = sitePic.getAbsoluteLeft() + (int) (x * (double) sitePic.getWidth());
                    int top = sitePic.getAbsoluteTop() + (int) (y * (double) sitePic.getHeight());
                    container.setPopupPosition(left, top);
                }
            });
            container.setVisible(false);
            popups.add(container);
        }
        siteControllerPopupList.put(site, popups);
    }
}

From source file:com.google.gwt.sample.stockwatcher.client.SitePage.java

private static void renderSensorPopups() {
    for (String controller : Data.controllerSensorList.keySet()) {
        ArrayList<PopupPanel> popups = new ArrayList<>();
        for (String sensors : Data.controllerSensorList.get(controller)) {
            ArrayList<String> attributes = Data.sensorAttributeList.get(sensors);

            String name = attributes.get(0);
            String type = attributes.get(1);
            final double x = Double.parseDouble(attributes.get(9));
            final double y = Double.parseDouble(attributes.get(10));
            String icon = setSensorIcon(type);

            Sensor temp = new Sensor(icon, name);

            final PopupPanel container = new PopupPanel();

            sensorIcons.add(container);/*  w w w . j  a v a2 s .  co  m*/

            container.add(temp);
            container.getElement().getStyle().setBackgroundColor("rgba(255,0,0,0.0)");
            container.getElement().getStyle().setBorderWidth(0, Unit.PX);
            container.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
                public void setPosition(int offsetWidth, int offsetHeight) {
                    int left = sitePic.getAbsoluteLeft() + (int) (x * (double) sitePic.getWidth());
                    int top = sitePic.getAbsoluteTop() + (int) (y * (double) sitePic.getHeight());
                    container.setPopupPosition(left, top);
                }
            });
            container.setVisible(false);
            popups.add(container);
        }
        controllerSensorPopupList.put(controller, popups);
    }
}

From source file:com.google.gwt.sample.stockwatcher.client.SitePage.java

private static void popupControllers(String siteName) {
    try {// ww w . j a  v  a  2  s  .  com
        for (PopupPanel popup : siteControllerPopupList.get(siteName)) {
            popup.setAnimationEnabled(true);
            popup.setAnimationType(AnimationType.CENTER);
            popup.setVisible(true);
        }
    } catch (Exception e) {
    }
}

From source file:com.google.gwt.sample.stockwatcher.client.SitePage.java

private static void popupSensors(String controllerName, Boolean state) {
    try {/*ww w. j av a 2s.  c o  m*/
        for (PopupPanel popup : controllerSensorPopupList.get(controllerName)) {
            popup.setAnimationEnabled(true);
            popup.setAnimationType(AnimationType.CENTER);
            popup.setVisible(state);
        }
    } catch (Exception e) {
    }
}

From source file:com.google.gwt.sample.stockwatcher.client.SitePage.java

private static void popupActuators(String controllerName, Boolean state) {
    try {//from   www  . j a  v  a 2 s.co m
        for (PopupPanel popup : controllerActuatorPopupList.get(controllerName)) {
            popup.setAnimationEnabled(true);
            popup.setAnimationType(AnimationType.CENTER);
            popup.setVisible(state);
        }
    } catch (Exception e) {
    }
}

From source file:com.gwtmodel.table.view.util.polymer.PolymerUtil.java

License:Apache License

public static ISignal popupPolymer(WSize ws, Widget w, PaperDialog pap, final ISignal sClose,
        String addStyleNames) {/*from   w  w w .j  a v  a  2  s . c o m*/
    final PopupPanel pa = new PopupPanel();
    if (addStyleNames == null)
        addStyleNames = "";
    IronDropdown p = new IronDropdown(
            "<div class=\"dropdown-content " + addStyleNames + "\" id=\"content\"></div>");
    p.setHorizontalOffset(ws.getLeft());
    p.setVerticalOffset(ws.getTop());
    if (w != null)
        p.add(w, "content");
    else
        p.add(pap, "content");
    pa.setWidget(p);
    pa.setVisible(false);
    pa.show();
    p.open();
    if (pap != null) {
        Utils.setTopLeftProperty(pap, ws.getTop() + 10, ws.getLeft() + 10);
        pap.open();
    }
    Utils.setVisibleProperty(p);
    p.addIronOverlayClosedHandler(new IronOverlayClosedEventHandler() {

        @Override
        public void onIronOverlayClosed(IronOverlayClosedEvent event) {
            pa.hide();
            if (sClose != null)
                sClose.signal();
        }
    });
    return new ISignal() {

        @Override
        public void signal() {
            pa.hide();
        }
    };
}

From source file:com.ponysdk.ui.terminal.ui.PTPopupPanel.java

License:Apache License

@Override
public void addHandler(final PTInstruction addHandler, final UIService uiService) {
    final String handler = addHandler.getString(HANDLER.KEY);

    if (HANDLER.KEY_.POPUP_POSITION_CALLBACK.equals(handler)) {
        final PopupPanel popupPanel = cast();

        popupPanel.setVisible(false);
        popupPanel.show();/*  w  ww. j  a v  a  2 s  .  c  o  m*/

        final PTInstruction eventInstruction = new PTInstruction();
        eventInstruction.setObjectID(addHandler.getObjectID());
        eventInstruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
        eventInstruction.put(HANDLER.KEY, HANDLER.KEY_.POPUP_POSITION_CALLBACK);
        eventInstruction.put(PROPERTY.OFFSETWIDTH, popupPanel.getOffsetWidth());
        eventInstruction.put(PROPERTY.OFFSETHEIGHT, popupPanel.getOffsetHeight());
        eventInstruction.put(PROPERTY.CLIENT_WIDTH, Window.getClientWidth());
        eventInstruction.put(PROPERTY.CLIENT_HEIGHT, Window.getClientHeight());
        uiService.triggerEvent(eventInstruction);
        return;
    }

    super.addHandler(addHandler, uiService);
}