List of usage examples for com.vaadin.ui HorizontalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:edu.nps.moves.mmowgliMobile.ui.CardRenderer2.java
License:Open Source License
public void setMessage(FullEntryView2 mView, ListEntry message, ListView2 messageList, AbstractOrderedLayout layout) {/*w w w. j a va 2 s .com*/ Object key = HSess.checkInit(); CardListEntry wc = (CardListEntry) message; Card c = wc.getCard(); CardType typ = c.getCardType(); layout.removeAllComponents(); layout.setSpacing(true); VerticalLayout cardLay = new VerticalLayout(); cardLay.addStyleName("m-card-render"); cardLay.setWidth("98%"); //100%"); cardLay.setSpacing(true); layout.addComponent(cardLay); HorizontalLayout horl = new HorizontalLayout(); horl.addStyleName("m-card-header"); String stl = CardStyler.getCardBaseStyle(typ); horl.addStyleName(stl); horl.addStyleName(CardStyler.getCardTextColorOverBaseStyle(typ)); horl.setMargin(true); horl.setWidth("100%"); Label lbl = new Label(typ.getTitle());//c.getText()); horl.addComponent(lbl); lbl = new Label("" + getPojoId(message)); lbl.addStyleName("m-text-align-right"); horl.addComponent(lbl); cardLay.addComponent(horl); horl = new HorizontalLayout(); horl.setWidth("100%"); horl.setMargin(true); cardLay.addComponent(horl); lbl = new Label(c.getText()); horl.addComponent(lbl); horl = new HorizontalLayout(); horl.addStyleName("m-card-footer"); horl.setMargin(true); horl.setWidth("100%"); horl.addComponent(lbl = new Label("")); lbl.setWidth("5px"); Image img = new Image(); img.setSource(mediaLocator.locate(c.getAuthor().getAvatar().getMedia())); img.setWidth("30px"); img.setHeight("30px"); horl.addComponent(img); // horl.addComponent(lbl=new Label(c.getAuthorName())); // lbl.setWidth("100%"); // lbl.addStyleName("m-text-align-center"); // horl.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER); // horl.setExpandRatio(lbl, 1.0f); Button authButt = new MyButton(c.getAuthorName(), c, mView); authButt.setStyleName(BaseTheme.BUTTON_LINK); authButt.setWidth("100%"); horl.addComponent(authButt); horl.setComponentAlignment(authButt, Alignment.MIDDLE_CENTER); horl.setExpandRatio(authButt, 1.0f); horl.addComponent(lbl = new HtmlLabel(formatter.format(message.getTimestamp()))); lbl.setWidth("115px"); ; lbl.addStyleName("m-text-align-right"); horl.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER); cardLay.addComponent(horl); // lbl = new Hr(); // layout.addComponent(lbl); lbl = new Label("Child Cards"); layout.addComponent(lbl); lbl.addStyleName("m-text-center"); // lbl = new Hr(); // layout.addComponent(lbl); horl = new HorizontalLayout(); horl.setSpacing(true); horl.setMargin(true); horl.setWidth("100%"); layout.addComponent(horl); horl.addComponent( makeChildGroupButton("Expand", (CardListEntry) message, CardType.getExpandTypeTL(), messageList)); horl.addComponent( makeChildGroupButton("Counter", (CardListEntry) message, CardType.getCounterTypeTL(), messageList)); horl.addComponent( makeChildGroupButton("Adapt", (CardListEntry) message, CardType.getAdaptTypeTL(), messageList)); horl.addComponent( makeChildGroupButton("Explore", (CardListEntry) message, CardType.getExploreTypeTL(), messageList)); HSess.checkClose(key); }
From source file:edu.nps.moves.mmowgliMobile.ui.UserRenderer2.java
License:Open Source License
public void setMessage(FullEntryView2 mView, ListEntry message, ListView2 messageList, AbstractOrderedLayout layout) {/*from w ww . j ava2s. c o m*/ // messageList can be null if coming in from ActionPlan Object key = HSess.checkInit(); UserListEntry wu = (UserListEntry) message; User u = wu.getUser(); layout.removeAllComponents(); HorizontalLayout hlay = new HorizontalLayout(); layout.addComponent(hlay); hlay.addStyleName("m-userview-top"); hlay.setWidth("100%"); hlay.setMargin(true); hlay.setSpacing(true); Image img = new Image(); img.addStyleName("m-ridgeborder"); img.setSource(mediaLocator.locate(u.getAvatar().getMedia())); img.setWidth("90px"); img.setHeight("90px"); hlay.addComponent(img); hlay.setComponentAlignment(img, Alignment.MIDDLE_CENTER); Label lab; hlay.addComponent(lab = new Label()); lab.setWidth("5px"); VerticalLayout vlay = new VerticalLayout(); vlay.setSpacing(true); hlay.addComponent(vlay); hlay.setComponentAlignment(vlay, Alignment.MIDDLE_LEFT); vlay.setWidth("100%"); hlay.setExpandRatio(vlay, 1.0f); HorizontalLayout horl = new HorizontalLayout(); horl.setSpacing(false); vlay.addComponent(horl); vlay.setComponentAlignment(horl, Alignment.BOTTOM_LEFT); horl.addComponent(lab = new Label("name")); lab.addStyleName("m-user-top-label"); //light-text"); horl.addComponent(lab = new HtmlLabel(" " + u.getUserName())); lab.addStyleName("m-user-top-value"); horl = new HorizontalLayout(); horl.setSpacing(false); vlay.addComponent(horl); vlay.setComponentAlignment(horl, Alignment.TOP_LEFT); horl.addComponent(lab = new Label("level")); lab.addStyleName("m-user-top-label"); //light-text"); Level lev = u.getLevel(); if (u.isGameMaster()) { Level l = Level.getLevelByOrdinal(Level.GAME_MASTER_ORDINAL, HSess.get()); if (l != null) lev = l; } horl.addComponent(lab = new HtmlLabel(" " + lev.getDescription())); lab.addStyleName("m-user-top-value"); GridLayout gLay = new GridLayout(); // gLay.setHeight("155px"); // won't size properly gLay.setMargin(true); gLay.addStyleName("m-userview-mid"); gLay.setColumns(2); gLay.setRows(11); gLay.setSpacing(true); gLay.setWidth("100%"); gLay.setColumnExpandRatio(1, 1.0f); layout.addComponent(gLay); addRow(gLay, "user ID:", "" + getPojoId(message)); addRow(gLay, "location:", u.getLocation()); addRow(gLay, "expertise:", u.getExpertise()); addRow(gLay, "affiliation:", u.getAffiliation()); addRow(gLay, "date registered:", formatter.format(u.getRegisterDate())); gLay.addComponent(new Hr(), 0, 5, 1, 5); Container cntr = new CardsByUserContainer<Card>(u); // expects ThreadLocal session to be setup numCards = cntr.size(); addRow(gLay, "cards played:", "" + numCards); cntr = new ActionPlansByUserContainer<Card>(u); // expects ThreadLocal session to be setup numAps = cntr.size(); addRow(gLay, "action plans:", "" + numAps); gLay.addComponent(new Hr(), 0, 8, 1, 8); addRow(gLay, "exploration points:", "" + u.getBasicScore()); addRow(gLay, "innovation points:", "" + u.getInnovationScore()); cardListener = new CardLis(u, mView); apListener = new AppLis(u, mView); layout.addComponent(makeButtons()); HSess.checkClose(key); }
From source file:edu.nps.moves.security.PasswordResetUI.java
License:Open Source License
private void handleChangeTL(User user) { this.user = user; Game g = Game.getTL();/* w w w.j av a 2 s .c o m*/ String brand = g.getCurrentMove().getTitle(); Page.getCurrent().setTitle("Password reset for " + brand + " mmowgli"); HorizontalLayout hLay = new HorizontalLayout(); hLay.setMargin(true); hLay.setWidth("100%"); setContent(hLay); GameLinks gl = GameLinks.getTL(); String blog = gl.getBlogLink(); Label lab; hLay.addComponent(lab = new Label()); hLay.setExpandRatio(lab, 0.5f); VerticalLayout vl = new VerticalLayout(); hLay.addComponent(vl); vl.setWidth(bannerWidthPx); hLay.addComponent(lab = new Label()); hLay.setExpandRatio(lab, 0.5f); vl.addStyleName("m-greyborder"); vl.setMargin(true); vl.setSpacing(true); vl.addComponent(lab = new HtmlLabel("")); lab.addStyleName("m-font-21-bold"); lab.setSizeUndefined(); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); StringBuilder sb = new StringBuilder(); sb.append(thanksHdr1); sb.append(blog); sb.append(thanksHdr2); sb.append(brand); sb.append(thanksHdr3); lab.setValue(sb.toString()); vl.addComponent(lab = new HtmlLabel("")); lab.setHeight("15px"); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); FormLayout fLay = new FormLayout(); fLay.setSizeUndefined(); fLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield) vl.addComponent(fLay); vl.setComponentAlignment(fLay, Alignment.MIDDLE_CENTER); newPw = new PasswordField("New Password"); newPw.setWidth("99%"); fLay.addComponent(newPw); newPw2 = new PasswordField("Again, please"); newPw2.setWidth("99%"); fLay.addComponent(newPw2); HorizontalLayout buttLay = new HorizontalLayout(); buttLay.setSpacing(true); vl.addComponent(buttLay); vl.setComponentAlignment(buttLay, Alignment.TOP_CENTER); NativeButton cancelButt = new NativeButton(); cancelButt.setStyleName("m-cancelButton"); buttLay.addComponent(cancelButt); buttLay.setComponentAlignment(cancelButt, Alignment.BOTTOM_RIGHT); saveButt = new NativeButton(); saveButt.setClickShortcut(ShortcutAction.KeyCode.ENTER); saveButt.setStyleName("m-continueButton"); //m-saveChangesButton"); buttLay.addComponent(saveButt); buttLay.setComponentAlignment(saveButt, Alignment.BOTTOM_RIGHT); cancelButt.addClickListener(this); saveButt.addClickListener(this); }
From source file:edu.vcu.csbc.vahmpexplorer.main.VaHMPExplorer.java
public Component createToolBar(boolean loggedIn) { HorizontalLayout h = new HorizontalLayout(); h.setMargin(true); h.setWidth("100%"); Embedded headerImg = new Embedded(null, new ThemeResource("../vahmpexplorer/img/header.png")); headerImg.setWidth(311, Embedded.UNITS_PIXELS); headerImg.setHeight(45, Embedded.UNITS_PIXELS); headerImg.setType(Embedded.TYPE_IMAGE); headerImg.setStyleName(BaseTheme.BUTTON_LINK); headerImg.setDescription("Version " + HelpMessages.VERSION); h.addComponent(headerImg);/*from ww w.j a va2 s . c o m*/ if (loggedIn) { Panel panel = new Panel(); Label loggedInUser = new Label( "Welcome: " + user.getFirstName() + " " + user.getLastName() + " (" + user.getLogin() + ")"); changePassword = new Button("Change Password"); changePassword.setStyleName(BaseTheme.BUTTON_LINK); changePassword.addListener((Button.ClickListener) this); logout = new Button("Logout"); logout.setStyleName(BaseTheme.BUTTON_LINK); logout.addListener((Button.ClickListener) this); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.addComponent(changePassword); hl.addComponent(logout); panel.addComponent(loggedInUser); panel.addComponent(hl); h.addComponent(panel); h.setComponentAlignment(panel, Alignment.MIDDLE_RIGHT); } PopupView help = new PopupView(new MainHelpPopup()); h.addComponent(help); h.setComponentAlignment(help, Alignment.MIDDLE_RIGHT); h.setComponentAlignment(headerImg, Alignment.MIDDLE_LEFT); return h; }
From source file:edu.vserver.exercises.videoMcq.QuestionForm.java
License:Apache License
/** * Builds UI components and the layout for them. *///from w w w . j a v a 2 s. c om private void doLayout() { VerticalLayout questionUI = new VerticalLayout(); HorizontalLayout mainButtons = new HorizontalLayout(); //mainButtons.setMargin(true); mainButtons.setSpacing(true); this.newQuestionBtn.setWidth(100, Unit.PIXELS); this.cancelButton.setWidth(100, Unit.PIXELS); this.saveButton.setWidth(100, Unit.PIXELS); mainButtons.addComponents(this.newQuestionBtn, this.cancelButton, this.saveButton); questionUI.addComponent(mainButtons); this.initTextFields(); this.inputLayout.setSpacing(true); this.inputLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); VerticalLayout questionLayout = new VerticalLayout(); this.timeLayout.setMargin(new MarginInfo(true, false, true, false)); this.timeLayout.addComponents(new Label("<strong>Time:</strong>", ContentMode.HTML), this.timeLabel, new Label("<strong> / </strong>", ContentMode.HTML), this.durationLabel); this.timeLayout.setSpacing(true); questionLayout.addComponents(this.timeLayout, this.questionField); VerticalLayout correctAnswers = new VerticalLayout(); correctAnswers.addComponents(this.answerField, this.answerDescriptionField); VerticalLayout wrongAnswers = new VerticalLayout(); wrongAnswers.setCaption("Incorrect answer choices"); HorizontalLayout wrongAnswerButtons = new HorizontalLayout(); wrongAnswerButtons.setDefaultComponentAlignment(Alignment.TOP_CENTER); wrongAnswerButtons.setSpacing(true); wrongAnswerButtons.setMargin(true); wrongAnswerButtons.addComponents(this.addIncorrectAnswer, this.clearIncorrectAnswers); Panel wrongAswersScroller = new Panel(); wrongAswersScroller.setSizeUndefined(); wrongAswersScroller.setHeight(100, Unit.PIXELS); wrongAswersScroller.setWidth(215, Unit.PIXELS); wrongAswersScroller.addStyleName("borderless"); wrongAswersScroller.setContent(this.wrongAnswersLayout); wrongAnswers.addComponents(wrongAnswerButtons, wrongAswersScroller); this.inputLayout.addComponents(questionLayout, correctAnswers, wrongAnswers); questionUI.addComponent(this.inputLayout); this.setCompositionRoot(questionUI); }
From source file:edu.vserver.exercises.videoMcq.QuestionWindow.java
License:Apache License
/** * Constructs a question window object for showing the question with the * answer choices and submit- and next-button. *//*from www. j a v a 2 s. c o m*/ public QuestionWindow() { super(); setModal(true); setResizable(false); setClosable(false); addStyleName("questionWindow"); optionGroup.setImmediate(true); optionGroup.addStyleName("answerOptions"); HorizontalLayout dots = new HorizontalLayout(); VerticalLayout v = new VerticalLayout(); v.setSpacing(true); v.setMargin(true); HorizontalLayout btnFooter = new HorizontalLayout(); btnFooter.addStyleName("buttons"); btnFooter.setMargin(true); btnFooter.setSpacing(true); btnFooter.setWidth(100, Unit.PERCENTAGE); btnFooter.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); submitButton = ComponentFactory.createLargeBlueButton("Submit", true, null); submitButton.setEnabled(false); nextButton = ComponentFactory.createLargeBlueButton("Next", true, SPH_Theme.NEXT_ICON_16PX); btnFooter.addComponents(submitButton, nextButton); v.addComponents(qLabel, optionGroup, btnFooter, dots); this.setContent(v); this.createButtonListeners(); }
From source file:eu.eco2clouds.portal.component.AdaptationReport.java
License:Apache License
private void render() { this.setSpacing(true); this.setMargin(true); this.setSizeFull(); final HorizontalLayout tables = new HorizontalLayout(); tables.setSpacing(true);/* w w w . j a va 2 s . c o m*/ tables.setMargin(false); tables.setSizeFull(); this.actionTable = new AdaptationActionTable(this.generateActions()); tables.addComponent(actionTable); //tables.addComponent(new ViolationList()); Button btnRefresh = new Button("Refresh"); btnRefresh.addClickListener(this); this.addComponent(tables); this.addComponent(btnRefresh); }
From source file:eu.eco2clouds.portal.component.apwizard.APText.java
License:Apache License
private void render() { this.removeAllComponents(); this.setMargin(true); this.setSpacing(true); this.setSizeFull(); this.setWidth("400px"); textArea.setSizeFull();//from ww w. ja v a2 s . co m textArea.setImmediate(true); ApplicationProfileParserManager apm = new ApplicationProfileParserManager(); try { //textArea.setValue(apm.deserialize(((E2CPortal) UI.getCurrent()).getSessionStatus().getApplicationProfile())); textArea.setValue(Parser.getJSONApplicationProfile( ((E2CPortal) UI.getCurrent()).getSessionStatus().getApplicationProfile())); } catch (JsonMappingException ex) { Logger.getLogger(APText.class.getName()).log(Level.SEVERE, null, ex); textArea.setValue("error in creating the application profile"); } catch (IOException ex) { Logger.getLogger(APText.class.getName()).log(Level.SEVERE, null, ex); textArea.setValue("error in creating the application profile"); } this.addComponent(textArea); HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSpacing(true); btnLayout.setMargin(true); Button btnRefresh = new Button("Refresh"); btnRefresh.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { update(); } }); btnLayout.addComponent(btnRefresh); Button btnSubmit = new Button("Submit"); btnSubmit.addClickListener(this); btnLayout.addComponent(btnSubmit); btnLayout.setComponentAlignment(btnSubmit, Alignment.BOTTOM_RIGHT); btnLayout.setComponentAlignment(btnRefresh, Alignment.BOTTOM_RIGHT); this.addComponent(btnLayout); this.setExpandRatio(textArea, 1.0f); }
From source file:eu.eco2clouds.portal.component.apwizard.GECWindow.java
License:Apache License
private void render() { this.center(); this.setModal(true); Chart percentageChart = new Chart(ChartType.PIE); percentageChart.setImmediate(true);/*w ww . ja va 2s . c om*/ Configuration conf = percentageChart.getConfiguration(); conf.setTitle("Power sources: " + combination); PlotOptionsPie pie = new PlotOptionsPie(); pie.setShadow(false); conf.setPlotOptions(pie); conf.getTooltip().setValueSuffix("%"); DataSeries innerSeries = new DataSeries(); innerSeries.setName("Sources"); PlotOptionsPie innerPieOptions = new PlotOptionsPie(); innerSeries.setPlotOptions(innerPieOptions); innerPieOptions.setSize(237); innerPieOptions.setDataLabels(new Labels()); innerPieOptions.getDataLabels().setFormatter("this.y > 0.001 ? this.point.name : null"); innerPieOptions.getDataLabels().setColor(new SolidColor(255, 255, 255)); innerPieOptions.getDataLabels().setDistance(-30); Color[] innerColors = Arrays.copyOf(colors, 2); innerSeries.setData(new String[] { "green", "non-green" }, new Number[] { sp.getGEC(), (100 - sp.getGEC()) }, new Color[] { SolidColor.GREEN, SolidColor.GRAY }); DataSeries outerSeries = new DataSeries(); outerSeries.setName("GEC"); PlotOptionsPie outerSeriesOptions = new PlotOptionsPie(); outerSeries.setPlotOptions(outerSeriesOptions); outerSeriesOptions.setInnerSize(237); outerSeriesOptions.setSize(318); outerSeriesOptions.setDataLabels(new Labels()); outerSeriesOptions.getDataLabels() .setFormatter("this.y > 0.001 ? ''+ this.point.name +': '+ this.y +'%' : null"); DataSeriesItem[] outerItems = new DataSeriesItem[9]; outerItems[0] = new DataSeriesItem("wind", sp.getWind(), SolidColor.GREEN); outerItems[1] = new DataSeriesItem("solar", sp.getSolar(), SolidColor.GREEN); outerItems[2] = new DataSeriesItem("renewable", sp.getRenewable(), SolidColor.GREEN); outerItems[3] = new DataSeriesItem("nuclear", sp.getNuclear(), SolidColor.GRAY); outerItems[4] = new DataSeriesItem("oil", sp.getOil(), SolidColor.GRAY); outerItems[5] = new DataSeriesItem("gaz", sp.getGaz(), SolidColor.GRAY); outerItems[6] = new DataSeriesItem("hydro", sp.getHydro(), SolidColor.GRAY); outerItems[7] = new DataSeriesItem("coal", sp.getCoal(), SolidColor.GRAY); outerItems[8] = new DataSeriesItem("other", sp.getOther(), SolidColor.GRAY); outerSeries.setData(Arrays.asList(outerItems)); conf.setSeries(innerSeries, outerSeries); percentageChart.drawChart(conf); HorizontalLayout hl = new HorizontalLayout(); hl.setSizeFull(); hl.setMargin(true); hl.setSpacing(false); hl.addComponent(percentageChart); this.setContent(hl); }
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 w w . j a v a 2s. c o m 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); } }