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

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

Introduction

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

Prototype

public void setText(String text) 

Source Link

Document

Sets the label's content to the given text.

Usage

From source file:com.vaadin.tests.widgetset.client.grid.GridBasicClientFeaturesWidget.java

License:Apache License

private void createDetailsMenu() {
    String[] menupath = new String[] { "Component", "Row details" };
    addMenuCommand("Set generator", new ScheduledCommand() {
        @Override/* w w  w .j av  a 2  s  .com*/
        public void execute() {
            grid.setDetailsGenerator(new DetailsGenerator() {
                @Override
                public Widget getDetails(int rowIndex) {
                    FlowPanel panel = new FlowPanel();

                    final Label label = new Label("Row: " + rowIndex + ".");
                    Button button = new Button("Button", new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            label.setText("clicked");
                        }
                    });

                    panel.add(label);
                    panel.add(button);
                    return panel;
                }
            });
        }
    }, menupath);

    addMenuCommand("Set faulty generator", new ScheduledCommand() {
        @Override
        public void execute() {
            grid.setDetailsGenerator(new DetailsGenerator() {
                @Override
                public Widget getDetails(int rowIndex) {
                    throw new RuntimeException("This is by design.");
                }
            });
        }
    }, menupath);

    addMenuCommand("Set empty generator", new ScheduledCommand() {
        @Override
        public void execute() {
            grid.setDetailsGenerator(new DetailsGenerator() {
                /*
                 * While this is functionally equivalent to the NULL
                 * generator, it's good to be explicit, since the behavior
                 * isn't strictly tied between them. NULL generator might be
                 * changed to render something different by default, and an
                 * empty generator might behave differently also in the
                 * future.
                 */

                @Override
                public Widget getDetails(int rowIndex) {
                    return null;
                }
            });
        }
    }, menupath);

    String[] togglemenupath = new String[] { menupath[0], menupath[1], "Toggle details for..." };
    for (int i : new int[] { 0, 1, 100, 200, 300, 400, 500, 600, 700, 800, 900, 999 }) {
        final int rowIndex = i;
        addMenuCommand("Row " + rowIndex, new ScheduledCommand() {
            boolean visible = false;

            @Override
            public void execute() {
                visible = !visible;
                grid.setDetailsVisible(rowIndex, visible);
            }
        }, togglemenupath);
    }

}

From source file:com.xpn.xwiki.watch.client.ui.dialog.CommentAddDialog.java

License:Open Source License

protected Widget getParametersPanel() {
    FlowPanel paramsPanel = new FlowPanel();
    Label commentLabel = new Label();
    commentLabel.setStyleName("comment-label");
    commentLabel.setText(app.getTranslation(getDialogTranslationName() + ".comment"));
    paramsPanel.add(commentLabel);/*from   w w  w.  ja  v  a2s  . c  o m*/
    commentTextArea = new TextArea();
    commentTextArea.setPixelSize(400, 300);
    commentTextArea.setName("comment");
    commentTextArea.setStyleName(getCSSName("comment"));
    paramsPanel.add(commentTextArea);
    return paramsPanel;
}

From source file:com.xpn.xwiki.watch.client.ui.dialog.EditTagsDialog.java

License:Open Source License

protected Widget getParametersPanel() {
    FlowPanel paramsPanel = new FlowPanel();
    Label tagsLabel = new Label();
    tagsLabel.setStyleName("tags-label");
    tagsLabel.setText(app.getTranslation(getDialogTranslationName() + ".tags"));
    paramsPanel.add(tagsLabel);/*from  w w w. j  a v a2 s  . c o  m*/
    TextBox tagsTextBox = new TextBox();
    tagsTextBox.setVisibleLength(30);
    tagsTextBox.setName("tags");
    WordListSuggestOracle tagListOracle = new WordListSuggestOracle(new TagListSuggestOracle((Watch) this.app),
            Constants.PROPERTY_TAGS_SEPARATORS_EDIT, true);
    tagsSuggestBox = new SuggestBox(tagListOracle, tagsTextBox);
    tagsTextBox.addStyleName(getCSSName("tags"));
    if (tags != null) {
        tagsTextBox.setText(tags);
    }
    paramsPanel.add(tagsSuggestBox);
    return paramsPanel;
}

