List of usage examples for com.vaadin.ui Button Button
public Button(Resource icon, ClickListener listener)
From source file:com.esofthead.mycollab.module.crm.view.contact.ContactOpportunitySelectionWindow.java
License:Open Source License
@Override protected void initUI() { tableItem = new OpportunityTableDisplay(OpportunityTableFieldDef.selected, Arrays.asList(OpportunityTableFieldDef.opportunityName, OpportunityTableFieldDef.saleStage, OpportunityTableFieldDef.expectedCloseDate)); Button selectBtn = new Button("Select", new Button.ClickListener() { @Override//w w w.jav a2 s. co m public void buttonClick(Button.ClickEvent event) { close(); } }); selectBtn.setStyleName(UIConstants.THEME_GREEN_LINK); OpportunitySimpleSearchPanel opportunitySimpleSearchPanel = new OpportunitySimpleSearchPanel(); opportunitySimpleSearchPanel.addSearchHandler(new SearchHandler<OpportunitySearchCriteria>() { @Override public void onSearch(OpportunitySearchCriteria criteria) { tableItem.setSearchCriteria(criteria); } }); this.bodyContent.addComponent(opportunitySimpleSearchPanel); this.bodyContent.addComponent(selectBtn); this.bodyContent.addComponent(tableItem); }
From source file:com.esofthead.mycollab.module.crm.view.contact.ContactSearchPanel.java
License:Open Source License
private HorizontalLayout createSearchTopPanel() { final MHorizontalLayout layout = new MHorizontalLayout().withStyleName(UIConstants.HEADER_VIEW) .withWidth("100%").withSpacing(true).withMargin(new MarginInfo(true, false, true, false)); final Label searchtitle = new CrmViewHeader(CrmTypeConstants.CONTACT, AppContext.getMessage(ContactI18nEnum.VIEW_LIST_TITLE)); searchtitle.setStyleName(UIConstants.HEADER_TEXT); layout.with(searchtitle).withAlign(searchtitle, Alignment.MIDDLE_LEFT).expand(searchtitle); final Button createBtn = new Button(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w ww .j av a 2s .com*/ public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new ContactEvent.GotoAdd(this, null)); } }); createBtn.setIcon(FontAwesome.PLUS); createBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT)); layout.with(createBtn).withAlign(createBtn, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.contact.ContactSelectionField.java
License:Open Source License
public ContactSelectionField() { contactName = new TextField(); contactName.setNullRepresentation(""); contactName.setWidth("100%"); browseBtn = new Button(null, FontAwesome.ELLIPSIS_H); browseBtn.addStyleName(UIConstants.THEME_GRAY_LINK); browseBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); browseBtn.addClickListener(new Button.ClickListener() { @Override//from w w w . j ava2s.c o m public void buttonClick(Button.ClickEvent clickEvent) { ContactSelectionWindow contactWindow = new ContactSelectionWindow(ContactSelectionField.this); UI.getCurrent().addWindow(contactWindow); contactWindow.show(); } }); clearBtn = new Button(null, FontAwesome.TRASH_O); clearBtn.addStyleName(UIConstants.THEME_GRAY_LINK); clearBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); clearBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { contactName.setValue(""); contact = null; } }); }
From source file:com.esofthead.mycollab.module.crm.view.CrmToolbar.java
License:Open Source License
public CrmToolbar() { super();//from w w w. j a va 2 s . c o m this.setStyleName("crm-toolbar"); this.setWidth("100%"); this.setMargin(new MarginInfo(false, true, false, true)); final NavigatorItemListener listener = new NavigatorItemListener(); final Button homeBtn = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_DASHBOARD_HEADER), listener); homeBtn.setStyleName("link"); addComponent(homeBtn); final Button accountList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_ACCOUNTS_HEADER), listener); accountList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_ACCOUNT)); accountList.setStyleName("link"); addComponent(accountList); final Button contactList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_CONTACTS_HEADER), listener); contactList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_CONTACT)); contactList.setStyleName("link"); addComponent(contactList); final Button campaignList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_CAMPAIGNS_HEADER), listener); campaignList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_CAMPAIGN)); campaignList.setStyleName("link"); addComponent(campaignList); final Button leadList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_LEADS_HEADER), listener); leadList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_LEAD)); leadList.setStyleName("link"); addComponent(leadList); final Button opportunityList = new Button( AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_OPPORTUNTIES_HEADER), listener); opportunityList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_OPPORTUNITY)); opportunityList.setStyleName("link"); addComponent(opportunityList); final Button caseList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_CASES_HEADER), listener); caseList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_CASE)); caseList.setStyleName("link"); addComponent(caseList); final Button activitiesList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_ACTIVITIES_HEADER), listener); final boolean isActivityEnable = AppContext.canRead(RolePermissionCollections.CRM_MEETING) || AppContext.canRead(RolePermissionCollections.CRM_TASK) || AppContext.canRead(RolePermissionCollections.CRM_CALL); activitiesList.setEnabled(isActivityEnable); activitiesList.setStyleName("link"); addComponent(activitiesList); addStyleName("h-sidebar-menu"); final Button fileBtn = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_DOCUMENT_HEADER), listener); fileBtn.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_DOCUMENT)); fileBtn.setStyleName("link"); addComponent(fileBtn); final Button notificationBtn = new Button( AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_CRMNOTIFICATION_HEADER), listener); notificationBtn.setStyleName("link"); addComponent(notificationBtn); addBtn = new PopupButton(AppContext.getMessage(CrmCommonI18nEnum.BUTTON_CREATE)); final GridLayout addBtnLayout = new GridLayout(3, 2); addBtnLayout.setMargin(true); addBtnLayout.setWidth("370px"); addBtnLayout.setSpacing(true); final ButtonLink newAccountBtn = new ButtonLink(AppContext.getMessage(AccountI18nEnum.BUTTON_NEW_ACCOUNT), listener, false); newAccountBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_ACCOUNT)); newAccountBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT)); addBtnLayout.addComponent(newAccountBtn); final ButtonLink newContactBtn = new ButtonLink(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT), listener, false); newContactBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT)); newContactBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT)); addBtnLayout.addComponent(newContactBtn); final ButtonLink newCampaignBtn = new ButtonLink( AppContext.getMessage(CampaignI18nEnum.BUTTON_NEW_CAMPAIGN), listener, false); newCampaignBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN)); newCampaignBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CAMPAIGN)); addBtnLayout.addComponent(newCampaignBtn); final ButtonLink newOpportunityBtn = new ButtonLink( AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY), listener, false); newOpportunityBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY)); newOpportunityBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY)); addBtnLayout.addComponent(newOpportunityBtn); final ButtonLink newLeadBtn = new ButtonLink(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD), listener, false); newLeadBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD)); newLeadBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD)); addBtnLayout.addComponent(newLeadBtn); final ButtonLink newCaseBtn = new ButtonLink(AppContext.getMessage(CaseI18nEnum.BUTTON_NEW_CASE), listener, false); newCaseBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CASE)); newCaseBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CASE)); addBtnLayout.addComponent(newCaseBtn); final ButtonLink newTaskBtn = new ButtonLink(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK), listener, false); newTaskBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_TASK)); newTaskBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.TASK)); addBtnLayout.addComponent(newTaskBtn); final ButtonLink newCallBtn = new ButtonLink(AppContext.getMessage(CallI18nEnum.BUTTON_NEW_CALL), listener, false); newCallBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL)); newCallBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CALL)); addBtnLayout.addComponent(newCallBtn); final ButtonLink newMeetingBtn = new ButtonLink(AppContext.getMessage(MeetingI18nEnum.BUTTON_NEW_MEETING), listener, false); newMeetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING)); newMeetingBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.MEETING)); addBtnLayout.addComponent(newMeetingBtn); addBtn.setContent(addBtnLayout); addBtn.setStyleName("link"); addBtn.addStyleName("quickadd-btn"); addComponent(addBtn); setExpandRatio(addBtn, 1.0f); setComponentAlignment(addBtn, Alignment.MIDDLE_RIGHT); }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadCampaignListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlBtnWrap = new VerticalLayout(); controlBtnWrap.setWidth("100%"); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined();//w w w .ja v a2 s. c om controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setCaption(AppContext.getMessage(CampaignI18nEnum.BUTTON_NEW_CAMPAIGN)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1099580202385205069L; @Override public void splitButtonClick(SplitButton.SplitButtonClickEvent event) { fireNewRelatedItem(""); } }); Button selectBtn = new Button("Select from existing campaigns", new Button.ClickListener() { private static final long serialVersionUID = 3046728004767791528L; @Override public void buttonClick(Button.ClickEvent event) { LeadCampaignSelectionWindow leadsWindow = new LeadCampaignSelectionWindow( LeadCampaignListComp.this); CampaignSearchCriteria criteria = new CampaignSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); UI.getCurrent().addWindow(leadsWindow); leadsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); } }); selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select)); selectBtn.setStyleName("link"); VerticalLayout buttonControlsLayout = new VerticalLayout(); buttonControlsLayout.addComponent(selectBtn); controlsBtn.setContent(buttonControlsLayout); controlBtnWrap.addComponent(controlsBtn); controlBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return controlBtnWrap; }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadCampaignSelectionWindow.java
License:Open Source License
@Override protected void initUI() { tableItem = new CampaignTableDisplay(CampaignTableFieldDef.selected, Arrays.asList(CampaignTableFieldDef.campaignname, CampaignTableFieldDef.status, CampaignTableFieldDef.type, CampaignTableFieldDef.endDate)); Button selectBtn = new Button("Select", new Button.ClickListener() { @Override//from w w w .ja v a 2 s . c o m public void buttonClick(Button.ClickEvent event) { close(); } }); selectBtn.setStyleName(UIConstants.THEME_GREEN_LINK); CampaignSimpleSearchPanel campaignSimpleSearchPanel = new CampaignSimpleSearchPanel(); campaignSimpleSearchPanel.addSearchHandler(new SearchHandler<CampaignSearchCriteria>() { @Override public void onSearch(CampaignSearchCriteria criteria) { tableItem.setSearchCriteria(criteria); } }); this.bodyContent.addComponent(campaignSimpleSearchPanel); this.bodyContent.addComponent(selectBtn); this.bodyContent.addComponent(tableItem); }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadConvertInfoWindow.java
License:Open Source License
private ComponentContainer createButtonControls() { final HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);// w ww . j a v a2 s . c om layout.setStyleName("addNewControl"); Button convertButton = new Button(AppContext.getMessage(LeadI18nEnum.BUTTON_CONVERT_LEAD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { LeadService leadService = ApplicationContextUtil.getSpringBean(LeadService.class); lead.setStatus("Converted"); leadService.updateWithSession(lead, AppContext.getUsername()); Opportunity opportunity = null; if (opportunityForm != null && opportunityForm.isVisible()) { if (opportunityForm.validateForm()) { opportunity = opportunityForm.getBean(); } } leadService.convertLead(lead, opportunity, AppContext.getUsername()); LeadConvertInfoWindow.this.close(); EventBusFactory.getInstance() .post(new LeadEvent.GotoRead(LeadConvertInfoWindow.this, lead.getId())); } }); convertButton.setStyleName(UIConstants.THEME_GREEN_LINK); layout.addComponent(convertButton); layout.setComponentAlignment(convertButton, Alignment.MIDDLE_CENTER); Button cancelButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { LeadConvertInfoWindow.this.close(); } }); cancelButton.setStyleName(UIConstants.THEME_GRAY_LINK); layout.addComponent(cancelButton); layout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadConvertReadViewImpl.java
License:Open Source License
@Override public void displayConvertLeadInfo(final SimpleLead lead) { previewForm.removeAllComponents();// w w w. ja v a2 s . c o m this.lead = lead; Label header = new Label("Conversion Details"); header.addStyleName("h2"); previewForm.addComponent(header); GridFormLayoutHelper layoutHelper = new GridFormLayoutHelper(1, 3); layoutHelper.getLayout().setWidth("100%"); layoutHelper.getLayout().setMargin(false); layoutHelper.getLayout().addStyleName("colored-gridlayout"); LOG.debug("Display associate account"); AccountService accountService = ApplicationContextUtil.getSpringBean(AccountService.class); final SimpleAccount account = accountService.findAccountAssoWithConvertedLead(lead.getId(), AppContext.getAccountId()); if (account != null) { Button accountLink = new Button(account.getAccountname(), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new AccountEvent.GotoRead(this, account.getId())); } }); accountLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT)); accountLink.setStyleName("link"); layoutHelper.addComponent(accountLink, "Account", 0, 0); } else { layoutHelper.addComponent(new Label(""), "Account", 0, 0); } LOG.debug("Display associate contact"); ContactService contactService = ApplicationContextUtil.getSpringBean(ContactService.class); final SimpleContact contact = contactService.findContactAssoWithConvertedLead(lead.getId(), AppContext.getAccountId()); if (contact != null) { Button contactLink = new Button(contact.getContactName(), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new ContactEvent.GotoRead(this, contact.getId())); } }); contactLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT)); contactLink.setStyleName("link"); layoutHelper.addComponent(contactLink, "Contact", 0, 1); } else { layoutHelper.addComponent(new Label(""), "Contact", 0, 1); } LOG.debug("Display associate opportunity"); OpportunityService opportunityService = ApplicationContextUtil.getSpringBean(OpportunityService.class); final SimpleOpportunity opportunity = opportunityService.findOpportunityAssoWithConvertedLead(lead.getId(), AppContext.getAccountId()); if (opportunity != null) { Button opportunityLink = new Button(opportunity.getOpportunityname(), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new OpportunityEvent.GotoRead(this, opportunity.getId())); } }); opportunityLink.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY)); opportunityLink.setStyleName("link"); layoutHelper.addComponent(opportunityLink, "Opportunity", 0, 2); } else { layoutHelper.addComponent(new Label(""), "Opportunity", 0, 2); } previewForm.addComponent(layoutHelper.getLayout()); previewLayout.addBody(previewContent); this.addComponent(previewItemContainer); }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadListDashlet.java
License:Open Source License
public LeadListDashlet() { super("My Leads", new VerticalLayout()); tableItem = new LeadTableDisplay( Arrays.asList(LeadTableFieldDef.name, LeadTableFieldDef.email, LeadTableFieldDef.phoneoffice)); tableItem.addTableListener(new TableClickListener() { @Override/*ww w .java 2 s . c o m*/ public void itemClick(final TableClickEvent event) { final SimpleLead lead = (SimpleLead) event.getData(); if ("leadName".equals(event.getFieldName())) { EventBusFactory.getInstance().post(new LeadEvent.GotoRead(LeadListDashlet.this, lead.getId())); } } }); bodyContent.addComponent(tableItem); Button customizeViewBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new LeadListCustomizeWindow(LeadListDashlet.VIEW_DEF_ID, tableItem)); } }); customizeViewBtn.setIcon(FontAwesome.ADJUST); customizeViewBtn.setDescription("Layout Options"); customizeViewBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); this.addHeaderElement(customizeViewBtn); }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadListNoItemView.java
License:Open Source License
public LeadListNoItemView() { VerticalLayout layout = new VerticalLayout(); layout.addStyleName("case-noitem"); layout.setWidth("800px"); layout.setSpacing(true);/*from ww w. j av a 2 s .c o m*/ layout.setDefaultComponentAlignment(Alignment.TOP_CENTER); layout.setMargin(true); Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/lead.png")); layout.addComponent(image); Label title = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_TITLE)); title.addStyleName("h2"); title.setWidthUndefined(); layout.addComponent(title); Label body = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_HINT)); body.setWidthUndefined(); layout.addComponent(body); Button btCreateContact = new Button("New Lead", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new LeadEvent.GotoAdd(this, null)); } }); HorizontalLayout links = new HorizontalLayout(); links.addComponent(btCreateContact); btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK); /* * Label or = new Label("Or"); or.setStyleName("h2"); * links.addComponent(or); * * Button btImportContact = new Button("Import Leads", new * Button.ClickListener() { private static final long serialVersionUID = * 1L; * * @Override public void buttonClick(ClickEvent arg0) { * UI.getCurrent().addWindow(new CaseImportWindow()); } }); * * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK); * * * links.addComponent(btImportContact); */ links.setSpacing(true); layout.addComponent(links); this.addComponent(layout); this.setComponentAlignment(layout, Alignment.TOP_CENTER); }