Example usage for com.google.gwt.user.client.ui LayoutPanel setWidgetHorizontalPosition

List of usage examples for com.google.gwt.user.client.ui LayoutPanel setWidgetHorizontalPosition

Introduction

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

Prototype

public void setWidgetHorizontalPosition(Widget child, Alignment position) 

Source Link

Document

Sets the child widget's horizontal position within its layer.

Usage

From source file:com.spinque.gwt.utils.client.widgets.VerticalTabLayoutPanel.java

License:Apache License

/**
 * Creates an empty tab panel./*ww w  . ja v  a 2s . com*/
 *
 * @param barHeight the size of the tab bar
 * @param barUnit the unit in which the tab bar size is specified
 */
public VerticalTabLayoutPanel(double barHeight, Unit barUnit) {
    LayoutPanel panel = new LayoutPanel();
    initWidget(panel);

    // Add the tab bar to the panel.
    panel.add(tabBar);
    panel.setWidgetTopBottom(tabBar, 0, Unit.PX, 0, Unit.PX);
    panel.setWidgetLeftWidth(tabBar, 0, Unit.PX, barHeight, barUnit);
    panel.setWidgetHorizontalPosition(tabBar, Alignment.END);

    // Add the deck panel to the panel.
    deckPanel.addStyleName(CONTENT_CONTAINER_STYLE);
    panel.add(deckPanel);
    panel.setWidgetTopBottom(deckPanel, 0, Unit.PX, 0, Unit.PX);
    panel.setWidgetLeftRight(deckPanel, barHeight, barUnit, 0, Unit.PX);

    // Make the tab bar extremely wide so that tabs themselves never wrap.
    // (Its layout container is overflow:hidden)
    //    tabBar.getElement().getStyle().setWidth(BIG_ENOUGH_TO_NOT_WRAP, Unit.PX);

    tabBar.setStyleName("gwt-TabLayoutPanelTabs");
    setStyleName("gwt-TabLayoutPanel");
}

From source file:es.upm.fi.dia.oeg.map4rdf.client.widget.LoadingWidget.java

License:Open Source License

private Widget createUi(ImageResource loadingIconResource) {
    Image loadingIcon = new Image(loadingIconResource);
    Label label = new Label(messages.loading());
    LayoutPanel panel = new LayoutPanel();
    panel.add(loadingIcon);//from   w ww  .jav a2s.c  o m
    panel.add(label);
    panel.setWidgetHorizontalPosition(loadingIcon, Alignment.BEGIN);
    panel.setWidgetHorizontalPosition(label, Alignment.END);

    panel.setWidth("160px");
    panel.setHeight("32px");
    return panel;
}

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 ww  w .ja  va  2s. 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  w ww  .  j  a  v a  2s  .c  om
            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.simpledbm.samples.forum.client.TopPanel.java

License:Open Source License

public TopPanel() {
    LayoutPanel panel = new LayoutPanel();
    HorizontalPanel inner = new HorizontalPanel();
    inner.setSpacing(10);/*from   w w w .  ja v  a2s .  c om*/
    inner.add(aboutLink);
    inner.add(signOutLink);
    panel.add(inner);
    panel.setWidgetHorizontalPosition(inner, Alignment.END);

    signOutLink.addClickHandler(this);
    aboutLink.addClickHandler(this);

    initWidget(panel);
}