From source file:com.xpn.xwiki.watch.client.ui.dialog.FeedDialog.java

License:Open Source License

protected Widget getGroupsFields() {
    FlowPanel groupsPanel = new FlowPanel();
    Label groupLabel = new Label();
    groupLabel.setStyleName("groups-label");
    groupLabel.setText(app.getTranslation(getDialogTranslationName() + ".groups"));
    groupsPanel.add(groupLabel);/*from w ww . j a v a 2 s .c om*/
    List currentGroups = feed.getGroups();
    groupsListBox.setMultipleSelect(true);
    Map groupMap = ((Watch) app).getConfig().getGroups();
    Iterator it = groupMap.keySet().iterator();
    while (it.hasNext()) {
        String groupname = (String) it.next();
        String all = ((Watch) app).getTranslation("all");
        if (!groupname.equals(all)) {
            //get group for this key
            Group currentGroup = (Group) groupMap.get(groupname);
            //don't add unless it is a real group
            if (!currentGroup.getPageName().equals("") || currentGroups.contains(groupname)) {
                String grouptitle = currentGroup.getName();
                if (groupname.indexOf(".") == -1)
                    grouptitle = "[" + grouptitle + "]";
                groupsListBox.addItem(grouptitle, groupname);
                if (currentGroups.contains(groupname)) {
                    groupsListBox.setItemSelected(groupsListBox.getItemCount() - 1, true);
                }
            }
        }
    }
    groupsPanel.add(groupsListBox);
    return groupsPanel;
}

From source file:com.xpn.xwiki.watch.client.ui.dialog.GroupDialog.java

License:Open Source License

protected Widget getParametersPanel() {
    FlowPanel paramsPanel = new FlowPanel();
    Label groupLabel = new Label();
    groupLabel.setStyleName("group-label");
    groupLabel.setText(app.getTranslation(getDialogTranslationName() + ".group"));
    paramsPanel.add(groupLabel);/*from   ww w. j  a v  a2 s  . c o  m*/
    groupTextBox = new TextBox();
    if (group != null)
        groupTextBox.setText(group.getName());
    groupTextBox.setVisibleLength(20);
    groupTextBox.setName("group");
    groupTextBox.setStyleName(getCSSName("group"));
    paramsPanel.add(groupTextBox);
    paramsPanel.add(getGroupsFields());
    return paramsPanel;
}

From source file:com.xpn.xwiki.watch.client.ui.dialog.KeywordDialog.java

License:Open Source License

protected Widget getParametersPanel() {
    FlowPanel paramsPanel = new FlowPanel();
    Label keywordLabel = new Label();
    keywordLabel.setStyleName("keyword-label");
    keywordLabel.setText(app.getTranslation(getDialogTranslationName() + ".keyword"));
    paramsPanel.add(keywordLabel);//from ww  w  .  j  a v a2s.c om
    if (keyword != null) {
        keywordTextBox.setText(keyword.getName());
    }
    keywordTextBox.setVisibleLength(20);
    keywordTextBox.setName("keyword");
    keywordTextBox.setStyleName(getCSSName("keyword"));
    paramsPanel.add(keywordTextBox);
    paramsPanel.add(getGroupsFields());
    return paramsPanel;
}

From source file:com.xpn.xwiki.watch.client.ui.dialog.KeywordDialog.java

License:Open Source License

