List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:com.esofthead.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 a2s . c o m final ValueComboBox 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.THEME_GREEN_LINK); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { searchCriteria = new ContactSearchCriteria(); searchCriteria.setSaccountid(new NumberSearchField(SearchField.AND, AppContext.getAccountId())); String searchType = (String) group.getValue(); if (StringUtils.isNotBlank(searchType)) { if (textValueField != null) { String strSearch = textValueField.getValue(); if (StringUtils.isNotBlank(strSearch)) { if (searchType.equals("Name")) { searchCriteria.setContactName(new StringSearchField(SearchField.AND, strSearch)); } else if (searchType.equals("Email")) { searchCriteria.setAnyEmail(new StringSearchField(SearchField.AND, strSearch)); } else if (searchType.equals("Phone")) { searchCriteria.setAnyPhone(new StringSearchField(SearchField.AND, strSearch)); } } } if (userBox != null) { String user = (String) userBox.getValue(); if (StringUtils.isNotBlank(user)) { searchCriteria.setAssignUsers( new SetSearchField<String>(SearchField.AND, new String[] { user })); } } } ContactSimpleSearchPanel.this.notifySearchHandler(searchCriteria); } }); layoutSearchPane.addComponent(searchBtn, 2, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }
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();/*from ww w. j a v a2 s . c o m*/ 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.LeadConvertReadViewImpl.java
License:Open Source License
@Override public void displayConvertLeadInfo(final SimpleLead lead) { previewForm.removeAllComponents();//from w w w .j a va 2s.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//from w ww. ja v a 2s. 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.LeadReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createButtonControls() { CrmPreviewFormControlsGenerator<SimpleLead> controlsButton = new CrmPreviewFormControlsGenerator<>( previewForm);/*w ww .j ava 2s.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// w w w . j ava2 s. co 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.lead.LeadSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 3); layoutSearchPane.setSpacing(true);//from ww w . j a v a 2 s .c o m final ValueComboBox group = new ValueComboBox(false, "Name", "Email", "Phone", AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)); group.select("Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @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.THEME_GREEN_LINK); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { searchCriteria = new LeadSearchCriteria(); searchCriteria.setSaccountid(new NumberSearchField(SearchField.AND, AppContext.getAccountId())); String searchType = (String) group.getValue(); if (StringUtils.isNotBlank(searchType)) { if (textValueField != null) { String strSearch = textValueField.getValue(); if (StringUtils.isNotBlank(strSearch)) { if (searchType.equals("Name")) { searchCriteria.setLeadName(new StringSearchField(SearchField.AND, strSearch)); } } } if (userBox != null) { String user = (String) userBox.getValue(); if (StringUtils.isNotBlank(user)) { searchCriteria .setAssignUsers(new SetSearchField<>(SearchField.AND, new String[] { user })); } } } LeadSimpleSearchPanel.this.notifySearchHandler(searchCriteria); } }); layoutSearchPane.addComponent(searchBtn, 2, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }
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 ww w. j av a 2 s. c o m 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);/*www . j a va 2 s . com*/ 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();/* ww w .ja va2 s .co 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; }