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

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

Introduction

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

Prototype

public void setCellVerticalAlignment(IsWidget w, VerticalAlignmentConstant align) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

public void displayBarAndTabs(String message) {
    /* top bar */
    displayStatusPage("Drawing the tabs...");

    HorizontalPanel top_bar = new HorizontalPanel();
    top_bar.getElement().setClassName("euca-top-bar");

    HorizontalPanel name_panel = new HorizontalPanel();
    name_panel.getElement().setClassName("euca-top-bar-left");
    name_panel.setSpacing(5);//from w w w.ja  v a 2  s  .co  m
    name_panel.add(new HTML(Theme.draw_header()));
    top_bar.add(name_panel);

    top_bar.setCellHorizontalAlignment(name_panel, HorizontalPanel.ALIGN_LEFT);
    top_bar.setCellVerticalAlignment(name_panel, HorizontalPanel.ALIGN_TOP); // michael left this as MIDDLE

    HorizontalPanel upanel = new HorizontalPanel();
    upanel.getElement().setClassName("euca-top-bar-right");
    Label user_name = new HTML(
            "Logged in as <b>" + loggedInUser.getUserName() + "</b>&nbsp;&nbsp;|&nbsp;&nbsp;");
    Hyperlink logout_button = new Hyperlink("Logout", "logout");
    logout_button.addClickListener(LogoutButtonListener);
    upanel.add(user_name);
    upanel.add(logout_button);
    top_bar.add(upanel);
    top_bar.setCellHorizontalAlignment(upanel, HorizontalPanel.ALIGN_RIGHT);
    top_bar.setCellVerticalAlignment(upanel, HorizontalPanel.ALIGN_TOP);

    final HorizontalPanel messageBox = new HorizontalPanel();
    messageBox.setStyleName("euca-message-bar");
    messageBox.setSpacing(3);
    messageBox.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    messageBox.add(statusMessage);
    statusMessage.setStyleName("euca-small-text");

    final VerticalPanel wrapper = new VerticalPanel();
    wrapper.setStyleName("euca-tab-contents");
    //        wrapper.setSize("100%", "80%");
    //        wrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    //        wrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // set up tab layout so that *TabIndex variables are set in the beginning
    int nTabs = 0;
    allTabs = new TabBar();

    allTabs.addTab("Credentials");
    credsTabIndex = nTabs++;
    allTabs.addTab("Images");
    imgTabIndex = nTabs++;
    /////allTabs.addTab ("Instances"); instTabIndex = nTabs++;
    if (loggedInUser.isAdministrator() != null && loggedInUser.isAdministrator().booleanValue()) {
        allTabs.addTab("Users");
        usrTabIndex = nTabs++;
        allTabs.addTab("Configuration");
        confTabIndex = nTabs++;
        allTabs.addTab("Extras");
        downTabIndex = nTabs++;
        if (extensions != null && extensions.contains("store")) {
            allTabs.addTab("Store");
            storeTabIndex = nTabs++;
        }
    }
    // can happen if admin user re-logs in as regular without reloading
    if (currentTabIndex > (nTabs - 1)) {
        currentTabIndex = 0;
    }
    allTabs.addTabListener(new TabListener() {
        public void onTabSelected(SourcesTabEvents sender, int tabIndex) {
            String error = "This tab is not implemented yet, sorry!";
            statusMessage.setText("");
            wrapper.clear();
            currentTabIndex = tabIndex;
            if (tabIndex == credsTabIndex) {
                displayCredentialsTab(wrapper);
            } else if (tabIndex == imgTabIndex) {
                displayImagesTab(wrapper);
            } else if (tabIndex == usrTabIndex) {
                displayUsersTab(wrapper);
            } else if (tabIndex == confTabIndex) {
                displayConfTab(wrapper);
            } else if (tabIndex == downTabIndex) {
                displayDownloadsTab(wrapper);
            } else if (tabIndex == storeTabIndex) {
                displayStoreTab(wrapper);
            } else {
                displayErrorPage("Invalid tab!");
            }
        }

        public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) {
            return true; /* here we could do checking for clicks on disabled tabs */
        }
    });

    RootPanel.get().clear();
    RootPanel.get().add(top_bar);
    RootPanel.get().add(allTabs);
    RootPanel.get().add(messageBox);
    RootPanel.get().add(wrapper);
    allTabs.selectTab(currentTabIndex);
}

