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:com.dingziran.effective.client.content.widgets.CwBasicButton.java

License:Apache License

/**
 * Constructor.// w  w  w.ja v  a  2 s .  co  m
 *
 * @param constants the constants
 */
public CwBasicButton(CwConstants constants) {
    super(constants.cwBasicButtonName(), constants.cwBasicButtonDescription());
    this.constants = constants;
    view = new ContentWidgetView(hasMargins(), hasScrollableContent());
    view.setName(getName());
    view.setDescription(getDescription());
    setWidget(view);
    // Create a panel to align the widgets
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(10);
    final String msg = constants.cwBasicButtonClickMessage();
    // Add a normal button
    Button normalButton = new Button(constants.cwBasicButtonNormal(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.alert(msg);
        }
    });
    normalButton.ensureDebugId("cwBasicButton-normal");
    hPanel.add(normalButton);

    // Add a disabled button
    Button disabledButton = new Button(constants.cwBasicButtonDisabled());
    disabledButton.ensureDebugId("cwBasicButton-disabled");
    disabledButton.setEnabled(false);
    hPanel.add(disabledButton);
    view.setExample(hPanel);
}

From source file:com.dingziran.effective.client.content.widgets.CwCustomButton.java

License:Apache License

/**
 * Constructor./*w  w  w  .  j a va2 s.  c om*/
 *
 * @param constants the constants
 */
public CwCustomButton(CwConstants constants) {
    super(constants.cwCustomButtonName(), constants.cwCustomButtonDescription());
    this.constants = constants;
    view = new ContentWidgetView(hasMargins(), hasScrollableContent());
    view.setName(getName());
    view.setDescription(getDescription());
    setWidget(view);
    // Create a panel to layout the widgets
    VerticalPanel vpanel = new VerticalPanel();
    HorizontalPanel pushPanel = new HorizontalPanel();
    pushPanel.setSpacing(10);
    HorizontalPanel togglePanel = new HorizontalPanel();
    togglePanel.setSpacing(10);

    // Combine all the panels
    vpanel.add(new HTML(constants.cwCustomButtonPush()));
    vpanel.add(pushPanel);
    vpanel.add(new HTML("<br><br>" + constants.cwCustomButtonToggle()));
    vpanel.add(togglePanel);

    // Add a normal PushButton
    PushButton normalPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    normalPushButton.ensureDebugId("cwCustomButton-push-normal");
    pushPanel.add(normalPushButton);

    // Add a disabled PushButton
    PushButton disabledPushButton = new PushButton(new Image(Showcase.images.gwtLogo()));
    disabledPushButton.ensureDebugId("cwCustomButton-push-disabled");
    disabledPushButton.setEnabled(false);
    pushPanel.add(disabledPushButton);

    // Add a normal ToggleButton
    ToggleButton normalToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal");
    togglePanel.add(normalToggleButton);

    // Add a disabled ToggleButton
    ToggleButton disabledToggleButton = new ToggleButton(new Image(Showcase.images.gwtLogo()));
    disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled");
    disabledToggleButton.setEnabled(false);
    togglePanel.add(disabledToggleButton);

    view.setExample(vpanel);
}

From source file:com.edgenius.wiki.gwt.client.portal.PortletListDialogue.java

License:Open Source License

public PortletListDialogue(boolean anonymousLogin) {

    this.setText(Msg.consts.more_space_dialog_title());
    this.setIcon(new Image(IconBundle.I.get().application_add()));

    FlexTable topPanel = new FlexTable();
    Label label1 = new Label(Msg.consts.search_space_widget());
    label1.setStyleName(Css.FORM_LABEL);
    topPanel.setWidget(0, 0, label1);/*  www  . j a va2s. c o  m*/
    label1.setWordWrap(false);

    filter.setStyleName(Css.SEARCH_INPUT);
    topPanel.setWidget(0, 1, filter);

    filter.setTitle(Msg.consts.input_keyword());
    filter.addKeyDownHandler(new KeyDownHandler() {
        public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                keyword = filter.getText();
                if (keyword == null || keyword.trim().length() == 0)
                    return;

                searchBusyImg.setVisible(true);
                SearchControllerAsync action = ControllerFactory.getSearchController();
                //first page, return 10
                action.searchWidgetSpace(keyword, 0, SPACE_LIST_SIZE, new SpaceSearchAsync());
                tabPanel.selectTab(TAB_SEARCH);
            }
        }
    });

    topPanel.getFlexCellFormatter().setWidth(0, 0, "1%");
    topPanel.getFlexCellFormatter().setWordWrap(0, 0, false);
    topPanel.getFlexCellFormatter().setWidth(0, 1, "97%");
    int topPanelColume = 2;

    if (!anonymousLogin) {
        //so far, don't allow anonyomus to create widgets
        ClickLink newWidgetLn = new ClickLink(Msg.consts.create_widget());
        newWidgetLn.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                PortletCreateDialog dia = new PortletCreateDialog(null);
                //inherent all listener from parent, so that new portlet can add to dashboard
                for (ListDialogueListener listener : listeners) {
                    dia.addListDialogueListener(listener);
                }
                //close PortletListDialog -- don't ask 2 dialog open at same time
                hidebox();
                dia.showbox();
            }
        });
        topPanel.setWidget(0, 2, new Image(IconBundle.I.get().star()));
        topPanel.setWidget(0, 3, newWidgetLn);
        topPanel.getFlexCellFormatter().setWidth(0, 2, "1%");
        topPanel.getFlexCellFormatter().setWidth(0, 3, "1%");
        topPanel.getFlexCellFormatter().setWordWrap(0, 3, false);
        topPanelColume = 4;
    }

    //candidate list after user chooses
    topPanel.setWidget(1, 0, candidatePanel);
    topPanel.getFlexCellFormatter().setColSpan(1, 0, topPanelColume);

    Button okBtn = new Button(Msg.consts.ok(), ButtonIconBundle.tickImage());
    okBtn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hidebox();
            //collect data(PortletModel) from candidate panel 
            List values = candidatePanel.getCandidates();

            //reverse value: because the portlet insert before the one which has same row number, 
            //so far all portlets row are all 0. So, reverse them, so that first chosen portlet will display ahead others
            List portlets = new ArrayList();
            int size = values.size();
            for (int idx = size - 1; idx >= 0; idx--) {
                portlets.add(values.get(idx));
            }
            //fire event, tell observer to update portlet
            for (Iterator<ListDialogueListener> iter = listeners.iterator(); iter.hasNext();) {
                ListDialogueListener lis = iter.next();
                lis.dialogClosed(PortletListDialogue.this, portlets);
            }
        }
    });
    Button cancelBtn = new Button(Msg.consts.cancel(), ButtonIconBundle.crossImage());
    cancelBtn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            PortletListDialogue.this.hidebox();
        }
    });

    getButtonBar().add(cancelBtn);
    getButtonBar().add(okBtn);

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //               Popular Tab
    VerticalPanel pPanel = new VerticalPanel();
    pPanel.add(popularBusyImg);
    popularBusyImg.setVisible(true);
    pPanel.add(popularTable);
    initTable(popularTable, false);

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //               Search Tab
    VerticalPanel rPanel = new VerticalPanel();
    HorizontalPanel h1 = new HorizontalPanel();
    pagination.addPaginationListener(new SearchPaginationCallback());
    pagination.setPageSize(SPACE_LIST_SIZE);
    h1.add(pagination);
    h1.add(summary);
    h1.setSpacing(5);

    rPanel.add(searchBusyImg);
    searchBusyImg.setVisible(false);
    rPanel.add(searchRsTable);
    rPanel.add(rsMessage);
    rPanel.add(h1);
    initTable(widgetTable, true);

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //               Widget Tab
    VerticalPanel wPanel = new VerticalPanel();
    widgetBusyImg.setVisible(false);
    wPanel.add(widgetBusyImg);
    wPanel.add(widgetTable);
    initTable(widgetTable, false);

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //               Tab panel
    tabPanel.add(pPanel, Msg.consts.popular_spaces());
    tabPanel.add(wPanel, Msg.consts.widgets());
    tabPanel.add(rPanel, Msg.consts.search_result());
    tabPanel.selectTab(TAB_POPULAR);

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);
    panel.add(topPanel);
    panel.add(tabPanel);

    pPanel.setHeight("1%");
    wPanel.setHeight("1%");
    rPanel.setHeight("1%");
    tabPanel.setWidth("100%");
    panel.setSize("100%", "98%");
    panel.setCellHeight(tabPanel, "100%");

    topPanel.setStyleName(Css.BOX);
    tabPanel.addSelectionHandler(this);
    panel.setSpacing(5);

    this.addStyleName(Css.PORTLET_DIALOG_BOX);

    this.setWidget(panel);

    SpaceControllerAsync spaceController = ControllerFactory.getSpaceController();
    spaceController.getSpacesInfo(null, SPACE_LIST_SIZE, null, new PopularCallback());

}