protected Widget getGroupsFields() {
    FlowPanel groupsPanel = new FlowPanel();
    Label groupLabel = new Label();
    groupLabel.setStyleName("groups-label");
    groupLabel.setText(app.getTranslation(getDialogTranslationName() + ".groups"));
    groupsPanel.add(groupLabel);/*w  ww. j  a va  2s . c om*/
    groupListBox.setMultipleSelect(false);
    Map groupMap = ((Watch) app).getConfig().getGroups();
    Iterator it = groupMap.keySet().iterator();
    boolean selected = false;
    String all = ((Watch) app).getTranslation("all");
    groupListBox.addItem("all", all);
    while (it.hasNext()) {
        String groupname = (String) it.next();
        if (!groupname.equals(all)) {
            //get group for this key
            Group currentGroup = (Group) groupMap.get(groupname);
            //don't add it unless it is a real group
            if (!currentGroup.getPageName().equals("") || this.keyword.getGroup().equals(groupname)) {
                String grouptitle = currentGroup.getName();
                groupListBox.addItem(grouptitle, groupname);
                if (this.keyword.getGroup().equals(groupname)) {
                    selected = true;
                    groupListBox.setItemSelected(groupListBox.getItemCount() - 1, true);
                }
            }
        }
    }
    // we need to select the first item (All) if none is selected
    if (selected == false) {
        groupListBox.setItemSelected(0, true);
    }
    groupsPanel.add(groupListBox);
    return groupsPanel;
}

From source file:com.xpn.xwiki.watch.client.ui.dialog.PressReviewMailDialog.java

License:Open Source License

protected Widget getParametersPanel() {
    FlowPanel paramsPanel = new FlowPanel();
    Label mailSubjectLabel = new Label();
    mailSubjectLabel.setStyleName("mailsubject-label");
    mailSubjectLabel.setText(app.getTranslation(getDialogTranslationName() + ".mailsubject"));
    paramsPanel.add(mailSubjectLabel);/*from ww  w . j  ava2s.  co m*/

    mailSubjectTextBox = new TextBox();
    mailSubjectTextBox.setVisibleLength(60);
    mailSubjectTextBox.setName("mailsubject");
    mailSubjectTextBox.setStyleName(getCSSName("mailsubject"));
    mailSubjectTextBox.setText(app.getTranslation(getDialogTranslationName() + ".mailsubjectdefault"));
    paramsPanel.add(mailSubjectTextBox);

    Label mailToLabel = new Label();
    mailToLabel.setStyleName("mailto-label");
    mailToLabel.setText(app.getTranslation(getDialogTranslationName() + ".mailto"));
    paramsPanel.add(mailToLabel);

    mailToTextBox = new TextBox();
    mailToTextBox.setVisibleLength(60);
    mailToTextBox.setName("mailto");
    mailToTextBox.setStyleName(getCSSName("mailto"));
    paramsPanel.add(mailToTextBox);

    Label mailContentLabel = new Label();
    mailContentLabel.setStyleName("mailcontent-label");
    mailContentLabel.setText(app.getTranslation(getDialogTranslationName() + ".mailcontent"));
    paramsPanel.add(mailContentLabel);

    mailContentTextArea = new TextArea();
    mailContentTextArea.setVisibleLines(5);
    mailContentTextArea.setName("mailcontent");
    mailContentTextArea.setStyleName(getCSSName("mailcontent"));
    mailContentTextArea.setText(app.getTranslation(getDialogTranslationName() + ".mailcontentdefault"));
    paramsPanel.add(mailContentTextArea);

    articlesContentCheckBox = new CheckBox();
    articlesContentCheckBox.setText(app.getTranslation(getDialogTranslationName() + ".articleswithcontent"));
    articlesContentCheckBox.setStyleName(getCSSName("withcontent"));
    paramsPanel.add(articlesContentCheckBox);

    articlesCommentsCheckBox = new CheckBox();
    articlesCommentsCheckBox.setText(app.getTranslation(getDialogTranslationName() + ".articleswithcomments"));
    articlesCommentsCheckBox.setStyleName(getCSSName("withcomments"));
    paramsPanel.add(articlesCommentsCheckBox);

    return paramsPanel;
}