From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

private void addTextlessLogoAndHeading(HorizontalPanel name_panel) {
    Label welcome = new Label(cloud_name);
    if (textless_logo != null) {
        name_panel.add(textless_logo);//w  ww  .ja  v a 2 s .  com
    }
    name_panel.add(welcome);
    name_panel.setCellVerticalAlignment(welcome, HorizontalPanel.ALIGN_MIDDLE);
}

From source file:edu.washington.cs.oneswarm.ui.gwt.client.newui.friends.AddFriendDialog.java

License:Open Source License

public AddFriendDialog(FriendListPanel parent) {
    this.parent = parent;
    this.setText("Add friend using public key");

    Label selectLabel = new Label("Enter your friend's nickname and public key into the fields below.");
    selectLabel.addStyleName(CSS_DIALOG_HEADER);
    selectLabel.setWidth(WIDTH + "px");
    mainPanel.add(selectLabel);//from w w  w.ja va2s.  c  om

    // nickname
    HorizontalPanel nickPanel = new HorizontalPanel();
    nickPanel.setWidth("100%");
    Label nickLabel = new Label("Nickname: ");
    nickPanel.add(nickLabel);
    nickPanel.add(nickBox);
    nickPanel.setSpacing(3);
    nickBox.setWidth("300px");
    nickPanel.setCellHorizontalAlignment(nickBox, HorizontalPanel.ALIGN_RIGHT);
    nickPanel.setCellVerticalAlignment(nickLabel, VerticalPanel.ALIGN_MIDDLE);
    mainPanel.add(nickPanel);

    // public key
    publicKeyArea.setVisibleLines(7);
    publicKeyArea.setWidth(WIDTH - 20 + "px");
    publicKeyArea.addChangeHandler(this);
    publicKeyArea.addKeyUpHandler(this);
    mainPanel.add(publicKeyArea);
    mainPanel.setCellHorizontalAlignment(publicKeyArea, HorizontalPanel.ALIGN_CENTER);

    // confirm
    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(5);
    lengthLabel = new Label("0 / 216");
    // buttonPanel.add(lengthLabel); // skip this for now
    buttonPanel.setCellHorizontalAlignment(lengthLabel, HorizontalPanel.ALIGN_LEFT);
    buttonPanel.setCellVerticalAlignment(lengthLabel, HorizontalPanel.ALIGN_MIDDLE);
    buttonPanel.setWidth("100%");

    // okButton.setEnabled(false);

    HorizontalPanel rhs = new HorizontalPanel();
    rhs.add(okButton);
    okButton.addClickHandler(this);
    rhs.add(cancelButton);
    cancelButton.addClickHandler(this);
    rhs.setSpacing(3);
    buttonPanel.add(rhs);
    buttonPanel.setCellHorizontalAlignment(rhs, HorizontalPanel.ALIGN_RIGHT);

    mainPanel.add(buttonPanel);
    mainPanel.setCellHorizontalAlignment(buttonPanel, VerticalPanel.ALIGN_RIGHT);
    mainPanel.setWidth(WIDTH + "px");
    setWidget(mainPanel);
}

From source file:eml.studio.client.ui.panel.PreviewPopupPanel.java

License:Open Source License

/**
 * Initialize/*from   w  ww  .j av  a 2 s .  c  om*/
 * 
 * @param path  Result root address
 */
