List of usage examples for com.vaadin.ui Button setDescription
public void setDescription(String description)
From source file:com.hybridbpm.ui.component.bpm.StartProcessColumnGenerator.java
License:Apache License
@Override public Object generateCell(Table source, Object itemId, Object columnId) { StartProcess spd = (StartProcess) itemId; Button button = new Button(spd.getProcessModel().getTitle().getValue(HybridbpmUI.getCurrent().getLocale()), clickListener);//w w w. j ava2 s . co m button.setData(spd); button.addStyleName(ValoTheme.BUTTON_LINK); button.setIcon(FontAwesome.valueOf(spd.getIcon())); button.setDescription("Start case"); return button; }
From source file:com.hybridbpm.ui.component.document.DocumentColumnGenerator.java
License:Apache License
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Document document = (Document) itemId; Button button = new Button(document.getName()); button.setData(document);//from ww w.ja va 2s. c o m button.addStyleName(ValoTheme.BUTTON_LINK); if (Objects.equals(document.getType(), Document.TYPE.FILE)) { OnDemandFileDownloader onDemandFileDownloader = new OnDemandFileDownloader(document.getId().toString(), document.getName()); onDemandFileDownloader.extend(button); button.setDescription(Translate.getMessage("btnDownload")); } else { button.setDescription(Translate.getMessage("btnOpen")); button.addClickListener(clickListener); } return button; }
From source file:com.jain.addon.action.ActionButtonGroup.java
License:Apache License
/** * Method to initialize component//from w ww . j a v a 2 s .c om */ @JNIComponentInit public void initActions() { if (!initialized) { int i = 0; Button actionButton = null; for (JNAction action : actions) { actionButton = new Button(actionsToName.get(action), listener); if (StringHelper.isNotEmptyWithTrim(action.description())) actionButton.setDescription(action.description()); else actionButton.setDescription(actionsToName.get(action)); actionButton.setVisible(validatePermission(action)); findNAddIcon(action, actionButton); if (StringHelper.isNotEmptyWithTrim(getActionStyle())) actionButton.setStyleName(getActionStyle()); if (i == 0) actionButton.addStyleName(getFirstActionStyle()); i++; addComponent(actionButton); setComponentAlignment(actionButton, Alignment.TOP_RIGHT); } if (actionButton != null) actionButton.addStyleName(getLastActionStyle()); initialized = true; } else { throw new IllegalArgumentException("Please add action before adding component into container"); } }
From source file:com.jain.addon.web.layout.segment.ButtonSegment.java
License:Apache License
/** * Initialize a button segment by adding resources {@link JNINamedResourceVisible} and {@link ClickListener}. <br/> * Every {@link JNINamedResourceVisible} will be converted into button having this {@link ClickListener}. * @param listener - {@link ClickListener} for the button * @param namedResources - {@link JNINamedResourceVisible} to create button and there visibility *///w w w. ja v a 2 s. co m public void createSegment(ClickListener listener, JNINamedResourceVisible... namedResources) { if (namedResources != null) { this.namedResources = namedResources; int i = 0; Button action = null; for (JNINamedResourceVisible named : namedResources) { action = new Button(named.getDisplayName(), listener); action.setDescription(named.getDescription()); action.setVisible(named.isVisible()); if (StringHelper.isNotEmptyWithTrim(buttonStyle)) action.setStyleName(firstButtonStyle); if (i == 0) action.addStyleName(firstButtonStyle); i++; addComponent(action); setComponentAlignment(action, Alignment.TOP_RIGHT); } if (action != null) action.addStyleName(lastButtonStyle); } }
From source file:com.klwork.explorer.ui.business.query.SocialListQuery.java
License:Apache License
public void initReAuthorButton(SocialUserAccount sc, HorizontalLayout buttonLayout) { if (checkExpried(sc)) {//?? Integer scType = sc.getType(); Button authorButton = new Button("?"); authorButton.setDescription("?????"); authorButton.addStyleName(Reindeer.BUTTON_LINK); authorButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { //socialAccountList.openReAuthorityBrowserWindow(opener); }//ww w.ja v a 2 s. c o m }); //??button? socialAccountList.initButtonByBrowWindow(scType, authorButton); buttonLayout.addComponent(authorButton); } }
From source file:com.mechanicshop.components.MaintenanceLayout.java
private void customizeTable() { table.setSizeFull();//from ww 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();//from w w w.j a v a2 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.moscaville.ui.CsvVaadinUI.java
private void buildTemplateGridHeader() { HorizontalLayout templateGridHeaderLayout = new HorizontalLayout(); templateGridHeaderLayout.setSpacing(true); templateGridHeaderLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); Button btnNew = new Button("New", FontAwesome.FILE); btnNew.setDescription("New template file"); btnNew.addClickListener((Button.ClickEvent event) -> { templateManager.newTemplate();//from w w w. ja v a 2 s . c o m }); templateGridHeaderLayout.addComponent(btnNew); Button btnOpen = new Button("Open", FontAwesome.FILE_O); btnOpen.setDescription("Open template file"); btnOpen.addClickListener((Button.ClickEvent event) -> { fileChooser.setFileExtension(FileChooser.FILE_EXTENSION_TEMPLATE); addWindow(fileChooser); }); templateGridHeaderLayout.addComponent(btnOpen); Button btnSave = new Button("Save", FontAwesome.SAVE); tfTemplateFileName = new TextField(); tfTemplateFileName.setDescription("template file name"); tfTemplateFileName.setInputPrompt("template file name"); tfTemplateFileName.setImmediate(true); tfTemplateFileName.addValueChangeListener((Property.ValueChangeEvent event) -> { btnSave.setEnabled(tfTemplateFileName.getValue() != null && tfTemplateFileName.getValue().length() > 0); }); templateGridHeaderLayout.addComponent(tfTemplateFileName); FieldGroup binder = new FieldGroup(templateManager.getTemplateBeanItem()); binder.setBuffered(false); binder.bind(tfTemplateFileName, "templateFileName"); btnSave.setDescription("Save template file"); btnSave.setImmediate(true); btnSave.setEnabled(false); btnSave.addClickListener((Button.ClickEvent event) -> { templateManager.saveTemplate(); }); templateGridHeaderLayout.addComponent(btnSave); Button btnData = new Button("Data", FontAwesome.DATABASE); btnData.setDescription("Load data"); btnData.addClickListener((Button.ClickEvent event) -> { fileChooser.setFileExtension(FileChooser.FILE_EXTENSION_CSV); addWindow(fileChooser); }); templateGridHeaderLayout.addComponent(btnData); Button btnImport = new Button("Import", FontAwesome.DOWNLOAD); templateGridHeaderLayout.addComponent(btnImport); mainLayout.addComponent(templateGridHeaderLayout); }
From source file:com.moscaville.ui.CsvVaadinUI.java
private void buildTemplateGrid() { VerticalLayout templateGridLayout = new VerticalLayout(); templateGridLayout.setSpacing(true); templateGrid.setWidth("100%"); templateGrid.setHeight("300px"); templateGridLayout.addComponent(templateGrid); HorizontalLayout tgButtonLayout = new HorizontalLayout(); tgButtonLayout.setSpacing(true);//from w ww .ja v a 2 s .c om Button btnAddTemplate = new Button("Add", FontAwesome.PLUS_SQUARE); btnAddTemplate.setDescription("Add template"); btnAddTemplate.addClickListener((Button.ClickEvent event) -> { templateManager.addProperty(); }); tgButtonLayout.addComponent(btnAddTemplate); Button btnDeleteTemplate = new Button("Delete", FontAwesome.MINUS_SQUARE); btnDeleteTemplate.setDescription("Delete template"); btnDeleteTemplate.addClickListener((Button.ClickEvent event) -> { Object itemId = templateGrid.getSelectedRow(); if (itemId != null) { templateManager.getContainer().removeItem(itemId); } }); tgButtonLayout.addComponent(btnDeleteTemplate); templateGridLayout.addComponent(tgButtonLayout); mainLayout.addComponent(templateGridLayout); }
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 ww . java2s . 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); }