List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:com.mechanicshop.components.MaintenanceLayout.java
private void buildLayout() { HorizontalLayout layoutTitle = new HorizontalLayout(); layoutTitle.setSizeUndefined();//from w w w . j a v a 2 s. c o m layoutTitle.setWidth("100%"); layoutTitle.setSpacing(false); layoutTitle.setMargin(false); titleLabel.addStyleName(ValoTheme.LABEL_H2); titleLabel.addStyleName(ValoTheme.LABEL_COLORED); titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); titleLabel.setSizeUndefined(); layoutTitle.addComponent(titleLabel); layoutTitle.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER); VerticalLayout layoutTable = new VerticalLayout(); layoutTable.setSizeFull(); layoutTable.setSpacing(true); HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.setMargin(false); layoutButtons.setSpacing(true); layoutButtons.setSizeUndefined(); Button passwordBtn = new Button("Edit Password"); passwordBtn.addClickListener(passwordListener); passwordBtn.setImmediate(true); passwordBtn.setIcon(FontAwesome.EDIT); passwordBtn.setStyleName(ValoTheme.BUTTON_TINY); Button media1Btn = new Button("Media 1 Default Text"); media1Btn.setStyleName(ValoTheme.BUTTON_TINY); media1Btn.setImmediate(true); media1Btn.setIcon(FontAwesome.EDIT); media1Btn.addClickListener(media1Listener); Button media2Btn = new Button("Media 2 Default Text"); media2Btn.setStyleName(ValoTheme.BUTTON_TINY); media2Btn.setImmediate(true); media2Btn.setIcon(FontAwesome.EDIT); media2Btn.addClickListener(media2Listener); layoutButtons.addComponents(passwordBtn, media1Btn, media2Btn); layoutButtons.setComponentAlignment(passwordBtn, Alignment.MIDDLE_LEFT); layoutButtons.setComponentAlignment(media1Btn, Alignment.MIDDLE_LEFT); layoutButtons.setComponentAlignment(media2Btn, Alignment.MIDDLE_LEFT); addComponent(layoutTitle); addComponent(layoutTable); layoutTable.addComponent(layoutButtons); layoutTable.addComponent(table); layoutTable.setComponentAlignment(table, Alignment.TOP_CENTER); layoutTable.setExpandRatio(table, 3); setComponentAlignment(layoutTitle, Alignment.TOP_CENTER); setComponentAlignment(layoutTable, Alignment.TOP_CENTER); setExpandRatio(layoutTable, 3); setSpacing(true); setMargin(true); }
From source file:com.mechanicshop.components.MaintenanceLayout.java
private void customizeTable() { table.setSizeFull();/*w w w . j a v a 2 s. c o m*/ table.setSortEnabled(true); table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_SMALL); table.setEditable(true); table.setImmediate(true); table.addGeneratedColumn(" ", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button icon = new Button(); icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY); icon.addStyleName(ValoTheme.BUTTON_TINY); icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); icon.setVisible(true); icon.setImmediate(true); icon.setDescription("Details"); icon.setIcon(FontAwesome.PENCIL); icon.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Item item = source.getItem(itemId); showDataEntryWindow(item); } }); return icon; } }); }
From source file:com.mechanicshop.components.TableLayout.java
private void customizeTable() { table.setSizeFull();// w w w .j a v a 2 s. c om table.setSortEnabled(true); table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_SMALL); table.setEditable(true); table.setImmediate(true); table.setSizeFull(); table.addGeneratedColumn("", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, final Object itemId, Object columnId) { boolean selected = false; final CheckBox cb = new CheckBox("", selected); cb.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (selectedItemIds.contains(itemId)) { selectedItemIds.remove(itemId); } else { if (cb.getValue() != false) { selectedItemIds.add(itemId); } } } }); return cb; } }); table.addGeneratedColumn(" ", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button icon = new Button(); icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY); icon.addStyleName(ValoTheme.BUTTON_TINY); icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); icon.setVisible(true); icon.setImmediate(true); icon.setDescription("Details"); icon.setIcon(FontAwesome.PENCIL); icon.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Item item = source.getItem(itemId); dataEntryLayout.fillDataEntry(item, titleLabel.getValue()); getUI().addWindow(dataEntryLayout); } }); return icon; } }); }
From source file:com.mycollab.mobile.module.crm.ui.RelatedReadItemField.java
License:Open Source License
@Override protected Component initContent() { try {/* w w w . j a va 2s. c o m*/ final String type = (String) PropertyUtils.getProperty(RelatedReadItemField.this.bean, "type"); if (type == null || type.equals("")) { return new Label(""); } final Integer typeid = (Integer) PropertyUtils.getProperty(bean, "typeid"); if (typeid == null) { return new Label(""); } Resource relatedLink = null; String relateItemName = null; if ("Account".equals(type)) { AccountService accountService = AppContextUtil.getSpringBean(AccountService.class); final SimpleAccount account = accountService.findById(typeid, MyCollabUI.getAccountId()); if (account != null) { relateItemName = account.getAccountname(); relatedLink = new ExternalResource( StorageFactory.generateAssetRelativeLink("icons/16/crm/account.png")); } } else if ("Campaign".equals(type)) { CampaignService campaignService = AppContextUtil.getSpringBean(CampaignService.class); final SimpleCampaign campaign = campaignService.findById(typeid, MyCollabUI.getAccountId()); if (campaign != null) { relateItemName = campaign.getCampaignname(); relatedLink = new ExternalResource( StorageFactory.generateAssetRelativeLink("icons/16/crm/campaign.png")); } } else if ("Contact".equals(type)) { ContactService contactService = AppContextUtil.getSpringBean(ContactService.class); final SimpleContact contact = contactService.findById(typeid, MyCollabUI.getAccountId()); if (contact != null) { relateItemName = contact.getContactName(); relatedLink = new ExternalResource( StorageFactory.generateAssetRelativeLink("icons/16/crm/contact.png")); } } else if ("Lead".equals(type)) { LeadService leadService = AppContextUtil.getSpringBean(LeadService.class); final SimpleLead lead = leadService.findById(typeid, MyCollabUI.getAccountId()); if (lead != null) { relateItemName = lead.getLeadName(); relatedLink = new ExternalResource( StorageFactory.generateAssetRelativeLink("icons/16/crm/lead.png")); } } else if ("Opportunity".equals(type)) { OpportunityService opportunityService = AppContextUtil.getSpringBean(OpportunityService.class); final SimpleOpportunity opportunity = opportunityService.findById(typeid, MyCollabUI.getAccountId()); if (opportunity != null) { relateItemName = opportunity.getOpportunityname(); relatedLink = new ExternalResource( StorageFactory.generateAssetRelativeLink("icons/16/crm/opportunity.png")); } } else if ("Case".equals(type)) { CaseService caseService = AppContextUtil.getSpringBean(CaseService.class); final SimpleCase cases = caseService.findById(typeid, MyCollabUI.getAccountId()); if (cases != null) { relateItemName = cases.getSubject(); relatedLink = new ExternalResource( StorageFactory.generateAssetRelativeLink("icons/16/crm/case.png")); } } Button related = new Button(relateItemName); if (relatedLink != null) related.setIcon(relatedLink); if (relatedLink != null) { return related; } else { return new Label(""); } } catch (Exception e) { return new Label(""); } }
From source file:com.mycollab.mobile.module.project.view.AllActivityViewImpl.java
License:Open Source License
@Override protected void buildNavigateMenu() { addSection("Views:"); // Buttons with styling (slightly smaller with left-aligned text) Button activityBtn = new Button("Activities", clickEvent -> { closeMenu();//w w w .j a v a 2 s . c o m EventBusFactory.getInstance().post(new ProjectEvent.AllActivities(this)); }); activityBtn.setIcon(FontAwesome.INBOX); addMenuItem(activityBtn); Button prjBtn = new Button(UserUIContext.getMessage(ProjectI18nEnum.LIST), clickEvent -> { closeMenu(); EventBusFactory.getInstance().post(new ProjectEvent.GotoProjectList(this, null)); }); prjBtn.setIcon(FontAwesome.BUILDING); addMenuItem(prjBtn); addSection("Settings:"); Button logoutBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), clickEvent -> { closeMenu(); EventBusFactory.getInstance().post(new ShellEvent.LogOut(this)); }); logoutBtn.setIcon(FontAwesome.SIGN_OUT); addMenuItem(logoutBtn); }
From source file:com.mycollab.module.crm.view.account.AccountSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPanel = new GridLayout(3, 3); layoutSearchPanel.setSpacing(true);/*from w w w .j a v a 2s.c o m*/ group = new ValueComboBox(false, "Name", "Email", "Website", "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("Website")) { addTextFieldSearch(); } else if (searchType.equals("Phone")) { addTextFieldSearch(); } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) { addUserListSelectField(); } } }); layoutSearchPanel.addComponent(group, 1, 0); layoutSearchPanel.setComponentAlignment(group, Alignment.MIDDLE_CENTER); addTextFieldSearch(); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.BUTTON_ACTION); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.setDescription("Search"); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { doSearch(); } }); layoutSearchPanel.addComponent(searchBtn, 2, 0); layoutSearchPanel.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPanel); }
From source file:com.mycollab.module.crm.view.campaign.CampaignAccountListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlsBtnWrap = new VerticalLayout(); controlsBtnWrap.setWidth("100%"); if (UserUIContext.canWrite(RolePermissionCollections.CRM_ACCOUNT)) { final SplitButton controlsBtn = new SplitButton(); controlsBtn.addStyleName(WebThemes.BUTTON_ACTION); controlsBtn.setCaption(UserUIContext.getMessage(AccountI18nEnum.NEW)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(event -> fireNewRelatedItem("")); final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {//from w w w . j a v a 2 s . c o m final CampaignAccountSelectionWindow accountsWindow = new CampaignAccountSelectionWindow( CampaignAccountListComp.this); final AccountSearchCriteria criteria = new AccountSearchCriteria(); criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId())); UI.getCurrent().addWindow(accountsWindow); accountsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); }); selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT)); OptionPopupContent buttonControlLayout = new OptionPopupContent(); buttonControlLayout.addOption(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); } return controlsBtnWrap; }
From source file:com.mycollab.module.crm.view.campaign.CampaignContactListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlsBtnWrap = new VerticalLayout(); controlsBtnWrap.setWidth("100%"); if (UserUIContext.canWrite(RolePermissionCollections.CRM_CONTACT)) { final SplitButton controlsBtn = new SplitButton(); controlsBtn.addStyleName(WebThemes.BUTTON_ACTION); controlsBtn.setCaption(UserUIContext.getMessage(ContactI18nEnum.NEW)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(event -> fireNewRelatedItem("")); final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {//www . j a v a 2 s .c o m final CampaignContactSelectionWindow contactsWindow = new CampaignContactSelectionWindow( CampaignContactListComp.this); final ContactSearchCriteria criteria = new ContactSearchCriteria(); criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId())); UI.getCurrent().addWindow(contactsWindow); contactsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); }); selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT)); OptionPopupContent buttonControlLayout = new OptionPopupContent(); buttonControlLayout.addOption(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); } return controlsBtnWrap; }
From source file:com.mycollab.module.crm.view.campaign.CampaignLeadListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlsBtnWrap = new VerticalLayout(); controlsBtnWrap.setWidth("100%"); if (UserUIContext.canWrite(RolePermissionCollections.CRM_LEAD)) { final SplitButton controlsBtn = new SplitButton(); controlsBtn.addStyleName(WebThemes.BUTTON_ACTION); controlsBtn.setCaption(UserUIContext.getMessage(LeadI18nEnum.NEW)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(event -> fireNewRelatedItem("")); final Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {/*from w w w . j a v a 2 s .c o m*/ CampaignLeadSelectionWindow leadsWindow = new CampaignLeadSelectionWindow( CampaignLeadListComp.this); LeadSearchCriteria criteria = new LeadSearchCriteria(); criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId())); UI.getCurrent().addWindow(leadsWindow); leadsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); }); selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD)); OptionPopupContent buttonControlLayout = new OptionPopupContent(); buttonControlLayout.addOption(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); } return controlsBtnWrap; }
From source file:com.mycollab.module.crm.view.campaign.CampaignSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 2); layoutSearchPane.setSpacing(true);// ww w . j a v a 2s .c om group = new ValueComboBox(false, "Campaign Name", "Start Date", "End Date"); group.select("Campaign Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { removeComponents(); String searchType = (String) group.getValue(); if (searchType.equals("Campaign Name")) { addTextFieldSearch(); } else if (searchType.equals("Start Date")) { addDateFieldSearch(); } else if (searchType.equals("End Date")) { addDateFieldSearch(); } } }); layoutSearchPane.addComponent(group, 1, 0); layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER); addTextFieldSearch(); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.BUTTON_ACTION); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { doSearch(); } }); layoutSearchPane.addComponent(searchBtn, 2, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }