Example usage for com.google.gwt.user.client.ui HorizontalPanel setSpacing

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setSpacing

Introduction

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

Prototype

public void setSpacing(int spacing) 

Source Link

Document

Sets the amount of spacing between this panel's cells.

Usage

From source file:org.mobicents.slee.container.management.console.client.common.BrowseContainer.java

License:Open Source License

private void refreshLinks() {

    if (links.size() <= 1)
        return;/*from w  ww .  ja va2 s .  c o  m*/

    HorizontalPanel header = new HorizontalPanel();

    header.setStyleName("common-BrowseContainer-links");

    header.setSpacing(5);
    header.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    int firstLink = 0;

    if (!showAllLinks) {
        firstLink = Math.max(0, links.size() - MAX_BREADCRUMB_LINKS);

        if (firstLink > 0) {
            MenuBar hiddenMenu = new MenuBar();
            MenuBar subMenu = new MenuBar(true);

            for (int q = firstLink - 1; q >= 0; q--) {
                final int fq = q;
                Command cmd = new Command() {
                    public void execute() {
                        select(fq);
                    }
                };
                BrowseLink link = (BrowseLink) links.get(q);
                subMenu.addItem(link.getTitle(), cmd);
            }
            MenuItem root = new MenuItem("History", subMenu);
            hiddenMenu.addItem(root);
            /*
             * Hyperlink showAllLink = new Hyperlink("(show hidden)", "(show hidden)"); ClickListener listener = new ClickListener() { public
             * void onClick(Widget source) { showAllLinks = true; refresh(); showAllLinks = false; } }; showAllLink.addClickListener(listener);
             */
            header.add(hiddenMenu);
            header.add(new Image("images/chain.separator.gif"));
        }
    }
    for (int i = firstLink; i <= links.size() - 1; i++) {
        BrowseLink link = links.get(i);
        shortifyAndAddLink(header, link);
        if (i != links.size() - 1) {
            header.add(new Image("images/chain.separator.gif"));
            ((BrowseLink) links.get(i)).setStyle(false);
        } else {
            ((BrowseLink) links.get(i)).setStyle(true);
        }
    }
    rootPanel.add(header);
}

From source file:org.mobicents.slee.container.management.console.client.sleestate.SleeStatePanel.java

License:Open Source License

public SleeStatePanel() {
    super();/*from w w w . j  ava  2 s . c o m*/

    startButton.setTitle("Start");
    stopButton.setTitle("Stop");
    shutdownButton.setTitle("Shutdown");
    final Label header = new Label("Mobicents JAIN SLEE is");
    ServerCallback callback = new ServerCallback(this) {
        public void onSuccess(Object result) {
            header.setText((String) result + " is");
        }
    };
    service.getVersion(callback);
    HorizontalPanel buttonsPanel = new HorizontalPanel();
    buttonsPanel.setSpacing(5);
    buttonsPanel.add(startButton);
    buttonsPanel.add(stopButton);
    buttonsPanel.add(shutdownButton);

    startButton.setEnabled(false);
    stopButton.setEnabled(false);
    shutdownButton.setEnabled(false);

    startButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            onStartButton();
        }
    });

    stopButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            onStopButton();
        }
    });

    shutdownButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            onShutdownButton();
        }
    });

    timer = new Timer() {
        public void run() {
            updateState();
        }
    };

    add(header);
    add(state);
    add(buttonsPanel);

    setStyleName("sleestate-SleeStatePanel");
    setSpacing(5);
    state.setStyleName("sleestate-SleeStatePanel-state");

    setCellHorizontalAlignment(header, HasHorizontalAlignment.ALIGN_CENTER);
    setCellHorizontalAlignment(state, HasHorizontalAlignment.ALIGN_CENTER);
    setCellHorizontalAlignment(buttonsPanel, HasHorizontalAlignment.ALIGN_CENTER);
}

From source file:org.onecmdb.ui.gwt.toolkit.client.view.input.CIMultiValueWidget.java

License:Open Source License

