List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java
License:Open Source License
private Layout createToolbarContentElements() { ThemeResource placeHolder = new ThemeResource("img/placeholder.png"); CssLayout wrapper = new CssLayout(); wrapper.addStyleName("toolbar-elements"); Button addTableButton = new Button("table", new Button.ClickListener() { @Override/*from w w w. j a v a 2 s .c o m*/ public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addTableButton.setStyleName("ax-shape-button"); ThemeResource tableResource = new ThemeResource("img/table.png"); addTableButton.setIcon(tableResource); wrapper.addComponent(addTableButton); Button addRuleButton = new Button("rule", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addRuleButton.setStyleName("ax-shape-button"); addRuleButton.setIcon(placeHolder); wrapper.addComponent(addRuleButton); Button addParagraphButton = new Button("section", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { listener.createSection("Section"); } }); addParagraphButton.setStyleName("ax-shape-button"); ThemeResource sectionResource = new ThemeResource("img/section_sign.gif"); addParagraphButton.setIcon(sectionResource); wrapper.addComponent(addParagraphButton); Button addPullQuoteButton = new Button("pullquote", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addPullQuoteButton.setStyleName("ax-shape-button"); addPullQuoteButton.setIcon(placeHolder); wrapper.addComponent(addPullQuoteButton); return wrapper; }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java
License:Open Source License
private Layout createToolbarAssetsElements() { final CssLayout wrapper = new CssLayout(); wrapper.addStyleName("toolbar-elements"); final Button addPhotographButton = new Button("photograph"); addPhotographButton.addClickListener(new Button.ClickListener() { @Override//from www . j a v a2 s .c om public void buttonClick(Button.ClickEvent event) { listener.openMediaGallery(); } }); addPhotographButton.setStyleName("ax-shape-button"); ThemeResource sectionResource = new ThemeResource("img/photograph.png"); addPhotographButton.setIcon(sectionResource); wrapper.addComponent(addPhotographButton); List<String> assetElements = Arrays.asList(new String[] { "video", "poll", "related link", "iFrame" }); for (String name : assetElements) { Button addButton = new Button(name, new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addButton.setStyleName("ax-shape-button"); ThemeResource tableResource = new ThemeResource("img/placeholder.png"); addButton.setIcon(tableResource); wrapper.addComponent(addButton); } return wrapper; }
From source file:com.oodrive.nuage.webui.component.VvrOperationComponent.java
License:Apache License
@Override public final AbstractComponent createComponent(final VvrModel model, final ModelCreator handler) { final HorizontalLayout operationLayout = new HorizontalLayout(); operationLayout.setMargin(true);/*from ww w . j ava2s . co m*/ operationLayout.setSpacing(true); operationLayout.setWidth("100%"); // Start and description buttons // START/STOP final Button startStop = new Button(); startStop.setWidth(BUTTON_WIDTH); startStop.addStyleName(Runo.BUTTON_BIG); final Resource iconStartStop; final String description; if (!model.isVvrStarted()) { iconStartStop = WebUiResources.getStartIcon(); description = "Start"; } else { iconStartStop = WebUiResources.getStopIcon(); description = "Stop"; } startStop.setIcon(iconStartStop); startStop.setDescription(description); operationLayout.addComponent(startStop); operationLayout.setExpandRatio(startStop, 1f); operationLayout.setComponentAlignment(startStop, Alignment.MIDDLE_LEFT); final UUID vvrUuid = model.getItemUuid(); startStop.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { final boolean started = model.isVvrStarted(); // Start/Stop are done in background if (!started) { WaitingComponent.executeBackground(model, new Background() { @Override public void processing() { model.startVvr(); } @Override public void postProcessing() { startStop.setIcon(WebUiResources.getStopIcon()); startStop.setDescription("Stop"); Notification.show("VVR started ", vvrUuid.toString(), Notification.Type.TRAY_NOTIFICATION); } }); } else { WaitingComponent.executeBackground(model, new Background() { @Override public void processing() { model.stopVvr(); } @Override public void postProcessing() { startStop.setIcon(WebUiResources.getStartIcon()); startStop.setDescription("Start"); Notification.show("VVR stopped ", vvrUuid.toString(), Notification.Type.TRAY_NOTIFICATION); } }); } } }); // ATTRIBUTES final Button attributes = new Button(); attributes.addStyleName(Runo.BUTTON_BIG); attributes.setWidth(BUTTON_WIDTH); operationLayout.addComponent(attributes); operationLayout.setExpandRatio(attributes, 1f); operationLayout.setComponentAlignment(attributes, Alignment.MIDDLE_LEFT); attributes.setIcon(WebUiResources.getSettingsIcon()); attributes.setDescription("Settings"); attributes.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { final VvrAttributesWindow attributesWindow = new VvrAttributesWindow(vvrUuid); attributesWindow.add(model); } catch (final Exception e) { LOGGER.error("Can not get VVR attributes: ", e); final ErrorWindow err = new ErrorWindow("Can not display VVR Attributes: " + e.getMessage()); err.add(model); } } }); // DELETE final Button delete = new Button(); delete.addStyleName(Runo.BUTTON_BIG); delete.setWidth(BUTTON_WIDTH); delete.setIcon(WebUiResources.getTrashIcon()); delete.setDescription("Delete"); operationLayout.addComponent(delete); operationLayout.setExpandRatio(delete, 12f); operationLayout.setComponentAlignment(delete, Alignment.MIDDLE_RIGHT); delete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { final VvrDeleteWindow deleteWindow = new VvrDeleteWindow(vvrUuid); deleteWindow.add(vvrManagerModel); } catch (final Exception e) { LOGGER.error("Can not delete VVR: ", e); final ErrorWindow err = new ErrorWindow("Can not delete VVR: " + e.getMessage()); err.add(model); } } }); return operationLayout; }
From source file:com.peergreen.webconsole.scope.system.internal.bundle.BundleTab.java
License:Open Source License
private void init() { setMargin(true);//from w w w . j a va 2 s . com setSpacing(true); // ---------------------------------------------------- // Title // ---------------------------------------------------- HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true); header.setMargin(true); Label title = new Label(format("Bundle %d: %s (%s)", bundle.getBundleId(), getHeader(bundle, Constants.BUNDLE_NAME), bundle.getVersion())); title.addStyleName("h1"); header.addComponent(title); header.setComponentAlignment(title, Alignment.MIDDLE_LEFT); addComponent(header); // ---------------------------------------------------- // Action(s) Bar // ---------------------------------------------------- HorizontalLayout actions = new HorizontalLayout(); if (BundleHelper.isState(bundle, Bundle.INSTALLED) || BundleHelper.isState(bundle, Bundle.RESOLVED)) { Button changeState = new Button(); changeState.addClickListener(new StartBundleClickListener(bundle, notifierService)); //changeState.addStyleName("no-padding"); changeState.setCaption("Start"); changeState.setIcon(new ClassResource(getClass(), "/images/32x32/go-next.png")); actions.addComponent(changeState); } if (BundleHelper.isState(bundle, Bundle.ACTIVE)) { Button changeState = new Button(); changeState.addClickListener(new StopBundleClickListener(bundle, notifierService)); //changeState.addStyleName("no-padding"); changeState.setCaption("Stop"); changeState.setIcon(new ClassResource(getClass(), "/images/32x32/media-record.png")); actions.addComponent(changeState); } // Update Button update = new Button(); update.addClickListener(new UpdateBundleClickListener(bundle, notifierService)); //update.addStyleName("no-padding"); update.setCaption("Update"); update.setIcon(new ClassResource(getClass(), "/images/32x32/view-refresh.png")); actions.addComponent(update); // Trash Button trash = new Button(); trash.addClickListener(new UninstallBundleClickListener(bundle, notifierService)); //trash.addStyleName("no-padding"); trash.setCaption("Remove"); trash.setIcon(new ClassResource(getClass(), "/images/32x32/user-trash-full.png")); actions.addComponent(trash); addComponent(actions); setComponentAlignment(actions, Alignment.MIDDLE_RIGHT); // ---------------------------------------------------- // Standard Section // ---------------------------------------------------- Table table = new Table(); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.setWidth("100%"); Section mainSection = new Section("Standard", table); addComponent(mainSection); table.addContainerProperty("label", Label.class, null); table.addContainerProperty("value", Label.class, null); table.addItem(new Object[] { label("Bundle ID"), label(String.valueOf(bundle.getBundleId())) }, "bundle.id"); for (Map.Entry<String, String> entry : HEADERS.entrySet()) { String value = getHeader(bundle, entry.getKey()); if (value != null) { table.addItem(new Object[] { label(entry.getValue()), label(value) }, entry.getKey()); } } table.addItem(new Object[] { label("Location"), label(bundle.getLocation()) }, "bundle.location"); Date date = new Date(bundle.getLastModified()); table.addItem(new Object[] { label("Last Modified"), label(date.toString()) }, "last.modified"); // ---------------------------------------------------- // Packages Section // ---------------------------------------------------- FilteredPackageTable exported = new FilteredPackageTable("Exported"); FilteredPackageTable imported = new FilteredPackageTable("Imported"); GridLayout packages = new GridLayout(2, 1); packages.addComponent(exported); packages.addComponent(imported); packages.setSpacing(true); packages.setWidth("100%"); Section packagesSection = new Section("Packages", packages); addComponent(packagesSection); BundleWiring wiring = bundle.adapt(BundleWiring.class); if (wiring != null) { for (BundleCapability capability : wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE)) { String name = (String) capability.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE); Version version = (Version) capability.getAttributes() .get(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE); exported.addPackage(format("%s (%s)", name, version)); } for (BundleRequirement requirement : wiring.getRequirements(PackageNamespace.PACKAGE_NAMESPACE)) { String filter = requirement.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE); imported.addPackage(filter); } } // ---------------------------------------------------- // Services Section // ---------------------------------------------------- FilteredServiceTable registered = new FilteredServiceTable("Registered"); FilteredServiceTable used = new FilteredServiceTable("Used Services"); VerticalLayout services = new VerticalLayout(registered, used); services.setSpacing(true); services.setWidth("100%"); ServiceReference<?>[] registeredServices = bundle.getRegisteredServices(); if (registeredServices != null) { for (ServiceReference<?> reference : registeredServices) { registered.addService(reference); } } ServiceReference<?>[] inUseServices = bundle.getServicesInUse(); if (inUseServices != null) { for (ServiceReference<?> reference : inUseServices) { used.addService(reference); } } if (!registered.isEmpty() || !used.isEmpty()) { Section servicesSection = new Section("Services", services); addComponent(servicesSection); } // ---------------------------------------------------- // Raw Manifest Section // ---------------------------------------------------- Page.Styles styles = Page.getCurrent().getStyles(); styles.add(".monospaced-font {font-family: monospace !important; }"); Table manifest = new Table(); manifest.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); manifest.setWidth("100%"); manifest.addStyleName("monospaced-font"); manifest.setPageLength(15); manifest.addContainerProperty("name", String.class, null); manifest.addContainerProperty("value", String.class, null); Dictionary<String, String> headers = bundle.getHeaders(); for (String key : Collections.list(headers.keys())) { manifest.addItem(new Object[] { key, headers.get(key) }, null); } Section manifestSection = new Section("Manifest", manifest); addComponent(manifestSection); }
From source file:com.purebred.core.view.EntityForm.java
License:Open Source License
/** * Created the footer buttons: cancel, refresh, save * * @param footerLayout horizontal layout containing buttons */// w w w . ja v a 2 s . co m @Override protected void createFooterButtons(HorizontalLayout footerLayout) { footerLayout.setSpacing(true); footerLayout.setMargin(true); Button cancelButton = new Button(uiMessageSource.getMessage("entityForm.cancel"), this, "cancel"); cancelButton.setDescription(uiMessageSource.getMessage("entityForm.cancel.description")); cancelButton.setIcon(new ThemeResource("icons/16/cancel.png")); cancelButton.addStyleName("small default"); footerLayout.addComponent(cancelButton); refreshButton = new Button(uiMessageSource.getMessage("entityForm.refresh"), this, "refresh"); refreshButton.setDescription(uiMessageSource.getMessage("entityForm.refresh.description")); refreshButton.setIcon(new ThemeResource("icons/16/refresh.png")); refreshButton.addStyleName("small default"); footerLayout.addComponent(refreshButton); saveAndStayOpenButton = new Button(uiMessageSource.getMessage("entityForm.saveAndStayOpen"), this, "saveAndStayOpen"); saveAndStayOpenButton.setDescription(uiMessageSource.getMessage("entityForm.save.description")); saveAndStayOpenButton.setIcon(new ThemeResource("icons/16/save.png")); saveAndStayOpenButton.addStyleName("small default"); footerLayout.addComponent(saveAndStayOpenButton); saveAndCloseButton = new Button(uiMessageSource.getMessage("entityForm.saveAndClose"), this, "saveAndClose"); saveAndCloseButton.setDescription(uiMessageSource.getMessage("entityForm.save.description")); saveAndCloseButton.setIcon(new ThemeResource("icons/16/save.png")); saveAndCloseButton.addStyleName("small default"); footerLayout.addComponent(saveAndCloseButton); }
From source file:com.purebred.core.view.Results.java
License:Open Source License
private HorizontalLayout createNavigationLine() { HorizontalLayout resultCountDisplay = new HorizontalLayout(); Label showingLabel = new Label(uiMessageSource.getMessage("entityResults.showing") + "   ", Label.CONTENT_XHTML); showingLabel.setSizeUndefined();// ww w .j ava 2 s .co m showingLabel.addStyleName("small"); resultCountDisplay.addComponent(showingLabel); firstResultTextField = createFirstResultTextField(); firstResultTextField.addStyleName("small"); firstResultTextField.setSizeUndefined(); resultCountDisplay.addComponent(firstResultTextField); resultCountLabel = new Label("", Label.CONTENT_XHTML); resultCountLabel.setSizeUndefined(); resultCountLabel.addStyleName("small"); resultCountDisplay.addComponent(resultCountLabel); Label spaceLabel = new Label(" ", Label.CONTENT_XHTML); spaceLabel.setSizeUndefined(); resultCountDisplay.addComponent(spaceLabel); Button refreshButton = new Button(null, getResultsTable(), "refresh"); refreshButton.setDescription(uiMessageSource.getMessage("entityResults.refresh.description")); refreshButton.setSizeUndefined(); refreshButton.addStyleName("borderless"); refreshButton.setIcon(new ThemeResource("icons/16/refresh-blue.png")); resultCountDisplay.addComponent(refreshButton); HorizontalLayout navigationButtons = new HorizontalLayout(); navigationButtons.setMargin(false, true, false, false); navigationButtons.setSpacing(true); String perPageText = uiMessageSource.getMessage("entityResults.pageSize"); pageSizeMenu = new Select(); pageSizeMenu.addStyleName("small"); pageSizeMenu.addItem(5); pageSizeMenu.setItemCaption(5, "5 " + perPageText); pageSizeMenu.addItem(10); pageSizeMenu.setItemCaption(10, "10 " + perPageText); pageSizeMenu.addItem(25); pageSizeMenu.setItemCaption(25, "25 " + perPageText); pageSizeMenu.addItem(50); pageSizeMenu.setItemCaption(50, "50 " + perPageText); pageSizeMenu.addItem(100); pageSizeMenu.setItemCaption(100, "100 " + perPageText); pageSizeMenu.setFilteringMode(Select.FILTERINGMODE_OFF); pageSizeMenu.setNewItemsAllowed(false); pageSizeMenu.setNullSelectionAllowed(false); pageSizeMenu.setImmediate(true); pageSizeMenu.setWidth(8, UNITS_EM); navigationButtons.addComponent(pageSizeMenu); firstButton = new Button(null, getResultsTable(), "firstPage"); firstButton.setDescription(uiMessageSource.getMessage("entityResults.first.description")); firstButton.setSizeUndefined(); firstButton.addStyleName("borderless"); firstButton.setIcon(new ThemeResource("icons/16/first.png")); navigationButtons.addComponent(firstButton); previousButton = new Button(null, getResultsTable(), "previousPage"); previousButton.setDescription(uiMessageSource.getMessage("entityResults.previous.description")); previousButton.setSizeUndefined(); previousButton.addStyleName("borderless"); previousButton.setIcon(new ThemeResource("icons/16/previous.png")); navigationButtons.addComponent(previousButton); nextButton = new Button(null, getResultsTable(), "nextPage"); nextButton.setDescription(uiMessageSource.getMessage("entityResults.next.description")); nextButton.setSizeUndefined(); nextButton.addStyleName("borderless"); nextButton.setIcon(new ThemeResource("icons/16/next.png")); navigationButtons.addComponent(nextButton); lastButton = new Button(null, getResultsTable(), "lastPage"); lastButton.setDescription(uiMessageSource.getMessage("entityResults.last.description")); lastButton.setSizeUndefined(); lastButton.addStyleName("borderless"); lastButton.setIcon(new ThemeResource("icons/16/last.png")); navigationButtons.addComponent(lastButton); HorizontalLayout navigationLine = new HorizontalLayout(); navigationLine.setWidth("100%"); navigationLine.setMargin(true, true, true, false); navigationLine.addComponent(resultCountDisplay); navigationLine.setComponentAlignment(resultCountDisplay, Alignment.BOTTOM_LEFT); navigationLine.addComponent(navigationButtons); navigationLine.setComponentAlignment(navigationButtons, Alignment.BOTTOM_RIGHT); return navigationLine; }
From source file:com.purebred.core.view.SearchForm.java
License:Open Source License
@Override protected void createFooterButtons(HorizontalLayout footerLayout) { footerLayout.setSpacing(true);//from w w w .jav a2 s . co m footerLayout.setMargin(true); Button clearButton = new Button(uiMessageSource.getMessage("entitySearchForm.clear"), this, "clear"); clearButton.setDescription(uiMessageSource.getMessage("entitySearchForm.clear.description")); clearButton.setIcon(new ThemeResource("icons/16/clear.png")); clearButton.addStyleName("small default"); footerLayout.addComponent(clearButton); // alignment doesn't work // footerLayout.setComponentAlignment(clearButton, Alignment.MIDDLE_RIGHT); Button searchButton = new Button(uiMessageSource.getMessage("entitySearchForm.search"), this, "search"); searchButton.setDescription(uiMessageSource.getMessage("entitySearchForm.search.description")); searchButton.setIcon(new ThemeResource("icons/16/search.png")); searchButton.addStyleName("small default"); footerLayout.addComponent(searchButton); // footerLayout.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); }
From source file:com.saax.gestorweb.presenter.ChatPresenter.java
/** * Cria botao para download de anexo/*from ww w.ja v a 2s .co m*/ */ private Button buildButtonDownload(Anexo anexos) { Button exportar = new Button(); exportar.setIcon(FontAwesome.DOWNLOAD); exportar.addStyleName(ValoTheme.BUTTON_ICON_ONLY); exportar.addStyleName(ValoTheme.BUTTON_BORDERLESS); FileDownloader fd = new FileDownloader(new FileResource(new File(anexos.getCaminhoCompleto()))); fd.extend(exportar); return exportar; }
From source file:com.save.client.promodeals.PromoUI.java
public PromoUI(int clientId) { this.clientId = clientId; setWidth("90%"); setHeight("100%"); setMargin(new MarginInfo(true, true, false, false)); PDDataGridProperties dataGrid = new PDDataGridProperties(getClientId()); Button button = new Button("Acknowledgement Form"); button.setWidthUndefined();/* w w w . ja va2s. co m*/ button.setIcon(FontAwesome.OPENID); button.addStyleName(ValoTheme.BUTTON_LINK); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { Window sub = new com.save.clients.AcknowledgementPromoForm(getClientId()); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.addCloseListener((Window.CloseEvent e) -> { dataGrid.getContainerDataSource().removeAllItems(); dataGrid.setContainerDataSource(new PDDataContainer(getClientId())); }); }); addComponent(button); setComponentAlignment(button, Alignment.TOP_RIGHT); addComponent(dataGrid); setExpandRatio(dataGrid, 2); }
From source file:com.save.employee.maintenance.MRUI.java
public MRUI(int employeeId) { this.employeeId = employeeId; setWidth("90%"); setHeight("100%"); setMargin(new MarginInfo(true, false, false, false)); MRDataGridProperties dataGrid = new MRDataGridProperties(getEmployeeId()); Button mrForm = new Button("Maintenance/Reimbursement Form"); mrForm.setWidthUndefined();//from w w w . j av a2 s . c om mrForm.setIcon(FontAwesome.OPENID); mrForm.addStyleName(ValoTheme.BUTTON_SMALL); mrForm.addStyleName(ValoTheme.BUTTON_LINK); mrForm.addClickListener((Button.ClickEvent event) -> { Window sub = new MRFormWindow(getEmployeeId()); if (sub.getParent() == null) { UI.getCurrent().addWindow(sub); } sub.addCloseListener((Window.CloseEvent e) -> { dataGrid.getContainerDataSource().removeAllItems(); dataGrid.setContainerDataSource(new MRDataContainer(getEmployeeId())); }); }); addComponent(mrForm); setComponentAlignment(mrForm, Alignment.MIDDLE_RIGHT); addComponent(dataGrid); setExpandRatio(dataGrid, 2); }