From source file:com.edgenius.wiki.gwt.client.user.UserInfoPanel.java

License:Open Source License

public UserInfoPanel(final Widget parent, String spaceUname, final String username, String portrait,
        boolean showPortrait) {
    this.parent = parent;
    this.username = username;

    VerticalPanel main = new VerticalPanel();
    HorizontalPanel center = new HorizontalPanel();
    FlowPanel profile = new FlowPanel();
    this.showPortrait = showPortrait;
    if (showPortrait && !StringUtil.isBlank(portrait)) {
        portraitPanel.add(GwtClientUtils.createUserPortrait(portrait));
    }/*  www . j av a 2s.  c  o  m*/
    center.add(portraitPanel);
    center.add(profile);

    status.setStyleName(Css.STATUS_SNAP);

    Label lb = new Label(Msg.consts.recent_update_pages());
    lb.setStyleName(Css.HEADING3);
    lb.addStyleName(Css.UNDERLINE);

    profile.add(status);
    profile.add(lb);
    profile.add(pagesPanel);
    profile.add(loadingImg);

    main.add(message);
    main.add(center);
    if (!AbstractEntryPoint.isOffline()) {
        func.setWidth("100%");
        func.setStyleName(Css.ACTION_TABS);
        main.add(func);
    }

    center.setCellWidth(profile, "100%");
    center.setSpacing(2);
    profile.setSize("100%", "100%");
    center.setSize("100%", "100%");
    main.setSize("100%", "100%");
    center.setStyleName(Css.PROFILE);

    this.setWidget(main);
    loadingImg.setVisible(true);
    PageControllerAsync pageController = ControllerFactory.getPageController();
    //get user recent updated pages for this space
    pageController.getUserPagesInSpace(spaceUname, username, 5, this);

}

From source file:com.ephesoft.dcma.gwt.core.client.view.ExternalAppDialogBox.java

License:Open Source License

public ExternalAppDialogBox(String url, int xDimension, int yDimension, boolean showOkButton,
        boolean showCloseButton, boolean center, boolean isVisible) {
    setWidget(BINDER.createAndBindUi(this));
    addStyleName(CSS_CONFIGURABLE_DIALOG_BOX);
    setWidth(xDimension + "px");
    setHeight(yDimension + "px");
    frame = new Frame(url);
    frame.setWidth(xDimension + "px");
    frame.setHeight(yDimension + "px");
    okButton = new Button("Ok", new ClickHandler() {

        @Override/*from   w  ww .j  a v a  2 s  .  c o  m*/
        public void onClick(ClickEvent arg0) {
            listener.onOkClick();
            hide();
        }
    });
    okButton.setTitle("Ctrl+a");
    closeButton = new Button("Close", new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            listener.onCloseClick();
            hide();
        }
    });
    closeButton.setTitle("Ctrl+z");
    okButton.getElement().setAttribute("id", "okButtonElement");
    closeButton.getElement().setAttribute("id", "closeButtonElement");
    okButton.setVisible(showOkButton);
    closeButton.setVisible(showCloseButton);
    HorizontalPanel horizontalButtonPanel = new HorizontalPanel();
    horizontalButtonPanel.setSpacing(5);
    if (showOkButton) {
        horizontalButtonPanel.add(okButton);
        horizontalButtonPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_CENTER);
    }
    if (showCloseButton) {
        horizontalButtonPanel.add(closeButton);
        horizontalButtonPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);
    }
    verticalPanel.add(frame);
    verticalPanel.setCellHorizontalAlignment(frame, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(horizontalButtonPanel);
    setModal(true);
    setVisible(true);
    if (center) {
        center();
    }
    if (isVisible) {
        show();
    }
}

