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

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

Introduction

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

Prototype

@Override
public void setWidth(String width) 

Source Link

Document

Sets the width of the panel's child widget.

Usage

From source file:asquare.gwt.tk.uitest.popuppanel.client.Demo.java

License:Apache License

private Widget createDefaultTransparencyTest() {
    RowPanel outer = new RowPanel();
    outer.add(new HTML("<h3>Default transparency test</h3>"));
    final Button button = new Button("Show popup");
    button.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            PopupPanel popup = new PopupPanel(true);
            popup.setPopupPosition(button.getAbsoluteLeft(),
                    button.getAbsoluteTop() + button.getOffsetHeight());
            popup.setWidth("10em");
            DomUtil.setStyleAttribute(popup, "border", "solid black 1px");
            popup.setWidget(new HTML("<p>This popup should be transparent in all browsers.</p>"));
            popup.show();/*from   w w w  .j  ava  2  s.co m*/
        }
    });
    outer.add(button);
    return outer;
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.Popup.java

License:Open Source License

public static PopupPanel showLoadingPopup() {
    HorizontalPanel hP = new HorizontalPanel();
    hP.setWidth("173px");
    hP.add(new Image("ajax-ball-t.gif"));
    Label l = new Label("Loading...");
    l.addStyleName("tagPop2");
    hP.add(l);//from   ww w.ja  v  a2  s  .  c  o  m
    PopupPanel p = getPopupPanel();
    p.setWidth("180px");
    showRoundedPopup(hP, "Information", p, -1, -1, 180, false);
    return p;
}

From source file:org.fourthline.konto.client.KontoEntryPoint.java

License:Open Source License

protected void enableDemo() {
    final PopupPanel panel = new PopupPanel(true, true);
    panel.setGlassEnabled(true);//from w  w  w . ja  v  a2s  .  c  om

    VerticalPanel msgPanel = new VerticalPanel();
    SafeHtmlBuilder msg = new SafeHtmlBuilder();
    msg.appendHtmlConstant("<p>").appendEscaped("This is a demo instance of Konto.").appendHtmlConstant("</p>");
    msg.appendHtmlConstant("<p>").appendEscaped("You can make any changes you like.")
            .appendHtmlConstant("</p>");
    msg.appendHtmlConstant("<p>").appendEscaped("This instance will reset itself every hour.")
            .appendHtmlConstant("</p>");

    msgPanel.add(new HTMLPanel(msg.toSafeHtml()));

    panel.add(msgPanel);
    panel.setWidth("250px");
    panel.setHeight("120px");
    panel.setPopupPosition(Window.getClientWidth() / 2 - 250, Window.getClientHeight() / 2 - 120);
    panel.show();
}

From source file:org.jboss.as.console.client.core.footer.Footer.java

License:Open Source License

