Example usage for com.vaadin.ui Button setCaption

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

Introduction

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

Prototype

@Override
    public void setCaption(String caption) 

Source Link

Usage

From source file:cb_server.SettingsWindow.java

License:Open Source License

private Component getLogInButton(int i) {
    com.vaadin.ui.HorizontalLayout box = new HorizontalLayout();
    com.vaadin.ui.Button button = new com.vaadin.ui.Button();
    button.setCaption("Get API Key");

    button.addClickListener(new ClickListener() {

        private static final long serialVersionUID = -1417363407758383092L;

        @Override/* w  ww .ja va 2 s .c  o  m*/
        public void buttonClick(ClickEvent event) {
            LogInWindow sub = LogInWindow.getInstanz();

            if (!UI.getCurrent().getWindows().contains(sub))

                // Add it to the root component
                UI.getCurrent().addWindow(sub);
        }
    });

    box.addComponent(button);

    return box;
}

From source file:com.anphat.customer.controller.CustomerContactController.java

private void addListenerCreateCustContact() {
    CommonUtils.setVisibleBtnTablePanel(panelTblContact, true, false, false, false);
    Button btnAddCustContact = panelTblContact.getAddButton();
    btnAddCustContact.setCaption(BundleUtils.getString("label.customer.contact.addNew"));
    ShortcutUtils.setShortkeyF2(btnAddCustContact);
    addBtnAddContactClickListener(btnAddCustContact, null);
}

From source file:com.anphat.customer.controller.CustomerContactController.java

private void addListenerCreateCustCareHistory() {
    CommonUtils.setVisibleBtnTablePanel(panelTblHistory, true, false, false, false);
    Button btnAddCustCareHistory = panelTblHistory.getAddButton();
    btnAddCustCareHistory.setCaption(BundleUtils.getString("label.history.care.addNew"));
    ShortcutUtils.setShortkeyAddNew(btnAddCustCareHistory);
    btnAddCustCareHistory.addClickListener(new CommonButtonClickListener() {

        @Override/*from   w w  w.  j ava2  s  .co  m*/
        public void execute() {
            List<CustomerContactDTO> lstCustContactDTOs = Lists.newArrayList();
            lstCustContactDTOs.addAll(
                    (Collection<? extends CustomerContactDTO>) panelTblContact.getMainTable().getItemIds());
            careHistoryDialog = new CustomerCareHistoryDialog(
                    BundleUtils.getString("customerCareHistoryForm.insert"), lstServices,
                    lstCustomerServiceStatus, lstCustContactDTOs);
            UI.getCurrent().addWindow(careHistoryDialog);
            addListenerBtnSaveCareHistory(careHistoryDialog);
            addBtnAddContactClickListener(careHistoryDialog.getBtnAddContact(), null);
        }
    });
}

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

License:Apache License

CssLayout buildMenu() {
    // Add items//  w  w w  .  ja  v  a2  s .  c o  m
    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);/*from   w  w w.  java 2s .  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);/*from  w w  w .  jav  a  2  s. co m*/

    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);//from  w  w  w  . ja va2 s.c  o m

    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   w  w  w  . j av  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(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  ww . ja  va 2 s .c om*/

    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);//from w ww .j a  v  a2 s  .c  o 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;
}