From source file:com.ephesoft.dcma.gwt.foldermanager.client.view.FolderTableView.java

License:Open Source License

private void showTableOptions() {
    folderUploadWidget.setVisible(true);
    if (multipleSelectionPanel == null) {
        multipleSelectionPanel = new VerticalPanel();
        HorizontalPanel labelPanel = new HorizontalPanel();
        Label label = new Label(
                LocaleDictionary.get().getMessageValue(FolderManagementMessages.MULTI_SELECT_OPTIONS));
        labelPanel.add(label);//from   w w w  .  j a v  a  2s .c o  m
        labelPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        multipleSelectionPanel.add(labelPanel);
        HorizontalPanel multipleSelectionButtonPanel = new HorizontalPanel();
        multipleSelectionPanel.add(multipleSelectionButtonPanel);
        multipleSelectionButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        multipleSelectionButtonPanel.add(cut);
        multipleSelectionButtonPanel.add(copy);
        multipleSelectionButtonPanel.add(paste);
        multipleSelectionButtonPanel.add(deleteSelected);
        multipleSelectionButtonPanel.setSpacing(2);
    }
    if (folderPathOperationsPanel == null) {
        folderPathOperationsPanel = new VerticalPanel();
        HorizontalPanel folderLabelPanel = new HorizontalPanel();
        Label label = new Label(LocaleDictionary.get().getConstantValue(FolderManagementConstants.FOLDER));
        folderLabelPanel.add(label);
        folderLabelPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        HorizontalPanel folderPathOperationButtonsPanel = new HorizontalPanel();
        folderPathOperationButtonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        folderPathOperationButtonsPanel.setSpacing(2);
        createNewFolder.setWidth(_100PX);
        folderPathOperationButtonsPanel.add(createNewFolder);
        folderPathOperationButtonsPanel.add(folderUpButton);
        folderPathOperationButtonsPanel.add(refresh);
        folderPathOperationsPanel.add(folderLabelPanel);
        folderPathOperationsPanel.add(folderPathOperationButtonsPanel);
    }
    optionsPanel.add(folderPathOperationsPanel);
    optionsPanel.setCellHorizontalAlignment(folderPathOperationsPanel, HasHorizontalAlignment.ALIGN_LEFT);
    optionsPanel.add(folderUploadWidget);
    optionsPanel.setCellHorizontalAlignment(folderUploadWidget, HasHorizontalAlignment.ALIGN_CENTER);
    optionsPanel.add(multipleSelectionPanel);
    optionsPanel.setCellHorizontalAlignment(multipleSelectionPanel, HasHorizontalAlignment.ALIGN_RIGHT);
    optionsPanel.addStyleName(OPTIONS_CSS);
}

From source file:com.ephesoft.dcma.gwt.foldermanager.client.view.widget.DisplayDialogBox.java

License:Open Source License

