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.lead.LeadReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createButtonControls() { CrmPreviewFormControlsGenerator<SimpleLead> controlsButton = new CrmPreviewFormControlsGenerator<>( previewForm);// w ww . j av a2s .c o m 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) { previewForm.fireExtraAction("convert", beanItem); } }); convertButton.setStyleName(UIConstants.THEME_GREEN_LINK); convertButton.setIcon(FontAwesome.FLASK); controlsButton.insertToControlBlock(convertButton); return controlsButton.createButtonControls(RolePermissionCollections.CRM_LEAD); }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadSearchPanel.java
License:Open Source License
private HorizontalLayout createSearchTopPanel() { final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true) .withMargin(new MarginInfo(true, false, true, false)).withStyleName(UIConstants.HEADER_VIEW); final Label searchtitle = new CrmViewHeader(CrmTypeConstants.LEAD, AppContext.getMessage(LeadI18nEnum.VIEW_LIST_TITLE)); searchtitle.setStyleName(UIConstants.HEADER_TEXT); layout.with(searchtitle).withAlign(searchtitle, Alignment.MIDDLE_LEFT).expand(searchtitle); final Button createAccountBtn = new Button(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD), new Button.ClickListener() { @Override//from ww w . j a v a 2s . c o m public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new LeadEvent.GotoAdd(this, null)); } }); createAccountBtn.setIcon(FontAwesome.PLUS); createAccountBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createAccountBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD)); layout.with(createAccountBtn).withAlign(createAccountBtn, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.ContactRoleEditViewImpl.java
License:Open Source License
@Override public void display(SimpleOpportunity opportunity) { this.opportunity = opportunity; this.removeAllComponents(); this.setMargin(new MarginInfo(false, true, true, true)); this.addStyleName("oppcontact-role-edit"); AddViewLayout2 previewLayout = new AddViewLayout2("Add or Edit Contact Roles", CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT)); this.addComponent(previewLayout); ComponentContainer actionControls = createButtonControls(); if (actionControls != null) { previewLayout.addControlButtons(actionControls); }//from w w w .j a v a 2s .c om contactRoleList = new ContactOpportunityList(); previewLayout.addBody(contactRoleList); Button addMoreContactRolesBtn = new Button("Add more contact roles", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { SimpleContactOpportunityRel contactRole = new SimpleContactOpportunityRel(); ContactRoleRowComp row = new ContactRoleRowComp(contactRole); contactRoleList.addRow(row); } }); addMoreContactRolesBtn.setStyleName(UIConstants.THEME_GREEN_LINK); HorizontalLayout buttonControls = new HorizontalLayout(); buttonControls.addComponent(addMoreContactRolesBtn); buttonControls.setMargin(new MarginInfo(true, true, true, true)); previewLayout.addBody(buttonControls); }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.ContactRoleEditViewImpl.java
License:Open Source License
private ComponentContainer createButtonControls() { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);//from w w w . jav a 2 s . c om layout.setMargin(true); HorizontalLayout buttonWrapper = new HorizontalLayout(); buttonWrapper.setWidthUndefined(); buttonWrapper.setSpacing(true); Button updateBtn = new Button("Update", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { updateContactRoles(); } }); updateBtn.setIcon(FontAwesome.SAVE); updateBtn.setStyleName(UIConstants.THEME_GREEN_LINK); buttonWrapper.addComponent(updateBtn); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ViewState viewState = HistoryViewManager.back(); if (viewState instanceof NullViewState) { EventBusFactory.getInstance().post(new ContactEvent.GotoList(this, null)); } } }); cancelBtn.setIcon(FontAwesome.TIMES); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); buttonWrapper.addComponent(cancelBtn); layout.addComponent(buttonWrapper); layout.setComponentAlignment(buttonWrapper, Alignment.MIDDLE_CENTER); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityContactListComp.java
License:Open Source License
@Override protected Component generateTopControls() { HorizontalLayout controlsBtnWrap = new HorizontalLayout(); controlsBtnWrap.setWidth("100%"); HorizontalLayout notesWrap = new HorizontalLayout(); notesWrap.setWidth("100%"); notesWrap.setSpacing(true);//from w w w . j a v a 2 s . c o m Label noteLbl = new Label("Note: "); noteLbl.setSizeUndefined(); noteLbl.setStyleName("list-note-lbl"); notesWrap.addComponent(noteLbl); CssLayout noteBlock = new CssLayout(); noteBlock.setWidth("100%"); noteBlock.setStyleName("list-note-block"); for (int i = 0; i < CrmDataTypeFactory.getOpportunityContactRoleList().length; i++) { Label note = new Label(CrmDataTypeFactory.getOpportunityContactRoleList()[i]); note.setStyleName("note-label"); note.addStyleName(colormap.get(CrmDataTypeFactory.getOpportunityContactRoleList()[i])); note.setSizeUndefined(); noteBlock.addComponent(note); } notesWrap.addComponent(noteBlock); notesWrap.setExpandRatio(noteBlock, 1.0f); controlsBtnWrap.addComponent(notesWrap); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined(); controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setCaption("Add/Edit Contacts' Role"); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1L; @Override public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) { EventBusFactory.getInstance().post(new OpportunityEvent.GotoContactRoleEdit(this, opportunity)); } }); final Button selectBtn = new Button("Select from existing contacts", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final OpportunityContactSelectionWindow contactsWindow = new OpportunityContactSelectionWindow( OpportunityContactListComp.this); final ContactSearchCriteria criteria = new ContactSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); UI.getCurrent().addWindow(contactsWindow); contactsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); } }); selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select)); selectBtn.setStyleName("link"); VerticalLayout buttonControlLayout = new VerticalLayout(); buttonControlLayout.addComponent(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return controlsBtnWrap; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityLeadListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlsBtnWrap = new VerticalLayout(); controlsBtnWrap.setWidth("100%"); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined();/*from w w w . j a v a2 s . c o m*/ controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setCaption(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1L; @Override public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) { fireNewRelatedItem(""); } }); final Button selectBtn = new Button("Select from existing leads", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final OpportunityLeadSelectionWindow leadsWindow = new OpportunityLeadSelectionWindow( OpportunityLeadListComp.this); final LeadSearchCriteria criteria = new LeadSearchCriteria(); 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 buttonControlLayout = new VerticalLayout(); buttonControlLayout.addComponent(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return controlsBtnWrap; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityLeadSelectionWindow.java
License:Open Source License
@Override protected void initUI() { tableItem = new LeadTableDisplay(LeadTableFieldDef.selected, Arrays.asList(LeadTableFieldDef.name, LeadTableFieldDef.status, LeadTableFieldDef.email, LeadTableFieldDef.phoneoffice)); Button selectBtn = new Button("Select", new Button.ClickListener() { @Override/*w ww .j a v a 2 s . c om*/ public void buttonClick(Button.ClickEvent event) { close(); } }); selectBtn.setStyleName(UIConstants.THEME_GREEN_LINK); LeadSimpleSearchPanel leadSimpleSearchPanel = new LeadSimpleSearchPanel(); leadSimpleSearchPanel.addSearchHandler(new SearchHandler<LeadSearchCriteria>() { @Override public void onSearch(LeadSearchCriteria criteria) { tableItem.setSearchCriteria(criteria); } }); this.bodyContent.addComponent(leadSimpleSearchPanel); this.bodyContent.addComponent(selectBtn); this.bodyContent.addComponent(tableItem); }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityListNoItemView.java
License:Open Source License
public OpportunityListNoItemView() { VerticalLayout layout = new VerticalLayout(); layout.addStyleName("case-noitem"); layout.setWidth("800px"); layout.setSpacing(true);//from www . java 2 s . c o m layout.setDefaultComponentAlignment(Alignment.TOP_CENTER); layout.setMargin(true); Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/opportunity.png")); layout.addComponent(image); Label title = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_TITLE)); title.addStyleName("h2"); title.setWidthUndefined(); layout.addComponent(title); Label body = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_HINT)); body.setWidthUndefined(); layout.addComponent(body); Button btCreateContact = new Button(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new OpportunityEvent.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); }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunitySearchPanel.java
License:Open Source License
private HorizontalLayout createSearchTopPanel() { final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true) .withMargin(new MarginInfo(true, false, true, false)).withStyleName(UIConstants.HEADER_VIEW); final Label searchtitle = new CrmViewHeader(CrmTypeConstants.OPPORTUNITY, AppContext.getMessage(OpportunityI18nEnum.VIEW_LIST_TITLE)); searchtitle.setStyleName(UIConstants.HEADER_TEXT); layout.with(searchtitle).expand(searchtitle).withAlign(searchtitle, Alignment.MIDDLE_LEFT); final Button createAccountBtn = new Button( AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/* w ww .ja v a 2 s . co m*/ public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance() .post(new OpportunityEvent.GotoAdd(OpportunitySearchPanel.this, null)); } }); createAccountBtn.setIcon(FontAwesome.PLUS); createAccountBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createAccountBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY)); layout.with(createAccountBtn).withAlign(createAccountBtn, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.SalesDashboardView.java
License:Open Source License
private void initUI() { final PopupButton saleChartPopup = new PopupButton(""); saleChartPopup.addStyleName("popuplistindicator"); final VerticalLayout filterBtnLayout = new VerticalLayout(); filterBtnLayout.setMargin(true);/*from w ww.ja v a 2 s . c o m*/ filterBtnLayout.setSpacing(true); filterBtnLayout.setWidth("200px"); final Button btnOpportunitySales = new Button("Opportunity Sales Stage", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { saleChartPopup.setPopupVisible(false); SalesDashboardView.this.currentReportIndex = 0; SalesDashboardView.this.displayReport(); } }); btnOpportunitySales.setStyleName("link"); filterBtnLayout.addComponent(btnOpportunitySales); final Button btnOpportunityLead = new Button("Opportunity Lead Source", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { saleChartPopup.setPopupVisible(false); SalesDashboardView.this.currentReportIndex = 1; SalesDashboardView.this.displayReport(); } }); btnOpportunityLead.setStyleName("link"); filterBtnLayout.addComponent(btnOpportunityLead); this.displayReport(); saleChartPopup.setContent(filterBtnLayout); this.addHeaderElement(saleChartPopup); }