Example usage for com.vaadin.ui Button addClickListener

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

Introduction

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

Prototype

public Registration addClickListener(ClickListener listener) 

Source Link

Document

Adds the button click listener.

Usage

From source file:com.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 a2s . com*/

    Button relatedAccounts = new Button();
    relatedAccounts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACCOUNT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(AccountI18nEnum.LIST)
            + "</div>");
    relatedAccounts.setHtmlContentAllowed(true);
    relatedAccounts.addClickListener(clickEvent -> 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\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> 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\">" + UserUIContext.getMessage(LeadI18nEnum.LIST)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads))));
    toolbarLayout.addComponent(relatedLeads);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new CampaignEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

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

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    MHorizontalLayout toolbarLayout = new MHorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateContacts))));
    toolbarLayout.addComponent(relatedContacts);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new CaseEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.contact.ContactReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    MHorizontalLayout toolbarLayout = new MHorizontalLayout();
    toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Button relatedOpportunities = new Button();
    relatedOpportunities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_OPPORTUNITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(OpportunityI18nEnum.LIST) + "</div>");
    relatedOpportunities.setHtmlContentAllowed(true);
    relatedOpportunities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateOpportunityList))));

    toolbarLayout.addComponent(relatedOpportunities);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivityList))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.lead.LeadReadViewImpl.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  va2  s. c  om*/

    Button relatedCampaigns = new Button();
    relatedCampaigns.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CAMPAIGN
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(CampaignI18nEnum.LIST)
            + "</div>");
    relatedCampaigns.setHtmlContentAllowed(true);
    relatedCampaigns
            .addClickListener(clickEvent -> EventBusFactory.getInstance().post(new LeadEvent.GoToRelatedItems(
                    LeadReadViewImpl.this, new CrmRelatedItemsScreenData(associateCampaigns))));
    toolbarLayout.addComponent(relatedCampaigns);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new LeadEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.module.crm.view.opportunity.OpportunityReadViewImpl.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 va  2s .  c o m

    Button relatedContacts = new Button();
    relatedContacts.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_CONTACT
            + "\"></span><div class=\"screen-reader-text\">" + UserUIContext.getMessage(ContactI18nEnum.LIST)
            + "</div>");
    relatedContacts.setHtmlContentAllowed(true);
    relatedContacts.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new OpportunityEvent.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\">" + UserUIContext.getMessage(LeadI18nEnum.LIST)
            + "</div>");
    relatedLeads.setHtmlContentAllowed(true);
    relatedLeads.addClickListener(clickEvent -> EventBusFactory.getInstance()
            .post(new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateLeads))));
    toolbarLayout.addComponent(relatedLeads);

    Button relatedActivities = new Button();
    relatedActivities.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.CRM_ACTIVITY
            + "\"></span><div class=\"screen-reader-text\">"
            + UserUIContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY) + "</div>");
    relatedActivities.setHtmlContentAllowed(true);
    relatedActivities.addClickListener(clickEvent -> EventBusFactory.getInstance().post(
            new OpportunityEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(associateActivities))));
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

From source file:com.mycollab.mobile.ui.ConfirmDialog.java

License:Open Source License

private void constructUI(final String message, final String okCaption, final String cancelCaption) {
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();/*from   w ww  .  jav  a  2s  . co m*/
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    VerticalLayout messageWrapper = new VerticalLayout();
    messageWrapper.setStyleName("message-wrapper");
    messageWrapper.setWidth("100%");
    messageWrapper.setMargin(true);

    final Label messageDisplay = new Label(message);
    messageDisplay.setWidth("100%");
    messageWrapper.addComponent(messageDisplay);
    layout.addComponent(messageWrapper);

    HorizontalLayout controlBtn = new HorizontalLayout();
    controlBtn.setWidth("100%");

    final Button okBtn = new Button(okCaption);
    okBtn.setWidth("100%");
    okBtn.setHeight("35px");
    final Button cancelBtn = new Button(cancelCaption);
    cancelBtn.setWidth("100%");
    cancelBtn.setHeight("35px");

    ClickListener listener = (clickEvent) -> {
        ConfirmDialog.this.setConfirmed(clickEvent.getButton() == okBtn);
        if (ConfirmDialog.this.getListener() != null) {
            ConfirmDialog.this.getListener().onClose(ConfirmDialog.this);
        }
        close();
    };

    okBtn.addClickListener(listener);
    cancelBtn.addClickListener(listener);

    controlBtn.addComponent(cancelBtn);
    controlBtn.addComponent(okBtn);

    layout.addComponent(controlBtn);
    this.setContent(layout);
}

From source file:com.mycollab.module.crm.view.account.AccountSimpleSearchPanel.java

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPanel = new GridLayout(3, 3);
    layoutSearchPanel.setSpacing(true);/*from w  w  w  . jav  a 2s.co  m*/
    group = new ValueComboBox(false, "Name", "Email", "Website", "Phone",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Email")) {
                addTextFieldSearch();
            } else if (searchType.equals("Website")) {
                addTextFieldSearch();
            } else if (searchType.equals("Phone")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    layoutSearchPanel.addComponent(group, 1, 0);
    layoutSearchPanel.setComponentAlignment(group, Alignment.MIDDLE_CENTER);

    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.setDescription("Search");

    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPanel.addComponent(searchBtn, 2, 0);
    layoutSearchPanel.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPanel);
}

From source file:com.mycollab.module.crm.view.campaign.CampaignSimpleSearchPanel.java

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPane = new GridLayout(3, 2);
    layoutSearchPane.setSpacing(true);/*  w  w w  .j  a va 2  s. c  o  m*/

    group = new ValueComboBox(false, "Campaign Name", "Start Date", "End Date");
    group.select("Campaign Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Campaign Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Start Date")) {
                addDateFieldSearch();
            } else if (searchType.equals("End Date")) {
                addDateFieldSearch();
            }
        }
    });

    layoutSearchPane.addComponent(group, 1, 0);
    layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPane.addComponent(searchBtn, 2, 0);
    layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPane);
}

From source file:com.mycollab.module.crm.view.cases.CaseSimpleSearchPanel.java

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPane = new GridLayout(3, 3);
    layoutSearchPane.setSpacing(true);//w  w  w . j  a v  a  2 s  . c o m

    group = new ValueComboBox(false, "Subject", "Account Name", "Status",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Subject")) {
                addTextFieldSearch();
            } else if (searchType.equals("Account Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Status")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    layoutSearchPane.addComponent(group, 1, 0);
    layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPane.addComponent(searchBtn, 2, 0);
    layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPane);
}

From source file:com.mycollab.module.crm.view.contact.ContactSimpleSearchPanel.java

License:Open Source License

private void createBasicSearchLayout() {
    layoutSearchPane = new GridLayout(3, 3);
    layoutSearchPane.setSpacing(true);// w w  w  . j  a  v  a2  s .  c  o  m

    group = new ValueComboBox(false, "Name", "Email", "Phone",
            AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE));
    group.select("Name");
    group.setImmediate(true);
    group.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            removeComponents();
            String searchType = (String) group.getValue();
            if (searchType.equals("Name")) {
                addTextFieldSearch();
            } else if (searchType.equals("Email")) {
                addTextFieldSearch();
            } else if (searchType.equals("Phone")) {
                addTextFieldSearch();
            } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) {
                addUserListSelectField();
            }
        }
    });

    layoutSearchPane.addComponent(group, 1, 0);
    layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER);
    addTextFieldSearch();

    Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            doSearch();
        }
    });
    layoutSearchPane.addComponent(searchBtn, 2, 0);
    layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER);
    this.setCompositionRoot(layoutSearchPane);
}