List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:edu.kit.dama.ui.admin.workflow.ExecutionEnvironmentBasePropertiesLayout.java
License:Apache License
/** * Default constructor.// ww w . j a v a2 s .c om */ public ExecutionEnvironmentBasePropertiesLayout() { super(); LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ..."); setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1)); setSizeFull(); setMargin(true); setSpacing(true); setColumns(4); setRows(6); addComponent(getNameField(), 0, 0, 2, 0); addComponent(getGroupBox(), 3, 0); // addComponent(getAccessPointBox(), 0, 1, 2, 1); addComponent(getCheckBoxesLayout(), 3, 1); // addComponent(getAccessPointBasePathField(), 0, 2, 2, 2); addComponent(getPathSelectorButton(), 3, 2); // addComponent(getMaxTasksField(), 0, 3, 2, 3); // addComponent(getDescriptionArea(), 0, 4, 2, 5); //add property selection Button addPropertyButton = new Button(); addPropertyButton.setIcon(new ThemeResource(IconContainer.ADD)); addPropertyButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { addPropertyComponent.reset(); addPropertyComponent.showWindow(); } }); HorizontalLayout layout = new HorizontalLayout(getEnvironmentPropertiesSelect(), addPropertyButton); layout.setComponentAlignment(getEnvironmentPropertiesSelect(), Alignment.TOP_LEFT); layout.setComponentAlignment(addPropertyButton, Alignment.BOTTOM_RIGHT); layout.setSizeFull(); layout.setExpandRatio(getEnvironmentPropertiesSelect(), .95f); layout.setExpandRatio(addPropertyButton, .05f); addComponent(layout, 3, 4, 3, 5); //add popup to layout addPropertyComponent = new AddEnvironmentPropertyComponent(this); setComponentAlignment(getPathSelectorButton(), Alignment.BOTTOM_LEFT); setColumnExpandRatio(0, 0.2f); setColumnExpandRatio(1, 0.2f); setColumnExpandRatio(2, 0.2f); setColumnExpandRatio(3, 0.2f); setRowExpandRatio(5, 1f); }
From source file:edu.nps.moves.mmowgli.utility.MediaLocator.java
License:Open Source License
public void decorateDialogContinueButton(Button butt) { butt.setIcon(locate(new Media("continue.png", "", "", MediaType.IMAGE, Source.GAME_IMAGES_REPOSITORY))); butt.addStyleName("borderless"); }
From source file:edu.nps.moves.mmowgli.utility.MediaLocator.java
License:Open Source License
public void decorateImageButton(Button butt, String imageName) { butt.setIcon(locate(new Media(imageName, "", "", MediaType.IMAGE, Source.GAME_IMAGES_REPOSITORY))); butt.addStyleName("borderless"); }
From source file:edu.nps.moves.mmowgli.utility.MediaLocator.java
License:Open Source License
public void decorateGetABriefingButton(Button butt) { butt.setIcon(locate( new Media("getABriefing129w24h.png", "", "", MediaType.IMAGE, Source.GAME_IMAGES_REPOSITORY))); butt.addStyleName("borderless"); }
From source file:edu.nps.moves.mmowgli.utility.MediaLocator.java
License:Open Source License
public void decorateCancelButton(Button butt) { butt.setIcon(getCancelButtonIcon()); butt.addStyleName("borderless"); }
From source file:edu.nps.moves.mmowgli.utility.MediaLocator.java
License:Open Source License
public void decorateSelectButton(Button butt) { butt.setIcon(getSelectButtonIcon()); butt.addStyleName("borderless"); }
From source file:edu.nps.moves.mmowgli.utility.MediaLocator.java
License:Open Source License
public void decorateOkButton(Button butt) { butt.setIcon(getOkButtonIcon()); butt.addStyleName("borderless"); }
From source file:edu.nps.moves.mmowgli.utility.MediaLocator.java
License:Open Source License
public void decoratePlayIdeaButton(Button butt, Game g) { butt.setIcon(getPlayIdeaButt(g));//locate(new Media("playIdeaButt124w18h.png","","",MediaType.IMAGE,Source.GAME_IMAGES_REPOSITORY))); butt.addStyleName("borderless"); }
From source file:es.mdef.clientmanager.ui.GestionClientesUI.java
License:Apache License
CssLayout buildMenu() { // Add items//from w w w . j a va 2 s . c o m menuItems.put("common", "Common UI Elements"); menu.setSizeFull(); menu.addComponent(getMenuTitleComponent()); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); // TODO Actualizar nombre de usuario cuando se logee con exito final MenuBar.MenuItem userMenuItem = settings.addItem(getNombreUsuario(), new ThemeResource("icons/usuario.svg"), null); userMenuItem.addItem("Cambiar contrasea", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { ChangePasswordWindow changePasswordWindow = new ChangePasswordWindow(); changePasswordWindow.center(); addWindow(changePasswordWindow); } }); userMenuItem.addSeparator(); userMenuItem.addItem("Salir", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { SecurityContextHolder.clearContext(); //UI.getCurrent().close(); Navigator navigator = UI.getCurrent().getNavigator(); navigator.navigateTo(""); } }); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); final Button clientesButton = new Button("Clientes", new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { navigator.navigateTo(CLIENT_LIST_VIEW); } }); clientesButton.setHtmlContentAllowed(true); clientesButton.setPrimaryStyleName("valo-menu-item"); clientesButton.setIcon(new ThemeResource("icons/clientes2.svg")); menuItemsLayout.addComponent(clientesButton); final Button budgetButton = new Button("Presupuesto", new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { navigator.navigateTo(BUDGETS_VIEW); } }); budgetButton.setHtmlContentAllowed(true); budgetButton.setPrimaryStyleName("valo-menu-item"); budgetButton.setIcon(new ThemeResource("icons/money.svg")); menuItemsLayout.addComponent(budgetButton); final Button subscripcionButton = new Button("Suscripciones", new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { navigator.navigateTo(PROVIDERS_VIEW); } }); subscripcionButton.setHtmlContentAllowed(true); subscripcionButton.setPrimaryStyleName("valo-menu-item"); subscripcionButton.setIcon(new ThemeResource("icons/suscripciones.svg")); menuItemsLayout.addComponent(subscripcionButton); return menu; }
From source file:eu.eco2clouds.portal.component.apwizard.SuggestionStep.java
License:Apache License
private void render() { this.removeAllComponents(); if (this.mainLayout != null && this.mainLayout.getMenu() != null && this.mainLayout.getMenu().getResourcesStep() != null && this.mainLayout.getMenu().getResourcesStep().getNewResourceTable() != null && this.mainLayout.getMenu().getGeneralStep().getDuration() != null && this.mainLayout.getMenu().getGeneralStep().getDuration().getValue() != null && !this.mainLayout.getMenu().getGeneralStep().getDuration().getValue().equals("")) { VerticalLayout vlCpuLoad = new VerticalLayout(); vlCpuLoad.setMargin(false);//from w ww . j av a 2s .c om vlCpuLoad.setSpacing(true); Label lblCpuLoad = new Label("Average Cpu Load"); vlCpuLoad.addComponent(lblCpuLoad); this.sliderCpuLoad.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { updateChart(); } }); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(false); hl.setSpacing(true); hl.addComponent(new Label("min 0", ContentMode.HTML)); hl.addComponent(sliderCpuLoad); hl.addComponent(new Label("100 max", ContentMode.HTML)); vlCpuLoad.addComponent(hl); vlCpuLoad.setComponentAlignment(lblCpuLoad, Alignment.MIDDLE_LEFT); vlCpuLoad.setComponentAlignment(hl, Alignment.MIDDLE_LEFT); this.deploymentTable.setContainerDataSource(this.getCombination()); this.deploymentTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final Property.ValueChangeEvent event) { DeploymentTableBean item = (DeploymentTableBean) deploymentTable.getValue(); System.out.println("item is " + item); int selected = item.getId() - 1; long duration = Long.parseLong(mainLayout.getMenu().getGeneralStep().getDuration().getValue()); System.out.println("selected " + selected); System.out.println("power fr" + power_fr[selected]); System.out.println("power uk" + power_uk[selected]); System.out.println("power de" + power_de[selected]); TrendWindow trendWindow = new TrendWindow(power_fr[selected], power_uk[selected], power_de[selected], duration); UI.getCurrent().addWindow(trendWindow); } }); this.deploymentTable.addGeneratedColumn("GEC", new ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { ArrayList<String> locations = new ArrayList<String>(); String[] vms = ((DeploymentTableBean) itemId).getCombination().split(" "); for (int i = 0; i < vms.length; i++) { String vmName = vms[i].split("@")[0]; String vmLocation = vms[i].split("@")[1]; if (!locations.contains(vmLocation)) { locations.add(vmLocation); } } SourcePercentage sp = SchedulerManagerFactory.getInstance().getGEC(locations); return new Label(Double.toString(sp.getGEC())); } }); this.deploymentTable.addGeneratedColumn("", new ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button button = new Button(""); button.setStyleName(Reindeer.BUTTON_LINK); button.setIcon(new ThemeResource("img/pie.png")); button.setDescription("GEC"); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { ArrayList<String> locations = new ArrayList<String>(); String[] vms = ((DeploymentTableBean) itemId).getCombination().split(" "); for (int i = 0; i < vms.length; i++) { String vmName = vms[i].split("@")[0]; String vmLocation = vms[i].split("@")[1]; if (!locations.contains(vmLocation)) { locations.add(vmLocation); } } SourcePercentage sp = SchedulerManagerFactory.getInstance().getGEC(locations); GECWindow gecWindow = new GECWindow(((DeploymentTableBean) itemId).getCombination(), sp); UI.getCurrent().addWindow(gecWindow); } }); return button; } }); this.deploymentTable.addGeneratedColumn(" ", new ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button button = new Button(""); button.setStyleName(Reindeer.BUTTON_LINK); button.setIcon(new ThemeResource("img/trend.png")); button.setDescription("CO2 trend"); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { //DeploymentTableBean item = (DeploymentTableBean) deploymentTable.getValue(); System.out.println("item is " + itemId); int selected = ((DeploymentTableBean) itemId).getId() - 1; long duration = Long .parseLong(mainLayout.getMenu().getGeneralStep().getDuration().getValue()); System.out.println("selected " + selected); System.out.println("power fr" + power_fr[selected]); System.out.println("power uk" + power_uk[selected]); System.out.println("power de" + power_de[selected]); TrendWindow trendWindow = new TrendWindow(power_fr[selected], power_uk[selected], power_de[selected], duration); UI.getCurrent().addWindow(trendWindow); } }); return button; } }); vlCpuLoad.addComponent(deploymentTable); OptionGroup chartAspect = new OptionGroup("Chart aspect"); chartAspect.addItem(1); chartAspect.setItemCaption(1, "NORMAL"); chartAspect.addItem(2); chartAspect.setItemCaption(2, "PERCENTAGE"); chartAspect.select(1); chartAspect.setNullSelectionAllowed(false); chartAspect.setImmediate(true); chartAspect.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { //final String valueString = String.valueOf(event.getProperty() // .getValue()); if (co2CountryChart != null) { co2CountryChart.toggleAspect(); } } }); vlCpuLoad.addComponent(chartAspect); chartHl.addComponent(vlCpuLoad); this.compute(); this.co2CountryChart = new CO2CountryChart(sdf.format(new Date()), this.deploymentTable.getItemIds().size(), co2_fr, co2_uk, co2_de, this.sliderCpuLoad.getValue()); chartHl.addComponent(this.co2CountryChart); chartHl.setComponentAlignment(vlCpuLoad, Alignment.TOP_LEFT); chartHl.setComponentAlignment(this.co2CountryChart, Alignment.TOP_RIGHT); this.addComponent(chartHl); } else { Label lblEmpty = new Label("No resources defined."); this.addComponent(lblEmpty); } }