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:fr.aliasource.webmail.client.addressbook.AddressBook.java

License:Open Source License

public AddressBook(View wm) {
    this.webmail = wm;

    int height = Window.getClientHeight() - 150;
    HorizontalPanel search = new HorizontalPanel();
    search.addStyleName("wrap");
    search.addStyleName("addressBookSearchField");
    search.setWidth("16em");

    upSpinner = new Image("minig/images/spinner_moz.gif");
    upSpinner.setVisible(false);/*from  w w w. j a v  a2s  .c  o m*/

    searchField = new TextBox();
    searchField.setText(I18N.strings.searchContactField());
    searchField.setWidth("16em");
    searchField.addFocusHandler(new FocusHandler() {
        public void onFocus(FocusEvent sender) {
            if (searchField.getText().equals(I18N.strings.searchContactField())) {
                searchField.setText("");
            }
        }
    });

    searchField.addBlurHandler(new BlurHandler() {
        public void onBlur(BlurEvent be) {
            if (searchField.getText().isEmpty()) {
                searchField.setText(I18N.strings.searchContactField());
            }
        }
    });

    searchField.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent ev) {
            if (KeyCodes.KEY_ESCAPE == ev.getNativeKeyCode()) {
                searchField.setText("");
            } else {
                if (!searchField.getText().isEmpty()) {
                    searchResult();
                } else {
                    reset();
                }
            }
        }
    });

    search.add(searchField);
    search.add(upSpinner);
    Anchor refresh = new Anchor(I18N.strings.refresh());
    refresh.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            webmail.getSpinner().startSpinning();
            new Timer() {
                @Override
                public void run() {
                    webmail.getSpinner().stopSpinning();
                }
            }.schedule(500);
        }
    });
    HorizontalPanel toolbar = new HorizontalPanel();
    toolbar.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    toolbar.add(search);
    toolbar.add(new HTML(" "));
    toolbar.add(refresh);

    add(toolbar, DockPanel.NORTH);

    setWidth("100%");

    ScrollPanel sp;

    HorizontalPanel hp = new HorizontalPanel();
    groupsList = new ContactGroups(webmail);
    sp = new ScrollPanel(groupsList);
    sp.addStyleName("whiteBackground");
    sp.setWidth("16em");
    sp.setHeight(height + "px");
    hp.add(sp);

    contactList = new ContactList(webmail);
    groupsList.addGroupSelectionListener(contactList);
    sp = new ScrollPanel(contactList);
    sp.addStyleName("whiteBackground");
    sp.setWidth("16em");
    sp.setHeight(height + "px");
    hp.add(sp);

    display = new ContactDisplay(webmail);
    contactList.addContactSelectionListerner(display);
    sp = new ScrollPanel(display);
    sp.addStyleName("contactDisplay");
    sp.setHeight(height + "px");
    hp.add(sp);

    hp.setWidth("100%");
    hp.setCellWidth(sp, "100%");

    hp.setSpacing(1);
    hp.setStyleName("addressBook");
    add(hp, DockPanel.CENTER);
    addTabListener();

    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            resize(event.getHeight());
        }
    });
}

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

License:GNU General Public License

private HorizontalPanel createButtons() {
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(3);

    searchButton = new Button(I18N.strings.searchMail());
    searchButton.addStyleName("searchButton");
    searchButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            doSearch();//w ww .j  ava 2s  . com
        }
    });
    cancelButton = new Button(I18N.strings.cancel());
    cancelButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            hideOptions();
        }
    });

    hp.add(searchButton);
    hp.add(cancelButton);

    return hp;
}

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

License:GNU General Public License

private void createEnveloppeActions() {
    Label l = new Label("");
    enveloppeActions.add(l);/*from ww  w  . j av  a  2s.  c  o m*/
    HorizontalPanel hp = new HorizontalPanel();
    hp.addStyleName("panelActions");

    addCcLink = new Anchor(I18N.strings.addCc());
    addCcLink.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            cc.setVisible(true);
            addCcLink.setVisible(false);
        }
    });
    hp.add(addCcLink);
    addBccLink = new Anchor(I18N.strings.addBcc());
    addBccLink.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            bcc.setVisible(true);
            addBccLink.setVisible(false);
        }
    });
    hp.add(addBccLink);
    editSubjectLink = new Anchor(I18N.strings.editSubject());
    editSubjectLink.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            subject.setVisible(true);
            editSubjectLink.setVisible(false);
        }
    });
    hp.add(editSubjectLink);
    hp.setSpacing(2);

    enveloppeActions.add(hp);
}

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