public Widget asWidget() {
    final LayoutPanel layout = new LayoutPanel();
    final PopupPanel toolsPopup = new DefaultPopup(DefaultPopup.Arrow.BOTTOM);
    final List<String[]> toolReference = new ArrayList<String[]>();

    if (context.isSuperUser()) {
        toolReference.add(new String[] { "Management Model", "browser" });
    }//from w w w .  ja va2  s. c  o m

    toolReference.add(new String[] { "Expression Resolver", "expressions" });
    if (diagnostics.isEnabled()) {
        toolReference.add(new String[] { "Diagnostics", "debug-panel" });
    }

    // only enabled in dev mode
    if (!GWT.isScript()) {
        toolReference.add(new String[] { "Modelling", "mbui-workbench" });
        toolReference.add(new String[] { "Resource Access", "access-log" });
        //            toolReference.add(new String[]{"Search Index", "indexing"});
    }

    final VerticalPanel toolsList = new VerticalPanel();
    toolsList.getElement().setAttribute("width", "160px");
    for (final String[] tool : toolReference) {
        InlineLink browser = new InlineLink(tool[0]);
        browser.getElement().setAttribute("style", "margin:4px");
        browser.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                toolsPopup.hide();
                Map<String, String> parameters = new HashMap<>();
                parameters.put("name", tool[1]);
                placeManager.goTo(new DefaultPlaceRequest(NameTokens.Tools, parameters));
            }
        });
        toolsList.add(browser);
    }
    toolsPopup.setWidget(toolsList);

    final HTML toolsLink = new HTML("<i class='icon-caret-up'></i>&nbsp;" + "Tools");
    toolsLink.addStyleName("footer-link");
    toolsLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            int listHeight = toolsList.getWidgetCount() * 25;
            toolsPopup.setPopupPosition(toolsLink.getAbsoluteLeft() - 45,
                    toolsLink.getAbsoluteTop() - (listHeight - 25) - 50);
            toolsPopup.setWidth("165");
            toolsPopup.setHeight(listHeight + "");
            toolsPopup.show();
        }
    });

    HTML settings = new HTML("<i class='icon-wrench'></i>&nbsp;" + Console.CONSTANTS.common_label_settings());
    settings.addStyleName("footer-link");
    settings.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            placeManager.goTo(new DefaultPlaceRequest(NameTokens.Settings));
        }
    });

    HorizontalPanel tools = new HorizontalPanel();
    tools.add(toolsLink);
    tools.add(settings);
    layout.add(tools);

    PROGRESS_ELEMENT.addStyleName("footer");
    layout.add(PROGRESS_ELEMENT);

    String versionToShow = productInfo.getHalVersion();
    HTML version = new HTML(versionToShow);
    version.setTitle("Version Information");
    version.addStyleName("footer-link");
    version.getElement().setAttribute("style", "font-size:10px; align:left");
    version.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            final DefaultWindow window = new DefaultWindow("Version Information");
            DialogueOptions options = new DialogueOptions(Console.CONSTANTS.common_label_done(),
                    new ClickHandler() {
                        @Override
                        public void onClick(final ClickEvent event) {
                            window.hide();
                        }
                    }, "", new ClickHandler() {
                        @Override
                        public void onClick(final ClickEvent event) {
                            // noop
                        }
                    }).showCancel(false);
            window.setWidth(480);
            window.setHeight(360);
            window.trapWidget(
                    new WindowContentBuilder(new ProductConfigPanel(productInfo).asWidget(), options).build());
            window.setGlassEnabled(true);
            window.center();
        }
    });

    layout.add(version);
    layout.setWidgetLeftWidth(version, 20, PX, 200, PX);
    layout.setWidgetTopHeight(version, 10, PX, 32, PX);

    layout.setWidgetRightWidth(PROGRESS_ELEMENT, 200, PX, 150, PX);
    layout.setWidgetTopHeight(PROGRESS_ELEMENT, 12, PX, 32, PX);

    layout.setWidgetRightWidth(tools, 5, PX, 200, PX);
    layout.setWidgetTopHeight(tools, 10, PX, 32, PX);

    layout.setWidgetHorizontalPosition(tools, Layout.Alignment.END);
    layout.getElement().setAttribute("role", "complementary");

    return layout;
}

From source file:org.jboss.as.console.client.core.Footer.java

License:Open Source License

public Widget asWidget() {

    final LayoutPanel layout = new LayoutPanel();
    layout.setStyleName("footer-panel");

    final PopupPanel toolsPopup = new DefaultPopup(DefaultPopup.Arrow.BOTTOM);

    final List<String[]> toolReference = new ArrayList<String[]>();
    toolReference.add(new String[] { "Management Model", "browser" });
    toolReference.add(new String[] { "Expression Resolver", "expressions" });

    if (Diagnostics.isEnabled())
        toolReference.add(new String[] { "Diagnostics", "debug-panel" });

    final VerticalPanel toolsList = new VerticalPanel();
    toolsList.getElement().setAttribute("width", "160px");

    for (final String[] tool : toolReference) {
        InlineLink browser = new InlineLink(tool[0]);
        browser.getElement().setAttribute("style", "margin:4px");
        browser.addClickHandler(new ClickHandler() {
            @Override/*from ww w .  java  2s .  c  o  m*/
            public void onClick(ClickEvent clickEvent) {
                toolsPopup.hide();
                placeManager.revealPlace(new PlaceRequest(NameTokens.ToolsPresenter).with("name", tool[1]));
            }
        });

        toolsList.add(browser);
    }
    toolsPopup.setWidget(toolsList);

    final HTML toolsLink = new HTML("<i class='icon-caret-up'></i>&nbsp;" + "Tools");
    toolsLink.addStyleName("footer-link");
    toolsLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {

            int listHeight = toolsList.getWidgetCount() * 25;

            toolsPopup.setPopupPosition(toolsLink.getAbsoluteLeft() - 45,
                    toolsLink.getAbsoluteTop() - (listHeight - 25) - 50

            );

            toolsPopup.setWidth("165");
            toolsPopup.setHeight(listHeight + "");

            toolsPopup.show();
        }
    });

    HTML settings = new HTML("<i class='icon-wrench'></i>&nbsp;" + Console.CONSTANTS.common_label_settings());
    settings.addStyleName("footer-link");
    settings.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            placeManager.revealPlace(new PlaceRequest(NameTokens.SettingsPresenter));
        }
    });

    HTML logout = new HTML("<i class='icon-signout'></i>&nbsp;" + Console.CONSTANTS.common_label_logout());
    logout.addStyleName("footer-link");
    logout.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Feedback.confirm(Console.CONSTANTS.common_label_logout(), Console.CONSTANTS.logout_confirm(),
                    new Feedback.ConfirmationHandler() {
                        @Override
                        public void onConfirmation(boolean isConfirmed) {
                            if (isConfirmed) {
                                new LogoutCmd().execute();
                            }
                        }
                    });

        }
    });

    HorizontalPanel tools = new HorizontalPanel();
    tools.add(toolsLink);
    tools.add(settings);
    tools.add(logout);

    layout.add(tools);

    HTML version = new HTML(productConfig.getCoreVersion());
    version.getElement().setAttribute("style", "color:#ffffff;font-size:10px; align:left");
    layout.add(version);

    layout.setWidgetLeftWidth(version, 20, Style.Unit.PX, 200, Style.Unit.PX);
    layout.setWidgetTopHeight(version, 3, Style.Unit.PX, 16, Style.Unit.PX);

    layout.setWidgetRightWidth(tools, 5, Style.Unit.PX, 500, Style.Unit.PX);
    layout.setWidgetTopHeight(tools, 2, Style.Unit.PX, 28, Style.Unit.PX);

    layout.setWidgetHorizontalPosition(tools, Layout.Alignment.END);

    layout.getElement().setAttribute("role", "complementary");

    return layout;
}