protected void init(String path) {
    this.setSize("650px", "400px");
    this.setGlassEnabled(true);
    this.setModal(true);
    closeButton.setSize("10px", "10px");
    closeButton.setStyleName("closebtn");
    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            PreviewPopupPanel.this.hide();
        }
    });
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.add(closeButton);
    verticalPanel.setCellHeight(closeButton, "13px");
    verticalPanel.setStyleName("vpanel");
    desc.setStyleName("popupTitle");
    verticalPanel.add(desc);
    verticalPanel.setCellHeight(desc, "30px");

    HorizontalPanel hPanel = new HorizontalPanel();
    savebtn.setStyleName("popupsavebtn");
    savebtn.setVisible(false);
    refreshBtn.setStyleName("popuprefreshbtn");
    refreshBtn.setVisible(false);
    uploadSubmitButton.setVisible(false);
    hPanel.add(uploadSubmitButton);
    hPanel.add(savebtn);
    hPanel.add(refreshBtn);
    hPanel.setCellVerticalAlignment(uploadSubmitButton, HasVerticalAlignment.ALIGN_BOTTOM);

    tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);
    tabPanel.setSize("650px", "355px");
    dirPanel = new HorizontalPanel();
    resultDirTree = PopupRetDirTreeLoad.load(path);
    resultDirTree.getRoot().setState(false);
    ScrollPanel dirScrollPanel = new ScrollPanel();
    dirScrollPanel.add(resultDirTree);
    dirScrollPanel.setAlwaysShowScrollBars(true);
    dirScrollPanel.setSize("300px", "320px");

    VerticalPanel fileViewPanel = new VerticalPanel();
    fileLabel.setText("Please select a file to view!");
    fileLabel.setStyleName("popupFileSelectName");
    fileViewPanel.add(fileLabel);
    fileTextArea.setStyleName("popupMsg");
    fileTextArea.setSize("342px", "298px");
    fileTextArea.getElement().setAttribute("wrap", "off");
    fileTextArea.setReadOnly(true);
    fileViewPanel.add(fileTextArea);
    dirPanel.add(dirScrollPanel);
    dirPanel.add(fileViewPanel);
    tabPanel.add(dirPanel, "Results directory");

    AbsolutePanel bottomPanel = new AbsolutePanel();
    bottomPanel.setSize("650px", "360px");
    bottomPanel.add(tabPanel, 0, 0);
    bottomPanel.add(hPanel, 460, 3);

    fileSizeLabel.setStyleName("popupFileSelectName");
    verticalPanel.add(bottomPanel);
    verticalPanel.add(fileSizeLabel);
    this.add(verticalPanel);
    this.setStyleName("loading_container");
}

From source file:fr.aliasource.webmail.client.AdvancedSearchForms.java

License:GNU General Public License

private VerticalPanel createForm() {

    FlexTable ft = new FlexTable();
    content = new VerticalPanel();

    fromQuery = new TextBox();
    fromQuery.addKeyPressHandler(addTextBoxKeyboardListener());

    toQuery = new TextBox();
    toQuery.addKeyPressHandler(addTextBoxKeyboardListener());

    subjectQuery = new TextBox();
    subjectQuery.addKeyPressHandler(addTextBoxKeyboardListener());

    folderQuery = new ListBox();

    hasWordsQuery = new TextBox();
    hasWordsQuery.addKeyPressHandler(addTextBoxKeyboardListener());

    doNotHaveQuery = new TextBox();
    doNotHaveQuery.addKeyPressHandler(addTextBoxKeyboardListener());

    attachements = new CheckBox();
    attachements.setText(I18N.strings.hasAttachments());

    dateWithinQuery = new ListBox();
    String[] dateWithinLabel = { ONE_DAY, THREE_DAYS, ONE_WEEK, TWO_WEEKS, ONE_MONTH, TWO_MONTHS, SIX_MONTHS,
            ONE_YEAR };//from  www . java2  s .  c o m
    for (String d : dateWithinLabel) {
        dateWithinQuery.addItem(d);
    }
    dateOfQuery = new TextBox();
    dateOfQuery.addKeyPressHandler(addTextBoxKeyboardListener());

    HorizontalPanel hpDate = new HorizontalPanel();
    hpDate.add(dateWithinQuery);

    Label of = new Label(" " + I18N.strings.of() + " ");
    hpDate.add(of);

    hpDate.setCellVerticalAlignment(of, HorizontalPanel.ALIGN_MIDDLE);
    hpDate.add(dateOfQuery);

    Label dateLegend = new Label(I18N.strings.dateLegend());
    dateLegend.setStyleName("advancedSearchFormLegend");

    ft.setWidget(0, 0, new Label(I18N.strings.from() + ":"));
    ft.setWidget(0, 1, fromQuery);

    ft.setWidget(1, 0, new Label(I18N.strings.to() + ":"));
    ft.setWidget(1, 1, toQuery);

    ft.setWidget(2, 0, new Label(I18N.strings.subject() + ":"));
    ft.setWidget(2, 1, subjectQuery);

    ft.setWidget(3, 0, new Label(I18N.strings.search() + ":"));
    ft.setWidget(3, 1, folderQuery);

    ft.setWidget(0, 2, new Label(I18N.strings.hasTheWords() + ":"));
    ft.setWidget(0, 3, hasWordsQuery);

    ft.setWidget(1, 2, new Label(I18N.strings.doNotHave() + ":"));
    ft.setWidget(1, 3, doNotHaveQuery);

    ft.setWidget(2, 3, attachements);

    ft.setWidget(3, 2, new Label(I18N.strings.dateWithin() + ":"));
    ft.setWidget(3, 3, hpDate);
    ft.setWidget(4, 3, dateLegend);

    content.setStyleName("advancedSearchForm");
    content.setWidth("100%");
    content.add(ft);
    content.add(createButtons());

    return content;
}