public DisplayDialogBox(Map<Integer, String> fileIndexVsNameMap, final HandlerManager eventBus) {
    super();//from ww  w  .j  av  a 2  s .  c  om
    setWidget(BINDER.createAndBindUi(this));
    this.eventBus = eventBus;
    final VerticalPanel labelPanel = new VerticalPanel();
    if (fileIndexVsNameMap != null && !fileIndexVsNameMap.isEmpty()) {
        for (final Entry<Integer, String> labelString : fileIndexVsNameMap.entrySet()) {
            totalCounter++;
            final HorizontalPanel horizontalPanel = new HorizontalPanel();
            HTML html = new HTML(FolderManagementConstants.REMOVE_ICON_FOLDER_GIF);
            Label label = new Label(labelString.getValue());
            horizontalPanel.add(html);
            horizontalPanel.add(label);
            horizontalPanel.setSpacing(3);
            labelPanel.add(horizontalPanel);
            html.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent arg0) {
                    labelPanel.remove(horizontalPanel);
                    if (--totalCounter == 0) {
                        addNoFilesLabel(labelPanel);
                    }
                    eventBus.fireEvent(new RemoveAttachmentEvent(labelString.getKey()));
                }

            });

        }
    } else {
        addNoFilesLabel(labelPanel);
    }
    addStyleName(FolderManagementConstants.CSS_CONFIGURABLE_DIALOG_BOX);
    Button closeButton = new Button(LocaleDictionary.get().getConstantValue(FolderManagementConstants.CLOSE),
            new ClickHandler() {

                @Override
                public void onClick(ClickEvent arg0) {
                    hide();
                }
            });
    HorizontalPanel horizontalButtonPanel = new HorizontalPanel();
    horizontalButtonPanel.add(closeButton);
    horizontalButtonPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);
    ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.add(labelPanel);
    scrollPanel.setWidth(_200PX);
    scrollPanel.setHeight(_200PX);
    scrollPanel.addStyleName(FolderManagementConstants.BORDER);
    setHeight(_100PX);
    verticalPanel.add(scrollPanel);
    verticalPanel.add(horizontalButtonPanel);
    verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    setModal(true);
    setVisible(true);
    show();
    center();
    closeButton.setFocus(true);
}

From source file:com.ephesoft.dcma.gwt.rv.client.view.ExternalAppDialogBox.java

License:Open Source License

public ExternalAppDialogBox(String url, java.util.Map<String, String> dimensionsOfPopUpMap) {
    super();/*from   www .  j av  a 2s.  c om*/
    setWidget(BINDER.createAndBindUi(this));
    addStyleName(ReviewValidateConstants.CONFIGURED_DIMENSIONS_DIALOG);
    int xDimension;
    int yDimension;

    try {
        xDimension = Integer.parseInt(dimensionsOfPopUpMap.get(ReviewValidateConstants.POP_UP_X_DIMENSION));
        if (xDimension < 0) {
            xDimension = DEFAULT_X_DIMENSION;
        }
    } catch (Exception e) {
        xDimension = DEFAULT_X_DIMENSION;
    }

    try {
        yDimension = Integer.parseInt(dimensionsOfPopUpMap.get(ReviewValidateConstants.POP_UP_Y_DIMENSION));
        if (yDimension < 0) {
            yDimension = DEFAULT_Y_DIMENSION;
        }
    } catch (Exception e) {
        yDimension = DEFAULT_Y_DIMENSION;
    }

    setWidth(xDimension + "px");
    setHeight(yDimension + "px");
    Frame frame = new Frame(url);
    frame.setWidth(xDimension + "px");
    frame.setHeight(yDimension + "px");
    okButton = new Button("Ok", new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            listener.onOkClick();
            hide();
        }
    });
    okButton.setTitle("Ctrl+a");
    closeButton = new Button("Close", new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            listener.onCloseClick();
            hide();
        }
    });
    closeButton.setTitle("Ctrl+z");
    okButton.getElement().setAttribute("id", "okButtonElement");
    closeButton.getElement().setAttribute("id", "closeButtonElement");
    okButton.setVisible(false);
    closeButton.setVisible(false);
    HorizontalPanel horizontalButtonPanel = new HorizontalPanel();
    horizontalButtonPanel.setSpacing(5);
    horizontalButtonPanel.add(okButton);
    horizontalButtonPanel.add(closeButton);
    horizontalButtonPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalButtonPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(frame);
    verticalPanel.setCellHorizontalAlignment(frame, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(horizontalButtonPanel);
    setModal(true);
    setVisible(true);
    show();
}

From source file:com.ephesoft.gxt.core.client.ui.widget.ScreenNavigatorWidget.java

License:Open Source License

