List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:com.peergreen.webconsole.scope.deployment.internal.deployed.DeployedPanel.java
License:Open Source License
@PostConstruct public void init() { setSizeFull();/* w w w. j a v a2 s. c om*/ Table table = new Table(); VerticalLayout mainContent = new VerticalLayout(); mainContent.setSpacing(true); mainContent.setMargin(true); mainContent.setStyleName("deployable-style"); mainContent.setSizeFull(); setContent(mainContent); HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setMargin(true); toolBar.setSpacing(true); toolBar.setWidth("100%"); // Select all deployed artifacts CheckBox selectAll = new CheckBox("All"); selectAll.addValueChangeListener(new SelectAll(table)); toolBar.addComponent(selectAll); toolBar.setExpandRatio(selectAll, 1); // Filter TextField filter = new TextField(); filter.setInputPrompt("Filter deployed artifacts"); filter.setWidth("100%"); filter.addTextChangeListener(new FilterFiles(TREE_ITEM_ID, container)); toolBar.addComponent(filter); toolBar.setComponentAlignment(filter, Alignment.TOP_LEFT); toolBar.setExpandRatio(filter, 3); HorizontalLayout actionArea = new HorizontalLayout(); final NativeSelect actionSelection = new NativeSelect(); actionSelection.addItem(DeploymentActions.UNDEPLOY); actionSelection.addItem(DeploymentActions.DELETE); actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN); actionSelection.setWidth("100px"); actionSelection.setNullSelectionAllowed(false); Button doButton = new Button("Do"); doButton.addStyleName("default"); doButton.addClickListener( new DoClickListener(artifactBuilder, table, actionSelection, deploymentViewManager)); actionArea.addComponent(actionSelection); actionArea.addComponent(doButton); toolBar.addComponent(actionArea); toolBar.setComponentAlignment(actionArea, Alignment.TOP_RIGHT); mainContent.addComponent(toolBar); VerticalLayout deployedContainer = new VerticalLayout(); DragAndDropWrapper deployedContainerWrapper = new DragAndDropWrapper(deployedContainer); deployedContainerWrapper .setDropHandler(new DeploymentDropHandler(deploymentViewManager, this, notifierService)); deployedContainerWrapper.setSizeFull(); mainContent.addComponent(deployedContainerWrapper); mainContent.setExpandRatio(deployedContainerWrapper, 1.5f); container.addContainerProperty(TREE_ITEM_ID, String.class, null); table.setSizeFull(); table.setImmediate(true); table.setMultiSelect(true); table.setSelectable(true); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.setContainerDataSource(container); table.setDragMode(Table.TableDragMode.MULTIROW); table.setItemCaptionPropertyId(TREE_ITEM_ID); table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED, deploymentManager)); table.addShortcutListener(new DeleteFileShortcutListener(deploymentViewManager, table, "Delete", ShortcutAction.KeyCode.DELETE, null)); table.setItemDescriptionGenerator(new ItemDescription()); table.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { DeployableEntry deployableEntry = (DeployableEntry) event.getItemId(); try { ArtifactStatusReport report = deploymentManager .getReport(deployableEntry.getUri().toString()); event.getComponent().getUI() .addWindow(new DeployableWindow(deployableEntry, report).getWindow()); } catch (ArtifactStatusReportException e) { LOGGER.warn("Cannot get artifact status report for ''{0}''", deployableEntry.getUri(), e); event.getComponent().getUI().addWindow(new DeployableWindow(deployableEntry).getWindow()); } } } }); deployedContainer.addComponent(table); deployedContainer.setExpandRatio(table, 1.5f); refresh(); }
From source file:com.peergreen.webconsole.scope.deployment.internal.deploymentplan.DeploymentPlanPanel.java
License:Open Source License
@PostConstruct public void init() { setSizeFull();//from w w w .j a va2s . c om TreeTable table = new TreeTable(); VerticalLayout mainContent = new VerticalLayout(); mainContent.setSpacing(true); mainContent.setMargin(true); mainContent.setStyleName("deployable-style"); mainContent.setSizeFull(); setContent(mainContent); HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setMargin(true); toolBar.setSpacing(true); toolBar.setWidth("100%"); // Deployment Plan name Label deploymentPlanNameLabel = new Label("Plan"); toolBar.addComponent(deploymentPlanNameLabel); toolBar.setExpandRatio(deploymentPlanNameLabel, 1); deploymentPlanName = new TextField(); deploymentPlanName.setInputPrompt(getDefaultName()); deploymentPlanName.setWidth("100%"); toolBar.addComponent(deploymentPlanName); toolBar.setComponentAlignment(deploymentPlanName, Alignment.TOP_LEFT); toolBar.setExpandRatio(deploymentPlanName, 3); error = new Label("", ContentMode.HTML); error.addStyleName("error"); error.setSizeUndefined(); error.addStyleName("light"); error.addStyleName("v-animate-reveal"); error.setVisible(false); toolBar.addComponent(error); toolBar.setComponentAlignment(error, Alignment.TOP_RIGHT); toolBar.setExpandRatio(error, 1); mainContent.addComponent(toolBar); mainContent.setComponentAlignment(toolBar, Alignment.TOP_LEFT); mainContent.setExpandRatio(toolBar, 1); VerticalLayout deploymentPlanContainer = new VerticalLayout(); DragAndDropWrapper deploymentPlanContainerWrapper = new DragAndDropWrapper(deploymentPlanContainer); DropHandler deploymentPlanDropHandler = new DeploymentDropHandler(deploymentViewManager, this, notifierService); deploymentPlanContainerWrapper.setDropHandler(deploymentPlanDropHandler); deploymentPlanContainerWrapper.setSizeFull(); mainContent.addComponent(deploymentPlanContainerWrapper); mainContent.setExpandRatio(deploymentPlanContainerWrapper, 10); container.addContainerProperty(TREE_ITEM_ID, String.class, null); table.setSizeFull(); table.setImmediate(true); table.setMultiSelect(true); table.setSelectable(true); table.setContainerDataSource(container); table.setDragMode(Table.TableDragMode.MULTIROW); table.setItemCaptionPropertyId(TREE_ITEM_ID); table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED)); table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); table.setDropHandler(new OrderedContainerDropHandler(table, deploymentPlanDropHandler)); table.addShortcutListener(new ShortcutListener("Delete", ShortcutAction.KeyCode.DELETE, null) { @Override public void handleAction(Object sender, Object target) { Table table = (Table) target; Collection<DeployableEntry> deployableEntries = (Collection<DeployableEntry>) table.getValue(); for (DeployableEntry deployableEntry : deployableEntries) { removeDeployable(deployableEntry); } } }); deploymentPlanContainer.addComponent(table); HorizontalLayout footer = new HorizontalLayout(); footer.setSizeFull(); footer.setSpacing(true); footer.setMargin(true); footer.addStyleName("footer"); footer.setWidth("100%"); deployIt = new CheckBox("Deploy this deployment plan"); footer.addComponent(deployIt); footer.setComponentAlignment(deployIt, Alignment.TOP_LEFT); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setMargin(true); Button cancel = new Button("Cancel"); cancel.addClickListener(new CancelButtonListener()); Button create = new Button("Create"); create.addClickListener(new CreateButtonListener()); create.addStyleName("wide"); create.addStyleName("default"); buttons.addComponent(cancel); buttons.addComponent(create); footer.addComponent(buttons); footer.setComponentAlignment(buttons, Alignment.TOP_RIGHT); mainContent.addComponent(footer); mainContent.setComponentAlignment(footer, Alignment.BOTTOM_RIGHT); mainContent.setExpandRatio(footer, 1); }
From source file:com.peergreen.webconsole.scope.deployment.internal.DeploymentScope.java
License:Open Source License
@PostConstruct public void init() { deploymentViewManager = createDeploymentViewManager(); OptionGroup option = new OptionGroup(); HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setWidth("100%"); toolBar.setSpacing(true);// w w w . jav a2 s. c o m toolBar.setMargin(true); VerticalLayout uploadLayout = new VerticalLayout(); Upload uploader = new Upload("Upload a file here", null); uploader.setButtonCaption("Upload"); final FileUploader fileUploader = new FileUploader(deploymentViewManager, notifierService, artifactBuilder, option); uploader.setReceiver(fileUploader); uploader.addSucceededListener(fileUploader); uploader.addStartedListener(fileUploader); uploadLayout.addComponent(uploader); HorizontalLayout target = new HorizontalLayout(); option.addContainerProperty("id", String.class, null); option.setItemCaptionPropertyId("id"); option.addItem(DeployableContainerType.DEPLOYABLE.attribute()).getItemProperty("id") .setValue("Add to deployables"); option.addItem(DeployableContainerType.DEPLOYED.attribute()).getItemProperty("id").setValue("Deploy"); option.addItem(DeployableContainerType.DEPLOYMENT_PLAN.attribute()).getItemProperty("id") .setValue("Create a deployment plan"); option.addStyleName("horizontal"); option.select(DeployableContainerType.DEPLOYABLE.attribute()); target.addComponent(option); uploadLayout.addComponent(target); toolBar.addComponent(uploadLayout); Label infoLabel = new Label("Drop files here to create a deployment plan"); infoLabel.setSizeUndefined(); final VerticalLayout deploymentPlanMaker = new VerticalLayout(infoLabel); deploymentPlanMaker.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER); Button draft = new Button("A draft is under construction"); draft.addStyleName("link"); draft.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { deploymentViewManager.showDeploymentPlanView(); } }); draft.setVisible(false); deploymentViewManager.setDeploymentPlanDraftViewer(draft); deploymentPlanMaker.addComponent(draft); deploymentPlanMaker.setComponentAlignment(draft, Alignment.TOP_CENTER); deploymentPlanMaker.setSizeFull(); deploymentPlanMaker.addStyleName("drop-area"); deploymentPlanMakerWrapper = new DragAndDropWrapper(deploymentPlanMaker); deploymentPlanMakerWrapper.setSizeFull(); toolBar.addComponent(deploymentPlanMakerWrapper); addComponent(toolBar); addComponent(framesContainer); setExpandRatio(framesContainer, 1.5f); helpWindow = notifierService.createHelpOverlay("Deployment module", "<p>To deploy, or undeploy, artifacts, you can drag and drop elements from deployables panel " + "to deployed panel and vice versa.</p>" + "<p>You can also drag files from desktop and drop them where you want to add them."); }
From source file:com.peergreen.webconsole.scope.home.extensions.PeergreenNewsFeedFrame.java
License:Open Source License
@PostConstruct public void init() throws MalformedURLException, RssServiceException { Rss rss = null;//from w w w.j a va 2 s . c o m rss = rssService.parse(new URL(PEERGREEN_RSS_FLOW_URL)); int i = 0; for (final FeedMessage feedMessage : rss.getItems()) { Button news = new NativeButton(feedMessage.getTitle()); news.addStyleName("link"); news.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window w = getNewsDescription(feedMessage); UI.getCurrent().addWindow(w); w.focus(); } }); addItem(new Object[] { news }, i++); } }
From source file:com.peergreen.webconsole.scope.home.extensions.PeergreenNewsFeedFrame.java
License:Open Source License
/** * News popup//from ww w .ja va 2s . c om * * @param feedMessage * @return */ private Window getNewsDescription(FeedMessage feedMessage) { FormLayout fields = new FormLayout(); fields.setWidth("35em"); fields.setSpacing(true); fields.setMargin(true); Label label = new Label("<a href=\"" + feedMessage.getLink() + "\">" + feedMessage.getLink().substring(0, 50) + "..." + "</a>"); label.setContentMode(ContentMode.HTML); label.setSizeUndefined(); label.setCaption("URL"); fields.addComponent(label); String description = feedMessage.getDescription(); if (description.length() > 1000) { description = description.substring(0, 999) + "..."; } Label desc = new Label(description); desc.setContentMode(ContentMode.HTML); desc.setCaption("Description"); fields.addComponent(desc); Button ok = new Button("Close"); ok.addStyleName("wide"); ok.addStyleName("default"); final Window w = new DefaultWindow(feedMessage.getTitle(), fields, ok); w.center(); ok.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { w.close(); } }); return w; }
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 *///from ww w. jav a 2s . c om @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.ja va2 s . c o 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);/*w w w. ja v a 2s. c om*/ 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.rdonasco.common.vaadin.view.ButtonUtil.java
License:Apache License
public static void setupAllButtonStyles(String[] styles, Button... buttons) { for (Button button : buttons) { for (String style : styles) { button.addStyleName(style); }//from w w w . java 2s . c o m } }
From source file:com.rex.components.valo.CommonParts.java
License:Apache License
Panel loadingIndicators() { Panel p = new Panel("Loading Indicator"); final VerticalLayout content = new VerticalLayout(); p.setContent(content);/*from www. j a v a 2 s . c o m*/ content.setSpacing(true); content.setMargin(true); content.addComponent(new Label("You can test the loading indicator by pressing the buttons.")); CssLayout group = new CssLayout(); group.setCaption("Show the loading indicator for"); group.addStyleName("v-component-group"); content.addComponent(group); Button loading = new Button("0.8"); loading.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(800); } catch (InterruptedException e) { } } }); group.addComponent(loading); Button delay = new Button("3"); delay.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(3000); } catch (InterruptedException e) { } } }); group.addComponent(delay); Button wait = new Button("15"); wait.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(15000); } catch (InterruptedException e) { } } }); wait.addStyleName("last"); group.addComponent(wait); Label label = new Label(" seconds", ContentMode.HTML); label.setSizeUndefined(); group.addComponent(label); Label spinnerDesc = new Label( "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added."); spinnerDesc.addStyleName("small"); spinnerDesc.setCaption("Spinner"); content.addComponent(spinnerDesc); if (!ReportEngineUI.isTestMode()) { final Label spinner = new Label(); spinner.addStyleName("spinner"); Button showSpinnerButton = new Button("Show spinner", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { content.replaceComponent(event.getComponent(), spinner); } }); content.addComponent(showSpinnerButton); } return p; }