From source file:fr.aliasource.webmail.client.composer.MailComposer.java

License:GNU General Public License

public MailComposer(View ui) {
    this.ui = ui;
    setWidth("100%");
    northActions = new ComposerActions(ui, this);
    add(northActions, DockPanel.NORTH);/*from ww w .j a  v a 2  s.  c  om*/
    setCellHorizontalAlignment(northActions, DockPanel.ALIGN_LEFT);

    enveloppe = new VerticalPanel();
    enveloppeActions = new HorizontalPanel();
    to = new RecipientsPanel(ui, I18N.strings.to() + ": ");
    cc = new RecipientsPanel(ui, I18N.strings.cc() + ": ");
    bcc = new RecipientsPanel(ui, I18N.strings.bcc() + ": ");
    subject = new SubjectField(ui);

    if (WebmailController.get().getSetting("identities/nb_identities") != null) {
        if (identities == null && WebmailController.get().hasIdentities()) {
            identities = new IdentitiesPanel();
            enveloppe.add(identities);
        }
    }

    attach = new AttachmentsPanel();
    // crp = new CannedResponsePanel(ui, this);

    enveloppe.add(to);
    enveloppe.add(cc);
    cc.setVisible(false);
    enveloppe.add(bcc);
    bcc.setVisible(false);
    enveloppe.add(enveloppeActions);
    enveloppe.add(subject);

    // enveloppe.add(crp);
    enveloppe.add(attach);

    HorizontalPanel sendParams = new HorizontalPanel();
    sendParams.add(new Label());
    highPriority = new CheckBox(I18N.strings.importantMessage());
    sendParams.add(highPriority);
    askForDispositionNotification = new CheckBox(I18N.strings.askForDispositionNotification());
    sendParams.add(askForDispositionNotification);
    enveloppe.add(sendParams);
    sendParams.setCellVerticalAlignment(highPriority, HasVerticalAlignment.ALIGN_MIDDLE);
    highPriority.setStyleName("enveloppeField");

    enveloppe.setStyleName("enveloppe");

    createEnveloppeActions();

    add(enveloppe, DockPanel.NORTH);

    VerticalPanel vp = createBodyEditor(ui);
    add(vp, DockPanel.CENTER);

    southActions = new ComposerActions(ui, this);
    add(southActions, DockPanel.SOUTH);
    setCellHorizontalAlignment(southActions, DockPanel.ALIGN_LEFT);

    attach.registerUploadListener(northActions);
    attach.registerUploadListener(southActions);

    addTabPanelListener();
    focusTo();
    setTimerStarted(false);
    setEnableSaveButtons(false);
    addWindowResizeHandler();
}

From source file:fr.aliasource.webmail.client.conversations.ConversationListActionsPanel.java

License:GNU General Public License

