List of usage examples for com.vaadin.ui Button setStyleName
@Override public void setStyleName(String style)
From source file:dhbw.ka.mwi.businesshorizon2.ui.parameterScreen.ParameterScreenViewImpl.java
License:Open Source License
/** * *///from w w w . j a v a 2s . c o m private void addLogoutButton() { Button logoutButton = new Button("Logout"); logoutButton.setStyleName("default"); logoutButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 7411091035775152765L; @Override public void buttonClick(ClickEvent event) { //Callback-Methode, ruft die eigentliche Logout-Methode im Presenter auf presenter.doLogout(); } }); //LogoutButton hinzufgen und ausrichten logoutButton.setEnabled(true); right.addComponent(logoutButton); right.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabActionPlans.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.addStyleName("m-padding15"); flowLay.setSpacing(true);//from w ww .j ava 2 s .c om Label titleLab = new Label("All Plans"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("The Action Plans tab displays a list of all action plans in the game."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt.setDescription("Open a page where you can submit a request to create an action plan"); flowLay.addComponent(requestActionPlanButt); AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-headling { blah:blah;} ) loadTableTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabMyPlans.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); flowLay.addStyleName("m-padding15"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.setSpacing(true);//from www . j av a2 s. c om Label titleLab = new Label("My Plans"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("Choose a link below to display the filtered list of your choice."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Label lab; flowLay.addComponent(lab = new Label()); lab.setHeight("25px"); Button myPlansButt = new Button("My Plans"); //myPlansButt.setStyleName(BaseTheme.BUTTON_LINK); //flowLay.addComponent(myPlansButt); Button requestActionPlanButt = new IDButton("Request Action Plan Authorship", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt .setDescription("Open a page where you can submit a request to be an action plan author"); flowLay.addComponent(requestActionPlanButt); // Note for the above button request flowLay.addComponent(new Label("(appears in another browser tab)")); ClickListener firstLis; myPlansButt.addClickListener(firstLis = new ButtListener2(buildMyPlansFilter(), null)); // @HibernateUserRead AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-heading { blah:blah;} ) firstLis.buttonClick(null); // loads the table }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabNeedAuthors.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); flowLay.addStyleName("m-padding15"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.setSpacing(true);/*from ww w . j av a2 s.co m*/ Label titleLab = new Label("Action Plans needing Authors"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("You may sign up for authorship in any of these plans."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt .setDescription("Open a page where you can submit a request to be an action plan author"); flowLay.addComponent(requestActionPlanButt); AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-headling { blah:blah;} ) loadTableTL(); }
From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabRecent.java
License:Open Source License
private Button buildButt(String s) { Button b = new NativeButton(s); b.setStyleName(BaseTheme.BUTTON_LINK); b.addStyleName("borderless"); b.addStyleName("m-actionplan-comments-button"); b.addClickListener(this); return b;/*from ww w . j a v a 2 s.c o m*/ }
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) {//from w w w.ja v a 2 s .c om 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.MmowgliFooter2.java
License:Open Source License
@SuppressWarnings("serial") public MmowgliFooter2() { Button homeButton = new Button(VaadinIcons.HOME); homeButton.setStyleName("no-decoration"); addComponent(homeButton);//from w w w .j a v a2 s . co m homeButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { navmgr.navigateTo(new GameDataCategoriesView2()); } }); }
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);// w w w .j a va 2 s . 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); } }
From source file:eu.eco2clouds.portal.component.ExperimentDetails.java
License:Apache License
private void render() { try {//from www . ja v a 2s . com this.setSpacing(false); this.setMargin(false); this.setHeight("200px"); VerticalLayout details = new VerticalLayout(); details.setSpacing(true); details.setMargin(false); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-YYYY hh:mm"); SimpleDateFormat edf = new SimpleDateFormat("dd 'days' hh 'hours' mm ' minutes'"); details.addComponent(new Label("<b>id</b>: " + experiment.getId(), ContentMode.HTML)); details.addComponent(new Label("<b>user</b>: " + experiment.getBonfireUserId() + " <b>group</b>: " + experiment.getBonfireGroupId(), ContentMode.HTML)); if (!experiment.getStatus().equalsIgnoreCase("terminated")) { details.addComponent(new Label( "<b>started</b>: " + sdf.format(new Date(experiment.getStartTime())) + " <b>planned termination</b>: " + sdf.format(new Date(experiment.getEndTime())), ContentMode.HTML)); //details.addComponent(new Label(edf.format(new Date(experiment.getEndTime() - experiment.getStartTime())) + " to go")); } else { details.addComponent(new Label( "<b>started</b>: " + sdf.format(new Date(experiment.getStartTime())) + " <b>terminated</b>: " + sdf.format(new Date(experiment.getEndTime())), ContentMode.HTML)); details.addComponent(new Label( "lasted for " + edf.format(new Date(experiment.getEndTime() - experiment.getStartTime())))); } final String ap = Parser .getJSONApplicationProfile(Parser.getApplicationProfile(experiment.getApplicationProfile())); Button btnApplicationProfile = new Button("Show Application Profile"); btnApplicationProfile.setStyleName(BaseTheme.BUTTON_LINK); btnApplicationProfile.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new APWindow(ap)); } }); details.addComponent(btnApplicationProfile); this.addComponent(details); this.setComponentAlignment(details, Alignment.MIDDLE_LEFT); Label spacing = new Label(" "); this.addComponent(spacing); this.setComponentAlignment(details, Alignment.MIDDLE_LEFT); /* if (!experiment.getStatus().equalsIgnoreCase("terminated")) { Button terminateBtn = new Button("Terminate"); this.addComponent(terminateBtn); this.setComponentAlignment(terminateBtn, Alignment.MIDDLE_RIGHT); }*/ this.setExpandRatio(spacing, 20.0f); } catch (JsonMappingException ex) { Logger.getLogger(ExperimentDetails.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ExperimentDetails.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:eu.eco2clouds.portal.component.MainMenu.java
License:Apache License
public MainMenu() { this.setHeight("50px"); this.setSpacing(true); this.setMargin(true); this.setWidth("100%"); Label spaceLabel = new Label(" "); this.addComponent(spaceLabel); Button homePageBtn = new Button(""); homePageBtn.setIcon(new ThemeResource("img/homepage.png")); homePageBtn.setDescription("Home page"); homePageBtn.setStyleName(Reindeer.BUTTON_LINK); homePageBtn.addClickListener(new Button.ClickListener() { @Override//from w w w . jav a 2s. com public void buttonClick(ClickEvent event) { int status = ((E2CPortal) UI.getCurrent()).getSessionStatus().getStatus(); if (status != SessionStatus.HOME) { ((E2CPortal) UI.getCurrent()).getSessionStatus().setStatus(SessionStatus.HOME); ((E2CPortal) UI.getCurrent()).render(); } } }); this.addComponent(homePageBtn); Button addExperimentBtn = new Button(""); addExperimentBtn.setIcon(new ThemeResource("img/add.png")); addExperimentBtn.setDescription("Add new experiment"); addExperimentBtn.setStyleName(Reindeer.BUTTON_LINK); addExperimentBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { int status = ((E2CPortal) UI.getCurrent()).getSessionStatus().getStatus(); if (status != SessionStatus.SUBMITAP) { ((E2CPortal) UI.getCurrent()).getSessionStatus().setStatus(SessionStatus.SUBMITAP); ((E2CPortal) UI.getCurrent()).render(); } } }); this.addComponent(addExperimentBtn); Button notificationBtn = new Button("Notifications"); notificationBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { int status = ((E2CPortal) UI.getCurrent()).getSessionStatus().getStatus(); if (status != SessionStatus.NOTIFICATIONS) { ((E2CPortal) UI.getCurrent()).getSessionStatus().setStatus(SessionStatus.NOTIFICATIONS); ((E2CPortal) UI.getCurrent()).render(); } } }); //this.addComponent(notificationBtn); Button logoutBtn = new Button(""); logoutBtn.setIcon(new ThemeResource("img/logout.png")); logoutBtn.setDescription("Logout"); logoutBtn.setStyleName(Reindeer.BUTTON_LINK); logoutBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { ((E2CPortal) UI.getCurrent()).getSessionStatus().setStatus(SessionStatus.UNLOGGED); ((E2CPortal) UI.getCurrent()).render(); } }); this.addComponent(logoutBtn); /*Button refreshBtn = new Button(" "); if (Configuration.refreshUIActive) { refreshBtn.setCaption("Disable autorefresh"); } else { refreshBtn.setCaption("Enable autorefresh"); } refreshBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { ((E2CPortal) UI.getCurrent()).toggleRefresh(); Configuration.refreshUIActive = !Configuration.refreshUIActive; if (Configuration.refreshUIActive) { event.getButton().setCaption("Disable autorefresh"); } else { event.getButton().setCaption("Enable autorefresh"); } } }); this.addComponent(refreshBtn);*/ this.setExpandRatio(spaceLabel, 20.0f); this.setComponentAlignment(homePageBtn, Alignment.MIDDLE_RIGHT); this.setComponentAlignment(addExperimentBtn, Alignment.MIDDLE_RIGHT); //this.setComponentAlignment(notificationBtn, Alignment.MIDDLE_LEFT); this.setComponentAlignment(logoutBtn, Alignment.MIDDLE_RIGHT); //this.setComponentAlignment(refreshBtn, Alignment.MIDDLE_RIGHT); }