protected Widget getMultiListAsList(final MultipleAttributeValue mValue) {
    final HorizontalPanel hPanel = new HorizontalPanel();
    CIIconWidget icon = new CIIconWidget(mValue.getType());
    icon.update();/*from  www. j a  va 2  s .co m*/
    hPanel.setWidth("100%");
    hPanel.add(icon);
    hPanel.setCellHorizontalAlignment(icon, HorizontalPanel.ALIGN_LEFT);
    Label name = new Label(mValue.getDisplayName());
    hPanel.add(name);
    HorizontalPanel actionPanel = new HorizontalPanel();
    actionPanel.setSpacing(6);

    if (!mValue.getCtrl().isReadonly()) {
        // Add action
        if (mValue.isComplex()) {
            addImage = new Image("images/eclipse/add_multi.gif");
            addImage.setTitle("Select values to the multi valued attribute");
        } else {
            addImage = new Image("images/eclipse/add_single.gif");
            addImage.setTitle("Add one value to the multi valued attribute");
        }
        actionPanel.add(addImage);

        // Delete all action
        Image deleteAllImage = new Image("images/delete-value.gif");
        deleteAllImage.setTitle("Remove ALL values!");
        actionPanel.add(deleteAllImage);
        deleteAllImage.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                if (Window.confirm("Remove all values for attribute?")) {
                    mValue.removeAttributeValues();
                    clearValues();
                }
            }

        });
        actionPanel.add(deleteAllImage);
    }

    // Expand action
    expandImage = new Image();
    expandImage.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            setExpandState(!expandState);
        }
    });
    setExpandState(true);

    actionPanel.add(expandImage);
    actionPanel.setCellVerticalAlignment(expandImage, VerticalPanel.ALIGN_MIDDLE);

    hPanel.add(actionPanel);
    hPanel.setCellHorizontalAlignment(actionPanel, HorizontalPanel.ALIGN_RIGHT);
    vPanel.add(hPanel);
    vPanel.add(valuePanel);
    return (vPanel);
}

From source file:org.onecmdb.ui.gwt.toolkit.client.view.screen.header.HeaderScreen.java

License:Apache License

public HeaderScreen() {
    HorizontalPanel outer = new HorizontalPanel();
    VerticalPanel inner = new VerticalPanel();
    outer.setWidth("100%");
    outer.setHeight("3em");

    //outer.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    inner.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    inner.setWidth("100%");
    inner.setHeight("100%");

    HorizontalPanel authInfo = new HorizontalPanel();
    //authInfo.setSpacing(4);
    logout.setStyleName("logout-style");
    authInfo.add(welcomeString);/*from  w w  w. j ava 2 s  .  c  o m*/
    authInfo.add(logout);
    logout.setVisible(false);
    logout.addClickListener(this);
    inner.add(authInfo);

    HorizontalPanel actionPanel = new HorizontalPanel();
    actionPanel.setStyleName("onecmdb-header-label");
    actionPanel.setSpacing(10);
    actionPanel.add(getFeedbackWidget());
    actionPanel.add(getCheckUpdateWidget());

    actionPanel.add(getHomeWidegt());
    actionPanel.add(getHelpWidget());

    inner.add(actionPanel);
    inner.setCellVerticalAlignment(actionPanel, VerticalPanel.ALIGN_BOTTOM);
    inner.setCellVerticalAlignment(authInfo, VerticalPanel.ALIGN_TOP);

    //DockPanel iconPanel = new DockPanel();
    //iconPanel.setWidth("100%");
    //welcomePanel.setSpacing(10);
    //iconPanel.add(icon,DockPanel.EAST);
    //    welcomePanel.add(new HTML("<b>&nbsp;</b>"),DockPanel.CENTER);
    outer.add(icon);
    outer.setCellHorizontalAlignment(icon, HorizontalPanel.ALIGN_LEFT);
    outer.add(inner);
    outer.setCellHorizontalAlignment(inner, HorizontalPanel.ALIGN_RIGHT);

    // Show welcome page.
    icon.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            getBaseEntryScreen().showScreen(OneCMDBApplication.WELCOME_SCREEN);
        }
    });

    initWidget(outer);
    //outer.setStyleName("one-top-panel");
}

From source file:org.openempi.webapp.client.ui.mainpane.HeaderPane.java

License:Open Source License

/**
 * Build this conditionally based on isLoggedIn
 * @param isLoggedIn// ww w .j  a v  a  2 s  .c o m
 * @return
 */