private void initConvToolbar(DockPanel convToolbar, final ConversationListPanel clp) {

    DockPanel leftActions = new DockPanel();

    actions = new HorizontalPanel();
    delete = new Button(I18N.strings.delete());
    delete.addStyleName("deleteButton");
    delete.setEnabled(false);//from   www  .  j  a v  a  2 s .c o  m
    actions.add(delete);
    actions.setCellVerticalAlignment(delete, HorizontalPanel.ALIGN_MIDDLE);
    delete.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent ev) {
            clp.deleteConversation();
        }
    });

    // FIXME: merge reportSpam and notSpam in spamActions
    reportSpam = new Button(I18N.strings.markAsSpam());
    reportSpam.addStyleName("noWrap");
    reportSpam.setEnabled(false);
    actions.add(reportSpam);
    actions.setCellVerticalAlignment(reportSpam, HorizontalPanel.ALIGN_MIDDLE);
    reportSpam.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.moveConversation(WebmailController.get().getSelector().getCurrent(),
                    new Folder(WebmailController.get().getSetting(GetSettings.SPAM_FOLDER)), true, null);
        }
    });

    notSpam = new Button(I18N.strings.notSpam());
    notSpam.addStyleName("noWrap");
    notSpam.setEnabled(false);
    notSpam.setVisible(false);

    actions.add(notSpam);
    actions.setCellVerticalAlignment(notSpam, HorizontalPanel.ALIGN_MIDDLE);

    notSpam.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.moveConversation(WebmailController.get().getSelector().getCurrent(), new Folder("INBOX"), true,
                    null);
        }
    });

    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(0);
    moveToButton = new MoveConversationsMenu(I18N.strings.moveTo(), clp, true, position);
    hp.add(moveToButton);
    copyToButton = new MoveConversationsMenu(I18N.strings.copyTo(), clp, false, position);
    hp.add(copyToButton);

    actions.add(hp);
    actions.setCellVerticalAlignment(hp, HasVerticalAlignment.ALIGN_MIDDLE);

    moreActions = new MoreActionMenu(I18N.strings.moreActions(), clp, position);
    actions.add(moreActions);
    actions.setCellVerticalAlignment(moreActions, HorizontalPanel.ALIGN_MIDDLE);

    actions.setSpacing(3);

    actions.addStyleName("actionBox");

    leftActions.add(actions, DockPanel.NORTH);

    HorizontalPanel selection = new HorizontalPanel();
    selection.addStyleName("panelActions");
    selection.add(new Label(I18N.strings.select() + ": "));

    createSelectors(clp, selection);
    selection.addStyleName("selectionBox");
    leftActions.add(selection, DockPanel.SOUTH);

    convToolbar.add(leftActions, DockPanel.WEST);

    newest = new Button(" " + I18N.strings.newest());
    newest.addStyleName("noWrap");
    newest.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.showPage(1);
        }
    });
    newer = new Button(" " + I18N.strings.newer());
    newer.addStyleName("noWrap");
    newer.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.showPage(clp.getCurrentPage() - 1);
        }
    });

    countLabel = new Label();
    countLabel.addStyleName("noWrap");
    older = new Button(I18N.strings.older() + " ");
    older.addStyleName("noWrap");
    older.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.showPage(clp.getCurrentPage() + 1);
        }
    });

    oldest = new Button(I18N.strings.oldest() + " ");
    oldest.addStyleName("noWrap");
    oldest.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.showPage(clp.getLastPage());
        }
    });

    VerticalPanel rightVrt = new VerticalPanel();

    HorizontalPanel right = new HorizontalPanel();
    right.add(newest);
    right.add(newer);
    right.add(countLabel);
    right.setCellVerticalAlignment(countLabel, HorizontalPanel.ALIGN_MIDDLE);
    right.add(older);
    right.add(oldest);
    right.setSpacing(3);

    rightVrt.add(right);
    convFolderQuota = new ConversationFolderQuota(this.ui);
    rightVrt.add(convFolderQuota);
    rightVrt.setHorizontalAlignment(ALIGN_RIGHT);
    rightVrt.setCellHorizontalAlignment(convFolderQuota, VerticalPanel.ALIGN_RIGHT);

    right.setCellVerticalAlignment(right, VerticalPanel.ALIGN_MIDDLE);

    convToolbar.add(rightVrt, DockPanel.EAST);
    convToolbar.setCellHorizontalAlignment(rightVrt, DockPanel.ALIGN_RIGHT);

    newest.setVisible(false);
    newer.setVisible(false);
    older.setVisible(false);
    oldest.setVisible(false);
}

From source file:fr.aliasource.webmail.client.filter.CreateAFilterForm.java

License:GNU General Public License