License:GNU General Public License

private void notifyUndoDiscard(boolean switchTab, final ClientMessage cm) {
    final HorizontalPanel notif = new HorizontalPanel();
    stopAutoSaveDraftTimer();//  w w w.jav a2s .  c om
    notif.setSpacing(2);
    notif.add(new Label(I18N.strings.messageDiscarded()));
    Anchor undo = new Anchor(I18N.strings.undoDiscard());
    undo.addClickHandler(undoDiscardListener(cm, notif, switchTab));
    notif.add(undo);
    ui.notifyUser(notif, 15);
}

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);//ww w .j av  a  2 s .  c  om
    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.conversations.ConversationListActionsPanel.java

License:GNU General Public License

private void createSelectors(final ConversationListPanel clp, HorizontalPanel selection) {
    Anchor all = new Anchor(I18N.strings.all());
    all.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.selectAll();// w  w  w .j a v a2  s  .  c om
        }
    });
    selection.add(all);

    Anchor read = new Anchor(I18N.strings.read());
    read.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.selectRead();
        }
    });
    selection.add(read);

    Anchor unread = new Anchor(I18N.strings.unread());
    unread.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.selectUnread();
        }
    });
    selection.add(unread);

    Anchor none = new Anchor(I18N.strings.none());
    none.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            clp.selectNone();
        }
    });
    selection.add(none);

    selection.setSpacing(3);
}

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

License:GNU General Public License

private Widget createSearchCriteriaButtons(final View ui) {
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(3);

    Button cancelButton = new Button(I18N.strings.cancel());
    cancelButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            cancelFilterCreation(ui);/*from  w w  w. ja va  2  s.c om*/
        }
    });

    hp.add(cancelButton);

    Button testSearch = new Button(I18N.strings.filterTestSearch());
    testSearch.addClickHandler(new TestFilterHandler(this));
    hp.add(testSearch);

    Button nextStep = new Button(I18N.strings.filterNextStep() + " ");
    nextStep.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            if (!getDefinition().getCriteria().isEmpty()) {
                for (String s : getDefinition().getCriteria().keySet()) {
                    GWT.log("filter criteria '" + s + "': '" + getDefinition().getCriteria().get(s) + "'",
                            null);
                }
                content.clear();
                createChooseActionForm(ui);
            }
        }
    });
    hp.add(nextStep);
    return hp;
}

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);

    Anchor showFilter = new Anchor(I18N.strings.showCurrentFilters());
    showFilter.addClickHandler(new ClickHandler() {
        @Override//from   w  w  w .  j  ava2 s. c  o  m
        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);// w ww .j a va 2 s. com

    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.reader.MessageWidget.java

License:GNU General Public License

private void createQuickReply(VerticalPanel dp, boolean textArea) {
    DockPanel replyZone = new DockPanel();
    ReplyLinkListener rll = new ReplyLinkListener(this, replyZone, dp);

    HorizontalPanel actions = new HorizontalPanel();
    Anchor reply = new Anchor(I18N.strings.reply());
    reply.addStyleName("replyLink");
    reply.addClickHandler(rll);//from w ww  .  j a va 2 s . c o m
    actions.add(reply);
    Anchor replyAll = new Anchor(I18N.strings.replyToAll());
    reply.addStyleName("replyToAllLink");
    replyAll.addClickHandler(new ReplyAllLinkListener(this, replyZone, dp));
    actions.add(replyAll);
    Anchor forward = new Anchor(I18N.strings.forward());
    reply.addStyleName("forwardLink");
    forward.addClickHandler(new ForwardLinkListener(this, replyZone, dp));
    actions.add(forward);
    actions.setSpacing(4);
    replyZone.add(actions, DockPanel.NORTH);

    if (textArea) {
        TextArea ta = new TextArea();
        ta.setWidth("40em");
        ta.setVisibleLines(3);
        ta.addClickHandler(rll);
        replyZone.add(ta, DockPanel.CENTER);
        replyZone.setSpacing(3);
    }
    replyZone.setWidth("100%");
    replyZone.addStyleName("replyZone");
    dp.add(replyZone);

}