Example usage for com.vaadin.ui Button setHtmlContentAllowed

List of usage examples for com.vaadin.ui Button setHtmlContentAllowed

Introduction

In this page you can find the example usage for com.vaadin.ui Button setHtmlContentAllowed.

Prototype

@Deprecated
public void setHtmlContentAllowed(boolean htmlContentAllowed) 

Source Link

Document

Set whether the caption text is rendered as HTML or not.

Usage

From source file:annis.gui.controlpanel.QueryPanel.java

License:Apache License

public QueryPanel(final AnnisUI ui) {
    super(4, 5);/*from  w  w  w  .  j av a  2s.  co m*/
    this.ui = ui;

    this.lastPublicStatus = "Welcome to ANNIS! " + "A tutorial is available on the right side.";

    this.state = ui.getQueryState();

    setSpacing(true);
    setMargin(false);

    setRowExpandRatio(0, 1.0f);
    setColumnExpandRatio(0, 0.0f);
    setColumnExpandRatio(1, 0.1f);
    setColumnExpandRatio(2, 0.0f);
    setColumnExpandRatio(3, 0.0f);

    txtQuery = new AqlCodeEditor();
    txtQuery.setPropertyDataSource(state.getAql());
    txtQuery.setInputPrompt("Please enter AQL query");
    txtQuery.addStyleName("query");
    if (ui.getInstanceFont() == null) {
        txtQuery.addStyleName("default-query-font");
        txtQuery.setTextareaStyle("default-query-font");
    } else {
        txtQuery.addStyleName(Helper.CORPUS_FONT);
        txtQuery.setTextareaStyle(Helper.CORPUS_FONT);
    }

    txtQuery.addStyleName("keyboardInput");
    txtQuery.setWidth("100%");
    txtQuery.setHeight(15f, Unit.EM);
    txtQuery.setTextChangeTimeout(500);

    final VirtualKeyboardCodeEditor virtualKeyboard;
    if (ui.getInstanceConfig().getKeyboardLayout() == null) {
        virtualKeyboard = null;
    } else {
        virtualKeyboard = new VirtualKeyboardCodeEditor();
        virtualKeyboard.setKeyboardLayout(ui.getInstanceConfig().getKeyboardLayout());
        virtualKeyboard.extend(txtQuery);
    }

    txtStatus = new TextArea();
    txtStatus.setValue(this.lastPublicStatus);
    txtStatus.setWidth("100%");
    txtStatus.setHeight(4.0f, Unit.EM);
    txtStatus.addStyleName("border-layout");
    txtStatus.setReadOnly(true);

    piCount = new ProgressBar();
    piCount.setIndeterminate(true);
    piCount.setEnabled(false);
    piCount.setVisible(false);

    btShowResult = new Button("Search");
    btShowResult.setIcon(FontAwesome.SEARCH);
    btShowResult.setWidth("100%");
    btShowResult.addClickListener(new ShowResultClickListener());
    btShowResult.setDescription("<strong>Show Result</strong><br />Ctrl + Enter");
    btShowResult.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL);
    btShowResult.setDisableOnClick(true);

    VerticalLayout historyListLayout = new VerticalLayout();
    historyListLayout.setSizeUndefined();

    lstHistory = new ListSelect();
    lstHistory.setWidth("200px");
    lstHistory.setNullSelectionAllowed(false);
    lstHistory.setValue(null);
    lstHistory.addValueChangeListener((ValueChangeListener) this);
    lstHistory.setImmediate(true);
    lstHistory.setContainerDataSource(historyContainer);
    lstHistory.setItemCaptionPropertyId("query");
    lstHistory.addStyleName(Helper.CORPUS_FONT);

    Button btShowMoreHistory = new Button("Show more details", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (historyWindow == null) {
                historyWindow = new Window("History");
                historyWindow.setModal(false);
                historyWindow.setWidth("400px");
                historyWindow.setHeight("250px");
            }
            historyWindow.setContent(new HistoryPanel(state.getHistory(), ui.getQueryController()));

            if (UI.getCurrent().getWindows().contains(historyWindow)) {
                historyWindow.bringToFront();
            } else {
                UI.getCurrent().addWindow(historyWindow);
            }
        }
    });
    btShowMoreHistory.setWidth("100%");

    historyListLayout.addComponent(lstHistory);
    historyListLayout.addComponent(btShowMoreHistory);

    historyListLayout.setExpandRatio(lstHistory, 1.0f);
    historyListLayout.setExpandRatio(btShowMoreHistory, 0.0f);

    btHistory = new PopupButton("History");
    btHistory.setContent(historyListLayout);
    btHistory.setDescription("<strong>Show History</strong><br />"
            + "Either use the short overview (arrow down) or click on the button " + "for the extended view.");

    Button btShowKeyboard = null;
    if (virtualKeyboard != null) {
        btShowKeyboard = new Button();
        btShowKeyboard.setWidth("100%");
        btShowKeyboard.setDescription("Click to show a virtual keyboard");
        btShowKeyboard.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        btShowKeyboard.addStyleName(ValoTheme.BUTTON_SMALL);
        btShowKeyboard.setIcon(new ClassResource(VirtualKeyboardCodeEditor.class, "keyboard.png"));
        btShowKeyboard.addClickListener(new ShowKeyboardClickListener(virtualKeyboard));
    }

    Button btShowQueryBuilder = new Button("Query<br />Builder");
    btShowQueryBuilder.setHtmlContentAllowed(true);
    btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_SMALL);
    btShowQueryBuilder.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
    btShowQueryBuilder.setIcon(new ThemeResource("images/tango-icons/32x32/document-properties.png"));
    btShowQueryBuilder.addClickListener(new ShowQueryBuilderClickListener(ui));

    VerticalLayout moreActionsLayout = new VerticalLayout();
    moreActionsLayout.setWidth("250px");
    btMoreActions = new PopupButton("More");
    btMoreActions.setContent(moreActionsLayout);

    //    btShowResultNewTab = new Button("Search (open in new tab)");
    //    btShowResultNewTab.setWidth("100%");
    //    btShowResultNewTab.addClickListener(new ShowResultInNewTabClickListener());
    //    btShowResultNewTab.setDescription("<strong>Show Result and open result in new tab</strong><br />Ctrl + Shift + Enter");
    //    btShowResultNewTab.setDisableOnClick(true);
    //    btShowResultNewTab.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL, ModifierKey.SHIFT);
    //    moreActionsLayout.addComponent(btShowResultNewTab);

    Button btShowExport = new Button("Export", new ShowExportClickListener(ui));
    btShowExport.setIcon(FontAwesome.DOWNLOAD);
    btShowExport.setWidth("100%");
    moreActionsLayout.addComponent(btShowExport);

    Button btShowFrequency = new Button("Frequency Analysis", new ShowFrequencyClickListener(ui));
    btShowFrequency.setIcon(FontAwesome.BAR_CHART_O);
    btShowFrequency.setWidth("100%");
    moreActionsLayout.addComponent(btShowFrequency);

    /*
     * We use the grid layout for a better rendering efficiency, but this comes
     * with the cost of some complexity when defining the positions of the
     * elements in the layout.
     * 
     * This grid hopefully helps a little bit in understanding the "magic"
     * numbers better.
     * 
     * Q: Query text field
     * QB: Button to toggle query builder // TODO
     * KEY: Button to show virtual keyboard
     * SEA: "Search" button
     * MOR: "More actions" button 
     * HIST: "History" button
     * STAT: Text field with the real status
     * PROG: indefinite progress bar (spinning circle)
     * 
     *   \  0  |  1  |  2  |  3  
     * --+-----+---+---+---+-----
     * 0 |  Q  |  Q  |  Q  | QB 
     * --+-----+-----+-----+-----
     * 1 |  Q  |  Q  |  Q  | KEY 
     * --+-----+-----+-----+-----
     * 2 | SEA | MOR | HIST|     
     * --+-----+-----+-----+-----
     * 3 | STAT| STAT| STAT| PROG
     */
    addComponent(txtQuery, 0, 0, 2, 1);
    addComponent(txtStatus, 0, 3, 2, 3);
    addComponent(btShowResult, 0, 2);
    addComponent(btMoreActions, 1, 2);
    addComponent(btHistory, 2, 2);
    addComponent(piCount, 3, 3);
    addComponent(btShowQueryBuilder, 3, 0);
    if (btShowKeyboard != null) {
        addComponent(btShowKeyboard, 3, 1);
    }

    // alignment
    setRowExpandRatio(0, 0.0f);
    setRowExpandRatio(1, 1.0f);
    setColumnExpandRatio(0, 1.0f);
    setColumnExpandRatio(1, 0.0f);
    setColumnExpandRatio(2, 0.0f);
    setColumnExpandRatio(3, 0.0f);

    //setComponentAlignment(btShowQueryBuilder, Alignment.BOTTOM_CENTER);
}

From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java

License:Open Source License

private Button getButton(String caption) {
    Button button = new Button(caption);
    button.setImmediate(true);/* w w  w .ja v a  2s .  com*/
    button.setHtmlContentAllowed(true);
    return button;
}

From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java

License:Apache License

Component buildTestMenu() {
    final CssLayout menu = new CssLayout();
    menu.addStyleName("large-icons");

    final Label logo = new Label("Va");
    logo.setSizeUndefined();//from ww w  .j a  v  a  2  s . co m
    logo.setPrimaryStyleName("valo-menu-logo");
    menu.addComponent(logo);

    Button b = new Button("Reference <span class=\"valo-menu-badge\">3</span>");
    b.setIcon(FontAwesome.TH_LIST);
    b.setPrimaryStyleName("valo-menu-item");
    b.addStyleName("selected");
    b.setHtmlContentAllowed(true);
    menu.addComponent(b);

    b = new Button("API");
    b.setIcon(FontAwesome.BOOK);
    b.setPrimaryStyleName("valo-menu-item");
    menu.addComponent(b);

    b = new Button("Examples <span class=\"valo-menu-badge\">12</span>");
    b.setIcon(FontAwesome.TABLE);
    b.setPrimaryStyleName("valo-menu-item");
    b.setHtmlContentAllowed(true);
    menu.addComponent(b);

    return menu;
}

From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java

License:Apache License

CssLayout buildMenu() {
    // Add items/*w  w  w  .  j a va  2  s  .c om*/
    menuItems.put("common", "Common UI Elements");
    menuItems.put("labels", "Labels");
    menuItems.put("buttons-and-links", "Buttons & Links");
    menuItems.put("textfields", "Text Fields");
    menuItems.put("datefields", "Date Fields");
    menuItems.put("comboboxes", "Combo Boxes");
    menuItems.put("selects", "Selects");
    menuItems.put("checkboxes", "Check Boxes & Option Groups");
    menuItems.put("sliders", "Sliders & Progress Bars");
    menuItems.put("colorpickers", "Color Pickers");
    menuItems.put("menubars", "Menu Bars");
    menuItems.put("trees", "Trees");
    menuItems.put("tables", "Tables");
    menuItems.put("dragging", "Drag and Drop");
    menuItems.put("panels", "Panels");
    menuItems.put("splitpanels", "Split Panels");
    menuItems.put("tabs", "Tabs");
    menuItems.put("accordions", "Accordions");
    menuItems.put("popupviews", "Popup Views");
    // menuItems.put("calendar", "Calendar");
    menuItems.put("forms", "Forms");

    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    menu.addComponent(top);
    menu.addComponent(createThemeSelect());

    final Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    final Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");
    final StringGenerator sg = new StringGenerator();
    final MenuItem settingsItem = settings.addItem(
            sg.nextString(true) + " " + sg.nextString(true) + sg.nextString(false),
            new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"), null);
    settingsItem.addItem("Edit Profile", null);
    settingsItem.addItem("Preferences", null);
    settingsItem.addSeparator();
    settingsItem.addItem("Sign Out", null);
    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    Label label = null;
    int count = -1;
    for (final Entry<String, String> item : menuItems.entrySet()) {
        if (item.getKey().equals("labels")) {
            label = new Label("Components", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("panels")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Containers", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        if (item.getKey().equals("forms")) {
            label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");
            count = 0;
            label = new Label("Other", ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);
        }
        final Button b = new Button(item.getValue(), new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                navigator.navigateTo(item.getKey());
            }
        });
        if (count == 2) {
            b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>");
        }
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName("valo-menu-item");
        b.setIcon(testIcon.get());
        menuItemsLayout.addComponent(b);
        count++;
    }
    label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>");

    return menu;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.account.AccountReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);//  w  w w.  j  a  va 2 s .c  om

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_CONTACT) + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts)));
        }
    });
    toolbarLayout.addComponent(relatedContacts);

    Button relatedOpportunities = new Button();
    relatedOpportunities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_OPPORTUNITY
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_OPPORTUNITY) + "</div>");
    relatedOpportunities.setHtmlContentAllowed(true);
    relatedOpportunities.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(new AccountEvent.GoToRelatedItems(this,
                    new CrmRelatedItemsScreenData(associateOpportunities)));
        }
    });
    toolbarLayout.addComponent(relatedOpportunities);

    Button relatedLeads = new Button();
    relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_LEAD)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads)));
        }
    });
    toolbarLayout.addComponent(relatedLeads);

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new AccountEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(new AccountEvent.GoToRelatedItems(this,
                    new CrmRelatedItemsScreenData(associateActivities)));
        }
    });
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.activity.AssignmentReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);//  ww w . j a v a  2 s.com

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 8846423206027007038L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ActivityEvent.GoToRelatedItems(AssignmentReadViewImpl.this,
                    new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);
    return toolbarLayout;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.activity.CallReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/*w  ww  .j a  va2  s.  com*/

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 8846423206027007038L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ActivityEvent.GoToRelatedItems(CallReadViewImpl.this,
                    new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);
    return toolbarLayout;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.activity.MeetingReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/*from  www  .j a  va2s . c om*/

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 8846423206027007038L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ActivityEvent.GoToRelatedItems(MeetingReadViewImpl.this,
                    new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);
    return toolbarLayout;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);//from   w w w  .j  a v a 2s.c  o m

    Button relatedAccounts = new Button();
    relatedAccounts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACCOUNT
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACCOUNT) + "</div>");
    relatedAccounts.setHtmlContentAllowed(true);
    relatedAccounts.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateAccounts)));
        }
    });
    toolbarLayout.addComponent(relatedAccounts);

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_CONTACT) + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts)));
        }
    });
    toolbarLayout.addComponent(relatedContacts);

    Button relatedLeads = new Button();
    relatedLeads.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_LEAD
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_LEAD)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads)));
        }
    });
    toolbarLayout.addComponent(relatedLeads);

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(new CampaignEvent.GoToRelatedItems(this,
                    new CrmRelatedItemsScreenData(associateActivities)));
        }
    });
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.cases.CaseReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    HorizontalLayout toolbarLayout = new HorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    toolbarLayout.setSpacing(true);/*  w w w. j a va 2s.co  m*/

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_CONTACT) + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts)));
        }
    });
    toolbarLayout.addComponent(relatedContacts);

    Button relatedNotes = new Button();
    relatedNotes.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_DOCUMENT
            + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE)
            + "</div>");
    relatedNotes.setHtmlContentAllowed(true);
    relatedNotes.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance()
                    .post(new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateNotes)));
        }
    });
    toolbarLayout.addComponent(relatedNotes);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7589415773039335559L;

        @Override
        public void buttonClick(ClickEvent arg0) {
            EventBusFactory.getInstance().post(
                    new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities)));
        }
    });
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}