private Widget createChooseActionsButtons(final View ui) {
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(3);/*from   w ww.  j  ava2  s. co m*/

    Anchor showFilter = new Anchor(I18N.strings.showCurrentFilters());
    showFilter.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            WebmailController.get().getView().showFilterSettings();
        }
    });
    hp.add(showFilter);

    Button cancelButton = new Button(I18N.strings.cancel());
    cancelButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            cancelFilterCreation(ui);
        }
    });

    hp.add(cancelButton);

    Button back = new Button(" " + I18N.strings.filterBack());
    back.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            content.clear();
            createSearchCriteriaForm(ui);
        }
    });
    hp.add(back);

    Button createFilter = new Button(I18N.strings.createFilter());
    hp.add(createFilter);
    createFilter.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            FilterDefinition fd = getDefinition();
            ui.getSpinner().startSpinning();
            AjaxCall.filters.storeFilter(fd, new AsyncCallback<Void>() {
                public void onSuccess(Void result) {
                    ui.getSpinner().stopSpinning();
                    cancelFilterCreation(ui);
                    ui.notifyUser(I18N.strings.filterAddSuccess());
                }

                public void onFailure(Throwable caught) {
                    GWT.log("error creating filter", caught);
                    ui.getSpinner().stopSpinning();
                }
            });
        }
    });

    applyToMailbox = new CheckBox(I18N.strings.filterAlsoApplyNow());
    applyToMailbox.setEnabled(false); // TODO
    hp.add(applyToMailbox);

    for (int i = 0; i < hp.getWidgetCount(); i++) {
        hp.setCellVerticalAlignment(hp.getWidget(i), HorizontalPanel.ALIGN_MIDDLE);
    }

    return hp;
}

From source file:fr.aliasource.webmail.client.Heading.java

License:GNU General Public License

public Heading(final View ui) {
    this.ui = ui;

    Image logo = new Image("minig/images/logo_minig.png");
    logo.setStyleName("obmLogo");
    add(logo, DockPanel.WEST);/*from   www  .j a  v  a  2s  .  c  o m*/

    final String extUrl = WebmailController.get().getSetting("obm/external_url");
    if (extUrl != null) {
        logo.addStyleName("addressBookItem"); // cursor:pointer...
        logo.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent arg0) {
                Window.Location.assign(extUrl);
            }
        });
    }

    // add heading with obm links
    if (Features.OBM_SECTIONS) {
        OBMLinks ol = new OBMLinks();
        add(ol, DockPanel.CENTER);
        setCellVerticalAlignment(ol, HasVerticalAlignment.ALIGN_MIDDLE);
    }

    HorizontalPanel links = new HorizontalPanel();
    links.addStyleName("headingStdLinks");
    add(links, DockPanel.EAST);
    links.setSpacing(4);
    setCellHorizontalAlignment(links, DockPanel.ALIGN_RIGHT);
    setWidth("100%");

    spinner = new Image("minig/images/spinner_moz.gif");
    links.add(spinner);
    links.setCellVerticalAlignment(spinner, DockPanel.ALIGN_MIDDLE);
    spinner.setVisible(false);

    if (RootPanel.get("mainPanel") != null) {
        return;
    }

    String userLbl = ui.getUserName();
    if (userLbl.contains("@")) {
        userLbl = userLbl.replace("@", " (") + ")";
    }

    Label user = new Label(userLbl);
    user.addStyleName("userNameLabel");
    links.add(user);

    settings = new Anchor(I18N.strings.settings());
    settings.addStyleName("settingsLabel");
    links.add(settings);

    logout = new Anchor(I18N.strings.signOut());
    logout.addStyleName("logoutLabel");
    links.add(logout);

    setStyleName("heading");

    logout.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {
            ui.log("logging out...");
            logout();
        }
    });

    settings.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            ui.log("Show settings");
            ui.showGlobalSettings();
        }
    });

}

From source file:fr.aliasource.webmail.client.SearchBox.java

License:GNU General Public License

public SearchBox(View ui) {
    this.ui = ui;
    searchMailQuery = new TextBox();
    searchMailQuery.setWidth("15em");
    HorizontalPanel hp = new HorizontalPanel();
    searchMailButton = new Button(I18N.strings.searchMail());
    searchMailButton.addStyleName("searchButton");
    hp.add(searchMailButton);/*www . j av  a 2  s . c o  m*/
    hp.add(new HTML("&nbsp;"));

    VerticalPanel vp = new VerticalPanel();

    Anchor sal = createShowAdvancedLink();
    vp.add(sal);

    if (Features.FILTERS) {
        sal = createCreateAFilterLink();
        vp.add(sal);
    }

    hp.add(vp);
    hp.setCellVerticalAlignment(vp, HorizontalPanel.ALIGN_MIDDLE);

    add(searchMailQuery);
    add(hp);

    initSearchAction();
    addStyleName("searchBox");

    searchMailQuery.addKeyPressHandler(new KeyPressHandler() {
        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getCharCode() == KeyCodes.KEY_ENTER) {
                doSearch();
            }
        }
    });

    WebmailController.get().getSelector().addListener(this);
}