private HorizontalPanel buildHeaderPanel(boolean isLoggedIn) {
    HorizontalPanel panel = new HorizontalPanel();
    if (isLoggedIn) {
        panel.setSpacing(10);
        panel.add(new Label("Welcome " + getClientState().getUserName()));

        PushButton logoutButton = new PushButton("Logout");
        logoutButton.setStyleName("LogoutButton");
        logoutButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                logout();
            }
        });
        panel.add(logoutButton);
    } else {
        PushButton loginButon = new PushButton("Login");
        loginButon.setStyleName("LoginButton");
        loginButon.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                showNewUserNameRequestPopupPanel();
            }
        });
        panel.add(loginButon);
    }
    return panel;
}

From source file:org.openxdata.designer.client.util.FormDesignerUtil.java

/**
 * Creates an HTML fragment that places an image & caption together, for use
 * in a group header.//w  w  w .  j a  va2 s.c  o  m
 * 
 * @param imageProto an image prototype for an image
 * @param caption the group caption
 * @return the header HTML fragment
 */
public static String createHeaderHTML(ImageResource imageProto, String caption) {

    //Add the image and text to a horizontal panel
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(0);

    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.add(FormUtil.createImage(imageProto));
    //HTML headerText = new HTML(caption);
    Widget headerText = new Label(caption);
    hPanel.add(headerText);

    return hPanel.getElement().getString();
}

From source file:org.openxdata.designer.client.view.DynamicListsView.java

/**
 * Sets up widgets.//w ww.  j a  v a 2s . c o  m
 */
private void setupWidgets() {

    fieldWidget = new FieldWidget(this);
    fieldWidget.setForDynamicOptions(true);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.add(lblValuesFor);
    horizontalPanel.add(fieldWidget);
    horizontalPanel.add(lblEqual);
    horizontalPanel.add(lbOption);
    horizontalPanel.setSpacing(5);

    verticalPanel.add(horizontalPanel);
    verticalPanel.add(table);

    lbOption.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            updateOptionList();
        }
    });

    btnAdd.addClickHandler(this);

    table.setStyleName("cw-FlexTable");
    table.setWidget(0, 0, new Label(i18n.text()));
    table.setWidget(0, 1, new Label(messages.binding()));
    table.setWidget(0, 2, new Label(i18n.action()));
    table.getFlexCellFormatter().setColSpan(0, 2, 3);

    table.setWidth("100%");
    table.setHeight("100%");

    table.getCellFormatter().setStyleName(0, 0, "getting-started-label");
    table.getCellFormatter().setStyleName(0, 1, "getting-started-label");
    table.getCellFormatter().setStyleName(0, 2, "getting-started-label");

    initWidget(verticalPanel);
}

From source file:org.openxdata.designer.client.view.SkipQtnsDialog.java

/**
 * Creates a new instance of skip questions dialog box.
 *//*www .  j a  v a2  s . com*/
public SkipQtnsDialog(QuestionSelectionListener qtnSelListener) {

    this.qtnSelListener = qtnSelListener;

    lbAllQtns.setWidth("250" + OpenXdataConstants.UNITS);
    lbSelQtns.setWidth("250" + OpenXdataConstants.UNITS);
    lbAllQtns.setHeight("200" + OpenXdataConstants.UNITS);
    lbSelQtns.setHeight("200" + OpenXdataConstants.UNITS);

    setWidget(mainPanel);

    setupHeaderLabels();

    HorizontalPanel horzPanel = new HorizontalPanel();
    horzPanel.add(lbAllQtns);

    lbAllQtns.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            btnSelect.setEnabled(true);
        }
    });

    lbSelQtns.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            btnDeselect.setEnabled(true);
        }
    });

    setupSelectionButtons(horzPanel);

    horzPanel.add(lbSelQtns);
    horzPanel.setSpacing(5);
    mainPanel.add(horzPanel);

    setupOkCancelButtons();

    mainPanel.setSpacing(5);

    setText(formsConstants.otherQuestions());
}

From source file:org.openxdata.designer.client.widget.PaletteWidget.java

/**
 * Creates a new instance of the palette.
 * //from  w  ww.j av a2 s.  c  om
 * @param images the palette images.
 * @param html the name of the widget
 */
public PaletteWidget(FormDesignerImages images, HTML html) {
    name = html.getText();

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(5);
    hPanel.add(FormUtil.createImage(images.add()));
    hPanel.add(html);
    initWidget(hPanel);

    DOM.sinkEvents(getElement(), DOM.getEventsSunk(getElement()) | Event.MOUSEEVENTS);

    DOM.setStyleAttribute(getElement(), "cursor", "pointer");
}