private HorizontalPanel getInnerHorizontalPanel(Widget firstWidget, final Widget secondWidget) {
    final HorizontalPanel widgetHorizontalPanel = new HorizontalPanel();
    widgetHorizontalPanel.add(firstWidget);
    widgetHorizontalPanel.getElement().setAttribute("cellPadding", "2");
    widgetHorizontalPanel.setSpacing(1);
    widgetHorizontalPanel.setWidth("100px");
    secondWidget.setVisible(true);/* www .  jav a2 s  .c o m*/
    secondWidget.addStyleName("panelLabelStyle");
    final MenuBar menuBar = (MenuBar) secondWidget;
    final MenuBarWidget menuBarWidget = new MenuBarWidget(true);
    menuBarWidget.addItem(new MenuItem(menuBar.getTitle(), menuBar));
    widgetHorizontalPanel.add(menuBarWidget);
    menuBarWidget.setVisible(false);
    widgetHorizontalPanel.addDomHandler(new MouseOverHandler() {

        public void onMouseOver(MouseOverEvent event) {
            widgetHorizontalPanel.addStyleName("horizontalPanelMouseHover");
            menuBarWidget.setAutoOpen(true);
            menuBarWidget.setSelectedMenu(false);
            if (null != previosMenuBar) {
                previosMenuBar.closeAllChildren(false);
            }
        }
    }, MouseOverEvent.getType());

    widgetHorizontalPanel.addDomHandler(new MouseOutHandler() {

        public void onMouseOut(MouseOutEvent event) {
            widgetHorizontalPanel.removeStyleName("horizontalPanelMouseHover");
            menuBarWidget.setSelectedMenu(true);
            previosMenuBar = menuBarWidget;
        }
    }, MouseOutEvent.getType());
    return widgetHorizontalPanel;
}

From source file:com.ephesoft.gxt.core.client.ui.widget.ScreenNavigatorWidget.java

License:Open Source License

private HorizontalPanel getPageMenuInnerHorizontalPanel(Widget firstWidget, final Widget secondWidget,
        final String url) {
    final HorizontalPanel widgetHorizontalPanel = new HorizontalPanel();
    widgetHorizontalPanel.add(firstWidget);
    widgetHorizontalPanel.add(secondWidget);
    widgetHorizontalPanel.getElement().setAttribute("cellPadding", "2");
    widgetHorizontalPanel.setSpacing(1);
    widgetHorizontalPanel.addStyleName("panelWidth");
    secondWidget.setVisible(false);// w  w w .  ja  va  2  s  . c  om
    secondWidget.setWidth("100px");
    secondWidget.addStyleName("panelLabelStyle");
    if (!url.equalsIgnoreCase(CoreCommonConstant.EMPTY_STRING)) {
        String currentURL = Window.Location.getHref();
        String baseUrl = currentURL.substring(0, currentURL.lastIndexOf('/'));
        StringBuffer newUrl = new StringBuffer();
        newUrl.append(baseUrl).append(url);
        if (currentURL.equalsIgnoreCase(newUrl.toString())) {
            widgetHorizontalPanel.addStyleName("setSelectedPageStyle");
        }
    }
    widgetHorizontalPanel.addDomHandler(new MouseOverHandler() {

        public void onMouseOver(MouseOverEvent event) {
            widgetHorizontalPanel.addStyleName("horizontalPanelMouseHover");
            if (null != previosMenuBar) {
                previosMenuBar.closeAllChildren(false);
            }
        }
    }, MouseOverEvent.getType());

    widgetHorizontalPanel.addDomHandler(new MouseOutHandler() {

        public void onMouseOut(MouseOutEvent event) {
            widgetHorizontalPanel.removeStyleName("horizontalPanelMouseHover");
        }
    }, MouseOutEvent.getType());
    widgetHorizontalPanel.addDomHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (!url.equalsIgnoreCase(CoreCommonConstant.EMPTY_STRING)) {
                String href = Window.Location.getHref();
                String baseUrl = href.substring(0, href.lastIndexOf('/'));
                StringBuffer newUrl = new StringBuffer();
                newUrl.append(baseUrl).append(url);
                Window.Location.assign(newUrl.toString());
            }
        }
    }, ClickEvent.getType());
    return widgetHorizontalPanel;
}