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.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);//  w  ww  . ja  v a2s.  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.campaign.CampaignRelatedAccountView.java

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addAccount = new NavigationBarQuickMenu();
    addAccount.setStyleName("add-btn");

    VerticalLayout addButtons = new VerticalLayout();
    addButtons.setSpacing(true);//from   w w w.  ja v  a  2s. co  m
    addButtons.setWidth("100%");
    addButtons.setMargin(true);
    addButtons.addStyleName("edit-btn-layout");

    Button newAccount = new Button(AppContext.getMessage(AccountI18nEnum.VIEW_NEW_TITLE));
    newAccount.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addButtons.addComponent(newAccount);

    Button selectAccount = new Button(AppContext.getMessage(AccountI18nEnum.M_TITLE_SELECT_ACCOUNTS));
    selectAccount.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 270503987054356318L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            CampaignAccountSelectionView accountSelectionView = new CampaignAccountSelectionView(
                    CampaignRelatedAccountView.this);
            AccountSearchCriteria criteria = new AccountSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            accountSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(CampaignRelatedAccountView.this, accountSelectionView));
        }
    });
    addButtons.addComponent(selectAccount);

    addAccount.setContent(addButtons);

    return addAccount;
}

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

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addContact = new NavigationBarQuickMenu();
    addContact.setStyleName("add-btn");

    VerticalLayout addButtons = new VerticalLayout();
    addButtons.setWidth("100%");
    addButtons.setSpacing(true);/*from   ww  w  .j  ava2s .c  om*/
    addButtons.setMargin(true);
    addButtons.setStyleName("edit-btn-layout");

    Button newContact = new Button(AppContext.getMessage(ContactI18nEnum.VIEW_NEW_TITLE));
    newContact.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addButtons.addComponent(newContact);

    Button selectContact = new Button(AppContext.getMessage(ContactI18nEnum.M_TITLE_SELECT_CONTACTS));
    selectContact.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -429296782998301810L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            CampaignContactSelectionView contactSelectionView = new CampaignContactSelectionView(
                    CampaignRelatedContactView.this);
            ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            contactSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(CampaignRelatedContactView.this, contactSelectionView));
        }
    });
    addButtons.addComponent(selectContact);

    addContact.setContent(addButtons);

    return addContact;
}

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

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addLead = new NavigationBarQuickMenu();
    addLead.setStyleName("add-btn");

    VerticalLayout addBtns = new VerticalLayout();
    addBtns.setWidth("100%");
    addBtns.setSpacing(true);/*from w w w .  j a va 2s  . c  o m*/
    addBtns.setMargin(true);
    addBtns.setStyleName("edit-btn-layout");

    Button newLead = new Button(AppContext.getMessage(LeadI18nEnum.VIEW_NEW_TITLE));
    newLead.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addBtns.addComponent(newLead);

    Button selectLead = new Button(AppContext.getMessage(LeadI18nEnum.M_TITLE_SELECT_LEADS));
    selectLead.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8749458276290086097L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            CampaignLeadSelectionView leadSelectionView = new CampaignLeadSelectionView(
                    CampaignRelatedLeadView.this);
            LeadSearchCriteria criteria = new LeadSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            leadSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(CampaignRelatedLeadView.this, leadSelectionView));
        }
    });
    addBtns.addComponent(selectLead);

    addLead.setContent(addBtns);

    return addLead;
}

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

License:Open Source License

@Override
protected Component createRightComponent() {
    Button addCase = new Button();
    addCase.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//  w ww .  j  a va  2s.  c  o m
        public void buttonClick(Button.ClickEvent arg0) {
            EventBusFactory.getInstance().post(new CaseEvent.GotoAdd(this, null));
        }
    });
    addCase.setStyleName("add-btn");
    return addCase;
}

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   ww w .ja v a  2  s .  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;
}

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

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addContact = new NavigationBarQuickMenu();
    addContact.setStyleName("add-btn");

    VerticalLayout addBtns = new VerticalLayout();
    addBtns.setWidth("100%");
    addBtns.setSpacing(true);//from  ww w.ja  v  a2s. co  m
    addBtns.setMargin(true);
    addBtns.setStyleName("edit-btn-layout");

    Button newContact = new Button(AppContext.getMessage(ContactI18nEnum.VIEW_NEW_TITLE));
    newContact.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            fireNewRelatedItem("");
        }
    });
    addBtns.addComponent(newContact);

    Button selectContact = new Button(AppContext.getMessage(ContactI18nEnum.M_TITLE_SELECT_CONTACTS));
    selectContact.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 5491307760254926146L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            CaseContactSelectionView contactSelectionView = new CaseContactSelectionView(
                    CaseRelatedContactView.this);
            ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            contactSelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.PushView(CaseRelatedContactView.this, contactSelectionView));
        }
    });
    addBtns.addComponent(selectContact);

    addContact.setContent(addBtns);

    return addContact;
}

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

License:Open Source License

@Override
protected Component createRightComponent() {
    Button addContact = new Button();
    addContact.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/*from  w w w  .  j  av  a2s  . c o m*/
        public void buttonClick(Button.ClickEvent arg0) {
            EventBusFactory.getInstance().post(new ContactEvent.GotoAdd(this, null));
        }
    });
    addContact.setStyleName("add-btn");
    return addContact;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.contact.ContactReadViewImpl.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 av  a 2 s .  c  o  m

    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 ContactEvent.GoToRelatedItems(this,
                    new CrmRelatedItemsScreenData(associateOpportunityList)));
        }
    });

    toolbarLayout.addComponent(relatedOpportunities);

    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 evt) {
            EventBusFactory.getInstance().post(
                    new ContactEvent.GoToRelatedItems(this, new CrmRelatedItemsScreenData(noteListItems)));
        }
    });
    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 evt) {
            EventBusFactory.getInstance().post(new ContactEvent.GoToRelatedItems(this,
                    new CrmRelatedItemsScreenData(associateActivityList)));
        }
    });
    toolbarLayout.addComponent(relatedActivities);

    return toolbarLayout;
}

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

License:Open Source License

@Override
protected Component createRightComponent() {
    final NavigationBarQuickMenu addOpportunity = new NavigationBarQuickMenu();
    addOpportunity.setStyleName("add-btn");

    VerticalLayout addBtns = new VerticalLayout();
    addBtns.setStyleName("edit-btn-layout");
    addBtns.setWidth("100%");
    addBtns.setSpacing(true);//  w  w  w.ja  v a  2s.c  o m
    addBtns.setMargin(true);

    Button newOpportunity = new Button(AppContext.getMessage(OpportunityI18nEnum.VIEW_NEW_TITLE));
    newOpportunity.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 7172838996944732255L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            fireNewRelatedItem("");
        }
    });
    addBtns.addComponent(newOpportunity);

    Button selectOpportunity = new Button(
            AppContext.getMessage(OpportunityI18nEnum.M_TITLE_SELECT_OPPORTUNITIES));
    selectOpportunity.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8732749124902402042L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            ContactOpportunitySelectionView opportunitySelectionView = new ContactOpportunitySelectionView(
                    ContactRelatedOpportunityView.this);
            OpportunitySearchCriteria criteria = new OpportunitySearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            opportunitySelectionView.setSearchCriteria(criteria);
            EventBusFactory.getInstance().post(
                    new ShellEvent.PushView(ContactRelatedOpportunityView.this, opportunitySelectionView));
        }
    });
    addBtns.addComponent(selectOpportunity);

    addOpportunity.setContent(addBtns);

    return addOpportunity;
}