Example usage for com.google.gwt.user.client.ui Label Label

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

Introduction

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

Prototype

protected Label(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:cc.kune.gspace.client.tags.TagsSummaryPanel.java

License:GNU Affero Public License

/**
 * Instantiates a new tags summary panel.
 * // w ww.  j  ava 2  s. c o m
 * @param i18n
 *          the i18n
 * @param ws
 *          the ws
 */
@Inject
public TagsSummaryPanel(final I18nTranslationService i18n, final GSpaceArmor ws) {
    this.i18n = i18n;
    mainPanel = new FlowPanel();
    flowPanel = new FlowPanel();
    flowPanel.setWidth("100%");
    final Label header = new Label(i18n.t("Tags"));
    header.setTitle(i18n.t("Keywords or terms associated with this group"));
    // super.setBorderStylePrimaryName("k-dropdownouter-tags");
    flowPanel.addStyleName("kune-Margin-Small-trbl");
    flowPanel.addStyleName("k-tsp-cloud");
    header.addStyleName("k-sn-maintitle");
    mainPanel.addStyleName("k-sn-mainpanel");
    mainPanel.add(header);
    mainPanel.add(flowPanel);
    // ws.getEntityToolsSouth().add(mainPanel);
}

From source file:cc.kune.gspace.client.tags.TagsSummaryPanel.java

License:GNU Affero Public License

@Override
public void addTag(final String name, final Long count, final String style, final ClickHandler clickHandler) {
    final Label label = new Label(name);
    // i18n pluralization
    if (count > 1) {
        label.setTitle(i18n.t("There are [%d] items with this tag", count));
    } else {//  w  ww  .j av  a  2s . c  o m
        label.setTitle(i18n.t("There are [%d] item with this tag", count));
    }
    label.addClickHandler(clickHandler);
    label.addStyleName("k-tsp-tag");
    label.addStyleName(style);
    flowPanel.add(label);
}

From source file:cc.kune.polymer.client.actions.ui.PoToolbarSeparatorGui.java

License:GNU Affero Public License

@Override
public AbstractGuiItem create(final GuiActionDescrip descriptor) {
    super.descriptor = descriptor;
    final PoToolbarGui toolbar = ((PoToolbarGui) descriptor.getParent().getValue(ParentWidget.PARENT_UI));
    if (toolbar == null) {
        throw new UIException(
                "To add a toolbar separator you need to add the toolbar before. Item: " + descriptor);
    }// www  .java  2  s . c o  m
    final Type type = ((ToolbarSeparatorDescriptor) descriptor).getSeparatorType();

    switch (type) {
    case fill:
        widget = new HTMLPanel("");
        widget.getElement().setAttribute("flex", "");
        break;
    case spacer:
        widget = new Label(" ");
    case separator:
        // We'll not use | separator in polymer gui
        widget = new Label("");
        break;
    default:
        break;
    }
    toolbar.add(widget);
    widget.addStyleName("k-toolbar-separator");
    configureItemFromProperties();
    return this;
}

From source file:cc.kune.wave.client.kspecific.WebClientMock.java

License:GNU Affero Public License

/**
 * Instantiates a new web client mock.
 */
public WebClientMock() {
    initWidget(new Label(MOCK_MSG));
}

From source file:ch.amaba.client.ui.LoginPageView.java

License:Open Source License

@Override
public void setError(List<String> messages) {
    errorPanel.clear();/*from w  ww. j a  va  2s  .co m*/
    for (final String message : messages) {
        final Label l = new Label(message);
        DOM.setElementAttribute(l.getElement(), "id", "my-button-id");
        errorPanel.add(l);
    }
}

From source file:ch.heftix.mailxel.client.MailDetailGrid.java

License:Open Source License

private void initWidgets() {

    clear();//from  ww w  .j  a  v a  2 s  . c o m

    // bodyPanel = new TabPanel();
    grid = new FlexTable();
    categoryHistory = new FlexTable();
    attachementBar = new AttachmentBar(mailxelService);
    bodyArea = new OrgTextArea();
    bodyArea.setCharacterWidth(80);
    bodyArea.setVisibleLines(25);
    bodyArea.setReadOnly(true);

    HorizontalPanel toolbar = new HorizontalPanel();

    toolbar.add(fwd);
    toolbar.add(replyAll);
    toolbar.add(reply);
    toolbar.add(new Label(" "));
    toolbar.add(categorizationToolbar);
    toolbar.add(new Label(" "));

    add(toolbar);
    add(grid);

    contentTabPanel = new OnDemandTabPanel();
    contentTabPanel.add(bodyArea, "mail");
    add(contentTabPanel);

    add(categoryHistory);

}

From source file:ch.heftix.mailxel.client.MailxelMainToolBar.java

License:Open Source License

public MailxelMainToolBar(final MailServiceAsync mailxelService, final MailxelPanel mailxelPanel) {

    this.mailxelService = mailxelService;
    this.mailxelPanel = mailxelPanel;

    logo = new Image("img/mailxel.png");
    logo.setTitle("MailXel " + Version.getVersion());
    logo.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {
            PopupPanel pp = new PopupPanel(true);
            DisclosurePanel dp = new DisclosurePanel("MailXel " + Version.getVersion());
            dp.setWidth("400px");
            dp.setOpen(true);//from   w  w w  . j av a  2 s .  co  m

            HTML html = new HTML();
            StringBuffer sb = new StringBuffer();
            sb.append("(c) 2008-2010 by Simon Hefti. All rights reserved.<br/>");
            sb.append(
                    "<p>mailxel is licensed under the <a href=\"http://www.eclipse.org/legal/epl-v10.html\">EPL 1.0</a>. mailxel is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.");
            sb.append("<p>mailxel relies on the following components:");
            sb.append("<ul>");
            sb.append(
                    "<li>GWT, <a href=\"http://code.google.com/webtoolkit\">http://code.google.com/webtoolkit</a></li>");
            sb.append(
                    "<li>sqlite-jdbc, <a href=\"http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC\">http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC</a></li>");
            sb.append(
                    "<li>(and thus on sqlite itself, <a href=\"http://www.sqlite.org\">http://www.sqlite.org</a>)</li>");
            sb.append(
                    "<li>Java Mail API, <a href=\"http://java.sun.com/products/javamail\">http://java.sun.com/products/javamail</a></li>");
            sb.append(
                    "<li>jetty servlet container, <a href=\"http://www.eclipse.org/jetty/\">http://www.eclipse.org/jetty/</a></li>");
            sb.append(
                    "<li>fugue-icons, <a href=\"http://code.google.com/p/fugue-icons-src/\">http://code.google.com/p/fugue-icons-src/</a></li>");
            sb.append("<li>jsoup, <a href=\"http://jsoup.org\">http://jsoup.org</a></li>");
            sb.append("</ul>");
            html.setHTML(sb.toString());
            dp.add(html);
            dp.setOpen(true);

            pp.add(dp);
            pp.show();
        }
    });

    Image home = new Image("img/find.png");
    home.setTitle("Search");
    home.setStylePrimaryName("mailxel-toolbar-item");
    home.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {

            Panel panel = new MailOverviewGrid(mailxelService, mailxelPanel);
            mailxelPanel.addTab(panel, "Search");
        }
    });

    final Image query = new Image("img/document-task.png");
    query.setTitle("Search (predefined query)");
    query.setStylePrimaryName("mailxel-toolbar-item");
    query.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {

            final StatusItem si = mailxelPanel.statusStart("retrieve stored message queries");

            mailxelService.searchQueries(MessageQueryTO.T_MESSAGE_QUERY, null,
                    new AsyncCallback<List<MessageQueryTO>>() {

                        public void onFailure(Throwable caught) {
                            si.error(caught);
                        }

                        public void onSuccess(List<MessageQueryTO> result) {
                            si.done();
                            if (null != result && result.size() > 0) {
                                PopupMenu popupMenu = new PopupMenu(query);
                                for (MessageQueryTO mqTO : result) {
                                    String name = mqTO.shortname + " (" + UIUtil.shorten(mqTO.name) + ")";
                                    MenuItem menuItem = new MenuItem(name, new MessageQueryCommand(
                                            mailxelService, mailxelPanel, popupMenu, mqTO));
                                    String url = DirectMailServiceUtil.getIconURL(mqTO.iconId);
                                    if (null != url) {
                                        String html = "<img src=\"" + url + "\"/>&nbsp;" + name;
                                        menuItem.setHTML(html);
                                    }
                                    popupMenu.addItem(menuItem);
                                }
                                popupMenu.show();
                            }
                        }
                    });
        }
    });

    Image mailnew = new Image("img/mail-new.png");
    mailnew.setTitle("New Mail");
    mailnew.setStylePrimaryName("mailxel-toolbar-item");
    mailnew.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {
            final MailSendGrid mailSendGrid = new MailSendGrid(mailxelService, mailxelPanel, null,
                    MailSendGrid.TYPE_NEW);
            mailxelPanel.addTab(mailSendGrid, "New Mail");
        }
    });

    Image noteToSelf = new Image("img/note.png");
    noteToSelf.setTitle("Note to myself");
    noteToSelf.setStylePrimaryName("mailxel-toolbar-item");
    noteToSelf.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {
            final MailSendGrid mailSendGrid = new MailSendGrid(mailxelService, mailxelPanel, null,
                    MailSendGrid.TYPE_SELF);
            mailxelPanel.addTab(mailSendGrid, "New Note");
        }
    });

    Image contacts = new Image("img/address-book.png");
    contacts.setTitle("Address Book");
    contacts.setStylePrimaryName("mailxel-toolbar-item");
    contacts.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {
            AddressOverviewGrid ag = new AddressOverviewGrid(mailxelService, mailxelPanel);
            mailxelPanel.addTab(ag, "Contacts");
        }
    });

    /**
     * mail download menu on click, a menu with the available accounts is
     * displayed, allowing the user is asked to choose the data source.
     */
    final Image download = new Image("img/download-mail.png");
    download.setTitle("Mail download");
    download.setStylePrimaryName("mailxel-toolbar-item");
    download.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {

            ConfigTO configTO = mailxelPanel.getConfig();
            String[] accounts = configTO.accountNames;

            if (null != accounts && accounts.length > 0) {

                PopupMenu popupMenu = new PopupMenu(download);
                // first item: allow download from all known accounts
                MenuItem menuItem = new MenuItem("Scan all accounts",
                        new ScanMailFolderCommand(mailxelService, mailxelPanel, popupMenu, accounts));
                popupMenu.addItem(menuItem);

                // add one menu item per account
                for (int i = 0; i < accounts.length; i++) {
                    String[] selectedAccount = new String[1];
                    selectedAccount[0] = accounts[i];
                    menuItem = new MenuItem(accounts[i], new ScanMailFolderCommand(mailxelService, mailxelPanel,
                            popupMenu, selectedAccount));
                    popupMenu.addItem(menuItem);
                }
                popupMenu.show();
            }
        }
    });

    final Image reorgMailFolder = new Image("img/wand.png");
    reorgMailFolder.setTitle("reorganize mail folder");
    reorgMailFolder.setStylePrimaryName("mailxel-toolbar-item");
    reorgMailFolder.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {

            ConfigTO configTO = mailxelPanel.getConfig();
            String[] accounts = configTO.accountNames;

            if (null != accounts && accounts.length > 0) {

                PopupMenu popupMenu = new PopupMenu(reorgMailFolder);
                // first item: allow reorg from all known accounts
                MenuItem menuItem = new MenuItem("All accounts", new ReorgMailFolderCommand(mailxelService,
                        mailxelPanel, popupMenu, reorgMailFolder, accounts));
                popupMenu.addItem(menuItem);

                // add one menu item per account
                for (int i = 0; i < accounts.length; i++) {
                    String[] selectedAccount = new String[1];
                    selectedAccount[0] = accounts[i];
                    menuItem = new MenuItem(accounts[i], new ReorgMailFolderCommand(mailxelService,
                            mailxelPanel, popupMenu, reorgMailFolder, selectedAccount));
                    popupMenu.addItem(menuItem);
                }
                popupMenu.show();
            }
        }
    });

    final Image categories = new Image("img/tags.png");
    categories.setTitle("Manage Categories");
    categories.setStylePrimaryName("mailxel-toolbar-item");
    categories.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {
            CategoryOverviewGrid cog = new CategoryOverviewGrid(mailxelService, mailxelPanel);
            mailxelPanel.addTab(cog, "Categories");
        }
    });

    final Image setup = new Image("img/preferences-system.png");
    setup.setTitle("System Setup");
    setup.setStylePrimaryName("mailxel-toolbar-item");
    setup.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            // ConfigTabPanel cg = new ConfigTabPanel();
            ConfigGrid cg = new ConfigGrid(mailxelService, mailxelPanel);
            mailxelPanel.addTab(cg, "Setup");
        }
    });

    final Image login = new Image("img/lock.png");
    login.setTitle("Login");
    login.setStylePrimaryName("mailxel-toolbar-item");
    login.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {

            // create login box
            LoginPanel loginPanel = new LoginPanel(mailxelService, mailxelPanel);
            int x = login.getAbsoluteLeft();
            int y = login.getAbsoluteTop();
            loginPanel.setPopupPosition(x, y);
            loginPanel.show();
        }
    });

    final Image additional = new Image("img/context-menu.png");
    additional.setTitle("Additional functions");
    additional.setStylePrimaryName("mailxel-toolbar-item");

    final PopupCommand importMboxCommand = new PopupCommand() {

        public void execute() {

            final PopupPanel pup = new PopupPanel(true);
            HorizontalPanel hp = new HorizontalPanel();
            final TextBox tb = new TextBox();
            tb.setWidth("300px");
            hp.add(tb);

            Button b = new Button();
            b.setText("import");
            b.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent sender) {
                    String name = tb.getText();
                    if (null != name) {
                        name = name.trim();
                        if (name.length() > 0) {
                            final StatusItem si = mailxelPanel.statusStart("Import from mbox: " + name);
                            mailxelService.importMboxFile(name, new AsyncCallback<Void>() {

                                public void onFailure(Throwable caught) {
                                    si.error(caught);
                                }

                                public void onSuccess(Void result) {
                                    si.done();
                                }
                            });
                            pup.hide();
                        }
                    }
                }
            });

            hp.add(b);
            pup.add(hp);

            int x = additional.getAbsoluteLeft();
            int y = additional.getAbsoluteTop();
            pup.setPopupPosition(x, y);
            /** show input box for path to mbox file */
            pup.show();
            /** hide the list of available additional commands */
            hide();
        }
    };

    final PopupCommand addressUploadCommand = new PopupCommand() {

        public void execute() {
            AddressUploadGrid ug = new AddressUploadGrid(mailxelService, mailxelPanel);
            mailxelPanel.addTab(ug, "Address Upload");
            /** hide the list of available additional commands */
            hide();
        }
    };

    final Command showWelcomePanelCommand = new Command() {

        public void execute() {
            WelcomeToMailxelPanel wp = new WelcomeToMailxelPanel(mailxelService, mailxelPanel);
            mailxelPanel.addTab(wp, "Welcome");
        }
    };

    final PopupCommand deleteConfigCommand = new PopupCommand() {

        public void execute() {

            PopupPanel pop = new PopupPanel(true, true);
            HorizontalPanel hp = new HorizontalPanel();
            Label label = new Label("Really delete all configuration?");
            hp.add(label);
            Button b = new Button();
            b.setText("Ok");
            b.addClickHandler(new ClickHandler() {

                public void onClick(ClickEvent event) {
                    final StatusItem si = mailxelPanel.statusStart("deleting configuration");
                    mailxelService.deleteConfig(new AsyncCallback<Void>() {

                        public void onFailure(Throwable caught) {
                            si.error(caught);
                        }

                        public void onSuccess(Void result) {
                            si.done();
                        }
                    });
                }
            });
            hp.add(b);
            pop.add(hp);

            int x = additional.getAbsoluteLeft();
            int y = additional.getAbsoluteTop();
            pop.setPopupPosition(x, y);
            pop.show();
            /** hide the list of available additional commands */
            hide();
        }
    };

    final Command updateToMeFlagCommand = new Command() {

        public void execute() {
            final StatusItem si = mailxelPanel.statusStart("Update 'to me' flag");
            mailxelService.updateToMeFlag(new AsyncCallback<Void>() {

                public void onFailure(Throwable caught) {
                    si.error(caught);
                }

                public void onSuccess(Void result) {
                    si.done();
                }
            });
        }
    };

    final Command updateFromMeFlagCommand = new Command() {

        public void execute() {
            final StatusItem si = mailxelPanel.statusStart("Update 'from me' flag");
            mailxelService.updateFromMeFlag(new AsyncCallback<Void>() {

                public void onFailure(Throwable caught) {
                    si.error(caught);
                }

                public void onSuccess(Void result) {
                    si.done();
                }
            });
        }
    };

    final Command showStatisticsCommand = new Command() {

        public void execute() {
            StatisticsGrid sg = new StatisticsGrid(mailxelService, mailxelPanel);
            mailxelPanel.addTab(sg, "Statistics");
        }
    };

    final Command showIconsCommand = new Command() {

        public void execute() {
            IconOverviewGrid og = new IconOverviewGrid(mailxelService, mailxelPanel);
            mailxelPanel.addTab(og, "Icons");
        }
    };

    final Command showMessageQueriesCommand = new Command() {

        public void execute() {
            MessageQueryOverviewGrid mqog = new MessageQueryOverviewGrid(mailxelService, mailxelPanel);
            mailxelPanel.addTab(mqog, "Message Queries");
        }
    };

    final Command showAttachmentGridCommand = new Command() {

        public void execute() {
            AttachmentOverviewGrid aog = new AttachmentOverviewGrid(mailxelService, mailxelPanel);
            mailxelPanel.addTab(aog, "Attachment Overview");
        }
    };

    final Command closeAllTabsCommand = new Command() {

        public void execute() {
            mailxelPanel.closeAllNonEditTabs();
        }
    };

    final Command dbHousekeeping = new Command() {

        public void execute() {
            final StatusItem si = mailxelPanel.statusStart("DB housekeeping");
            mailxelService.housekeeping(new AsyncCallback<String>() {

                public void onFailure(Throwable caught) {
                    si.error(caught);
                }

                public void onSuccess(String result) {
                    if (result.startsWith("200 OK")) {
                        si.done();
                    } else {
                        si.error(result);
                    }
                }
            });
        }
    };

    final Command messageCount = new Command() {

        public void execute() {
            updateCounts();
        }
    };

    additional.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent sender) {

            MenuBar popupMenuBar = new MenuBar(true);
            PopupPanel popupPanel = new PopupPanel(true);

            MenuItem menuItem = new MenuItem("Attachment Overview", showAttachmentGridCommand);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Close all Tabs", closeAllTabsCommand);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Message Queries", showMessageQueriesCommand);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("DB Housekeeping", dbHousekeeping);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("update pending messages count", messageCount);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Statistics", showStatisticsCommand);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Icons", showIconsCommand);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Import mbox file", importMboxCommand);
            importMboxCommand.setPopupPanel(popupPanel);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Address upload", addressUploadCommand);
            addressUploadCommand.setPopupPanel(popupPanel);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Welcome", showWelcomePanelCommand);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Delete existing configuration", deleteConfigCommand);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Update 'from me' flag", updateFromMeFlagCommand);
            popupMenuBar.addItem(menuItem);

            menuItem = new MenuItem("Update 'to me' flag", updateToMeFlagCommand);
            popupMenuBar.addItem(menuItem);

            popupMenuBar.setVisible(true);
            popupPanel.add(popupMenuBar);

            int x = additional.getAbsoluteLeft();
            int y = additional.getAbsoluteTop();

            popupPanel.setPopupPosition(x, y);
            popupPanel.show();
        }
    });

    updateCounts();

    add(home);
    add(query);
    add(mailnew);
    add(noteToSelf);
    add(contacts);
    add(categories);
    add(download);
    add(reorgMailFolder);
    add(setup);
    add(login);
    add(additional);
    add(logo);
    add(msgCountAct);
}

