List of usage examples for com.vaadin.ui Button setStyleName
@Override public void setStyleName(String style)
From source file:com.esofthead.mycollab.module.crm.view.CrmToolbar.java
License:Open Source License
public CrmToolbar() { super();/*from ww w . ja v a 2 s. co 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();//from www. 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.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 .j a v a 2s. com*/ 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);/*from w w w. j a va2 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();/*from w ww . jav a 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// w ww. j a v a 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.LeadReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createButtonControls() { CrmPreviewFormControlsGenerator<SimpleLead> controlsButton = new CrmPreviewFormControlsGenerator<>( previewForm);//from ww w .j a v a 2 s .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/* ww w .ja v a 2 s . c om*/ 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 . ja v a 2 s. c om*/ 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
@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 ava 2s. c o m*/ 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); }