From source file:org.jboss.as.console.client.shared.subsys.SubsystemTreeBuilder.java

License:Open Source License

private static void displaySubsystemHelp(LHSTreeSection subsysTree) {
    PopupPanel help = new PopupPanel();
    help.setStyleName("help-panel-open");
    help.getElement().setAttribute("style", "padding:15px");
    help.setWidget(new HTML("Mostly likely there is no UI provided to manage a particular subsystem. "
            + "It might as well be, that the profile doesn't include any subsystems at all."));
    help.setPopupPosition(subsysTree.getAbsoluteLeft() + 50, subsysTree.getAbsoluteTop() + 20);
    help.setWidth("240px");
    help.setHeight("80px");
    help.setAutoHideEnabled(true);/*from w  w  w  . j av a2s.c  o  m*/
    help.show();

}

From source file:stroom.widget.popup.client.view.PopupSupportImpl.java

License:Apache License

@Override
public void show(final PopupType popupType, final PopupPosition popupPosition, final PopupSize popupSize,
        final PopupUiHandlers popupUiHandlers) {
    this.popupUiHandlers = popupUiHandlers;

    if (popup == null) {
        popup = createPopup(popupType, popupSize, popupUiHandlers);
    }/*www .  j  a  v a2s.  c o m*/
    final PopupPanel popupPanel = (PopupPanel) popup;
    // Hide the popup because we are going to position it before making it
    // visible.
    popupPanel.setVisible(false);
    // Way to set popups to be non modal for now.
    if (modal != null) {
        popupPanel.setModal(modal);
    }

    // Set the popup size.
    if (popupSize != null) {
        popupPanel.setWidth(popupSize.getWidth() + "px");
        popupPanel.setHeight(popupSize.getHeight() + "px");
    }

    // Add auto hide partners.
    if (autoHidePartners != null && autoHidePartners.size() > 0) {
        for (final Element element : autoHidePartners) {
            popupPanel.addAutoHidePartner(element);
        }
    }

    // Attach the popup to the DOM.
    popupPanel.show();
    // Defer the command to position and make visible because we need the
    // popup to size first.
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            if (popup != null) {
                // Now get the popup size.
                final int w = popupPanel.getOffsetWidth();
                final int h = popupPanel.getOffsetHeight();

                if (popupPosition == null) {
                    // Center the popup in the client window.
                    centerPopup(popup, w, h);
                } else {
                    // Position the popup so it is as close as possible to
                    // the required location but is all on screen.
                    positionPopup(popup, popupType, popupPosition, w, h);
                }

                // Make the popup visible.
                popupPanel.setVisible(true);
                popupPanel.getElement().getStyle().setOpacity(1);

                // Tell the view that the popup is visible if necessary.
                onShow();
            }
        }
    });
}