From source file:ch.heftix.mailxel.client.MultiLinePanel.java

License:Open Source License

/**
 * add new widget, create new line if necessary
 * //from   w  ww  . j a v a 2  s. c o m
 * @param widget widget to be added
 * @param length length, in chars, of this widget
 */
public void addWidget(final Widget widget, final int length) {

    if (totalChars > maxLength) {
        // start a new line
        curPanel = new HorizontalPanel();
        add(curPanel);
        totalChars = 0;
    }
    if (null != separator && curPanel.getWidgetCount() > 0) {
        curPanel.add(new Label(separator));
        totalChars += separator.length();
    }
    curPanel.add(widget);
    widgetPanelMap.put(widget, curPanel);
    totalChars += length;
}

From source file:ch.sebastienzurfluh.swissmuseum.core.client.view.pagewidget.PageWidget.java

License:Open Source License

public PageWidget(EventBus pageChangeEventBus, Model model) {
    this.model = model;

    model.currentPageDataObservable.subscribeObserver(this);

    parser = new TextParser(pageChangeEventBus, model);

    title = new HTML("");
    title.setStyleName(primaryStyleName + "-title");
    header = new Label("");
    header.setStyleName(primaryStyleName + "-header");

    //      Image titleImage = new Image("resources/images/fioritures/line.jpg");
    //      titleImage.setStyleName(primaryStyleName + "-title-image");

    content = new FlowPanel();
    content.setStyleName(primaryStyleName + "-content");

    this.add(title);
    this.add(header);
    //      this.add(titleImage);
    this.add(content);

    this.setStyleName(primaryStyleName);
}

From source file:ch.sebastienzurfluh.swissmuseum.core.client.view.pagewidget.ResourceGallery.java

License:Open Source License

public ResourceGallery(String string, String titleString, String descriptionString) {
    FlowPanel popup = new FlowPanel();

    Image imageClone = new Image();
    imageClone.setStyleName("resourceGallery-image");

    setStyleName("resourceGallery");

    imageClone.setUrl(string);//ww  w.j  a  va 2  s  .  c  om

    setGlassEnabled(true);

    popup.add(imageClone);

    Label title = new Label(titleString);
    Label details = new Label(descriptionString);

    title.setStyleName("resourceGallery-image-title");
    details.setStyleName("resourceGallery-image-details");

    popup.add(title);
    popup.add(details);

    add(popup);

    imageClone.addClickHandler(this);
}