From source file:com.xpn.xwiki.watch.client.ui.dialog.SearchEngineFeedDialog.java

License:Open Source License

protected Widget getParametersPanel() {
    FlowPanel paramsPanel = new FlowPanel();
    Label feedNameLabel = new Label();
    feedNameLabel.setStyleName("feedname-label");
    feedNameLabel.setText(app.getTranslation(getDialogTranslationName() + ".feedname"));
    paramsPanel.add(feedNameLabel);/*from w  w w  .  ja  v  a2  s .  c o m*/

    feedNameTextBox = new TextBox();
    if ((feed != null) && (feed.getName() != null))
        feedNameTextBox.setText(feed.getName());
    feedNameTextBox.setVisibleLength(60);
    feedNameTextBox.setName("feedname");
    feedNameTextBox.setStyleName(getCSSName("feedname"));
    paramsPanel.add(feedNameTextBox);
    Label searchTermLabel = new Label();
    searchTermLabel.setStyleName("query-label");
    searchTermLabel.setText(app.getTranslation(getDialogTranslationName() + ".query"));
    paramsPanel.add(searchTermLabel);
    searchTermTextBox = new TextBox();
    searchTermTextBox.setVisibleLength(40);
    searchTermTextBox.setName("query");
    searchTermTextBox.setStyleName(getCSSName("query"));
    paramsPanel.add(searchTermTextBox);
    if ((languages != null) && (languages.length > 0)) {
        Label searchLanguageLabel = new Label();
        searchLanguageLabel.setStyleName("language-label");
        searchLanguageLabel.setText(app.getTranslation(getDialogTranslationName() + ".language"));
        paramsPanel.add(searchLanguageLabel);
        searchLanguageListBox = new ListBox();
        searchLanguageListBox.setName("language");
        searchLanguageListBox.setMultipleSelect(false);
        for (int i = 0; i < languages.length; i++) {
            String language = languages[i];
            String languageText = app.getTranslation("language." + language);
            searchLanguageListBox.addItem(languageText, language);
        }
        paramsPanel.add(searchLanguageListBox);
    }
    paramsPanel.add(getGroupsFields());
    return paramsPanel;
}

From source file:com.xpn.xwiki.watch.client.ui.dialog.StandardFeedDialog.java

License:Open Source License

protected Widget getParametersPanel() {
    FlowPanel paramsPanel = new FlowPanel();
    Label feedNameLabel = new Label();
    feedNameLabel.setStyleName("feedname-label");
    feedNameLabel.setText(app.getTranslation(getDialogTranslationName() + ".feedname"));
    paramsPanel.add(feedNameLabel);/*from  w  w  w .  ja v  a2 s.c o  m*/
    feedNameTextBox = new TextBox();
    if ((feed != null) && (feed.getName() != null))
        feedNameTextBox.setText(feed.getName());
    // If it's a feed update and the feed has a title, print the title
    if (feed.getPageName().trim().length() > 0) {
        if (feed.getTitle().trim().length() > 0) {
            feedNameTextBox.setText(feed.getTitle());
        }
    }
    feedNameTextBox.setVisibleLength(60);
    feedNameTextBox.setName("feedname");
    feedNameTextBox.setStyleName(getCSSName("feedname"));
    paramsPanel.add(feedNameTextBox);
    Label feedURLLabel = new Label();
    feedURLLabel.setStyleName("feedurl-label");
    feedURLLabel.setText(app.getTranslation(getDialogTranslationName() + ".feedurl"));
    paramsPanel.add(feedURLLabel);
    feedURLTextBox = new TextBox();
    if ((feed != null) && (feed.getUrl() != null))
        feedURLTextBox.setText(feed.getUrl());
    feedURLTextBox.setVisibleLength(60);
    feedURLTextBox.setName("feedurl");
    feedURLTextBox.setStyleName(getCSSName("feedurl"));
    paramsPanel.add(feedURLTextBox);
    paramsPanel.add(getGroupsFields());
    return paramsPanel;
}