List of usage examples for com.vaadin.ui Label setIcon
@Override public void setIcon(Resource icon)
From source file:de.mendelson.comm.as2.webclient2.AS2WebUI.java
public Label generateImageLabel(ThemeResource resource) { Label label = new Label(); label.setContentMode(Label.CONTENT_XHTML); label.setIcon(resource); label.setValue("<img src=\"" + this.getThemeURI() + resource.getResourceId() + "\" />"); return (label); }
From source file:de.mendelson.comm.as2.webclient2.TransactionDetailsDialog.java
private Label generateImageLabel(ThemeResource resource) { Label label = new Label(); label.setContentMode(Label.CONTENT_XHTML); label.setIcon(resource); label.setValue("<img src=\"" + themeURI + resource.getResourceId() + "\" />"); return (label); }
From source file:facs.ui.BookAdminUI.java
License:Open Source License
private Component errorView() { Label label = new Label(); label.addStyleName(ValoTheme.LABEL_FAILURE); label.setIcon(FontAwesome.FROWN_O); label.setValue(/*from w ww .j a va 2 s . c o m*/ "Initialization has failed! Are you logged out? Please try to login! If the problem continues please contact info@qbic.uni-tuebingen.de"); return label; }
From source file:fr.univlorraine.mondossierweb.views.FavorisMobileView.java
License:Apache License
/** * Initialise la vue// ww w. j ava 2 s. com */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) { removeAllComponents(); /* Style */ setSizeFull(); liste_types_inscrits = new LinkedList<String>(); liste_types_inscrits.add("ELP"); liste_types_inscrits.add("VET"); liste_type_arbo = new LinkedList<String>(); liste_type_arbo.add("CMP"); liste_type_arbo.add("VET"); List<Favoris> lfav = favorisController.getFavoris(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton info infoButton = new Button(); infoButton.setIcon(FontAwesome.INFO); infoButton.setStyleName("v-nav-button"); infoButton.addClickListener(e -> { /** * NOUVELLE VERSION */ Notification note = new Notification( applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()), "", Notification.TYPE_TRAY_NOTIFICATION, true); note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(6000); note.show(UI.getCurrent().getPage()); /** * ANCIENNE VERSION */ /* //afficher message HelpMobileWindow hbw = new HelpMobileWindow(applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()),applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),false); UI.getCurrent().addWindow(hbw); */ }); navbar.addComponent(infoButton); navbar.setComponentAlignment(infoButton, Alignment.MIDDLE_LEFT); //Title Label labelFav = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale())); labelFav.setStyleName("v-label-navbar"); navbar.addComponent(labelFav); navbar.setComponentAlignment(labelFav, Alignment.MIDDLE_CENTER); //Bouton Search Button searchButton = new Button(); searchButton.setIcon(FontAwesome.SEARCH); searchButton.setStyleName("v-nav-button"); navbar.addComponent(searchButton); navbar.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); searchButton.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); navbar.setExpandRatio(labelFav, 1); addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); FormLayout labelLayout = new FormLayout(); labelLayout.setSizeFull(); labelLayout.setMargin(false); labelLayout.setSpacing(false); Label infoLabel = new Label(applicationContext.getMessage(NAME + ".info.label", null, getLocale())); infoLabel.setStyleName(ValoTheme.LABEL_SMALL); infoLabel.setIcon(FontAwesome.INFO_CIRCLE); infoLabel.setWidth("100%"); labelLayout.addComponent(infoLabel); globalLayout.addComponent(labelLayout); if (lfav != null && lfav.size() > 0) { if (favorisContientVet(lfav)) { Panel vetPanel = new Panel( applicationContext.getMessage(NAME + ".vetpanel.title", null, getLocale())); vetPanel.setStyleName("centertitle-panel"); vetPanel.addStyleName("v-colored-panel-caption"); vetPanel.setSizeFull(); VerticalLayout vetLayout = new VerticalLayout(); vetLayout.setSizeFull(); vetLayout.setHeight(null); int i = 0; for (Favoris fav : lfav) { if (fav.getId().getTypfav().equals(Utils.VET)) { i++; HorizontalLayout favVetLayout = new HorizontalLayout(); favVetLayout.setSizeFull(); favVetLayout.setMargin(true); favVetLayout.setSpacing(true); favVetLayout.setStyleName("v-layout-multiline"); favVetLayout.setWidth("100%"); favVetLayout.setHeight("100%"); Button codeButton = new Button(fav.getId().getIdfav()); codeButton.setCaption(fav.getId().getIdfav()); Utils.setButtonStyle(codeButton); codeButton.setWidth("90px"); codeButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(), fav.getId().getIdfav())); Utils.setButtonStyle(libButton); libButton.setHeight("100%"); libButton.setWidth("100%"); libButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); favVetLayout.addComponent(codeButton); //favVetLayout.setComponentAlignment(codeButton, Alignment.MIDDLE_CENTER); favVetLayout.addComponent(libButton); favVetLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER); favVetLayout.setExpandRatio(libButton, 1); vetLayout.addComponent(favVetLayout); if (i > 1) { favVetLayout.addStyleName("line-separator"); } } } vetPanel.setContent(vetLayout); globalLayout.addComponent(vetPanel); } if (favorisContientElp(lfav)) { Panel elpPanel = new Panel( applicationContext.getMessage(NAME + ".elppanel.title", null, getLocale())); elpPanel.setStyleName("centertitle-panel"); elpPanel.addStyleName("v-colored-panel-caption"); elpPanel.setSizeFull(); VerticalLayout elpLayout = new VerticalLayout(); elpLayout.setSizeFull(); elpLayout.setHeight(null); int i = 0; for (Favoris fav : lfav) { if (fav.getId().getTypfav().equals(Utils.ELP)) { i++; HorizontalLayout favElpLayout = new HorizontalLayout(); favElpLayout.setSizeFull(); favElpLayout.setMargin(true); favElpLayout.setSpacing(true); favElpLayout.setStyleName("v-layout-multiline"); favElpLayout.setWidth("100%"); favElpLayout.setHeight("100%"); Button codeButton = new Button(fav.getId().getIdfav()); Utils.setButtonStyle(codeButton); codeButton.setWidth("90px"); codeButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(), fav.getId().getIdfav())); Utils.setButtonStyle(libButton); libButton.setHeight("100%"); libButton.setWidth("100%"); libButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); favElpLayout.addComponent(codeButton); favElpLayout.addComponent(libButton); favElpLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER); favElpLayout.setExpandRatio(libButton, 1); elpLayout.addComponent(favElpLayout); if (i > 1) { favElpLayout.addStyleName("line-separator"); } } } elpPanel.setContent(elpLayout); globalLayout.addComponent(elpPanel); } } labelAucunFavoriLayout = new HorizontalLayout(); labelAucunFavoriLayout.setMargin(true); labelAucunFavoriLayout.setSizeFull(); Button aucunFavoris = new Button( applicationContext.getMessage(NAME + ".favoris.aucun", null, getLocale())); aucunFavoris.setStyleName("v-nav-button"); aucunFavoris.addStyleName(ValoTheme.BUTTON_LINK); aucunFavoris.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); labelAucunFavoriLayout.addComponent(aucunFavoris); labelAucunFavoriLayout.setVisible(false); globalLayout.addComponent(labelAucunFavoriLayout); if (lfav == null || lfav.size() == 0) { labelAucunFavoriLayout.setVisible(true); } //addComponent(globalLayout); contentLayout.setStyleName("v-scrollableelement"); contentLayout.addComponent(globalLayout); addComponent(contentLayout); setExpandRatio(contentLayout, 1); } }
From source file:gov.va.ds4p.ds4pmobileportal.ui.LoginView.java
License:Open Source License
private Panel getLoginPanel() { Panel p = new Panel(); VerticalLayout v = (VerticalLayout) p.getContent(); v.setSpacing(true);/*from ww w .ja v a 2 s. com*/ v.setHeight("300px"); Label sandi = new Label(""); sandi.setIcon(new ThemeResource("onc_s_and_i_logo.png")); v.addComponent(sandi); final TextField username = new TextField("User Name:"); final PasswordField userpass = new PasswordField("Password:"); username.setWidth("500px"); userpass.setWidth("500px"); v.addComponent(username); v.addComponent(userpass); HorizontalLayout h = new HorizontalLayout(); h.setSpacing(true); h.setWidth("500px"); Button okBTN = new Button("Ok"); Label l = new Label(""); l.setIcon(new ThemeResource("header-logo.png")); h.addComponent(okBTN); h.addComponent(l); v.addComponent(h); okBTN.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { userN = (String) username.getValue(); userP = (String) userpass.getValue(); authenticate(); if (userProfile == null) { getWindow().showNotification("Login Error", "Incorrect username or password combination.", Window.Notification.TYPE_WARNING_MESSAGE); } else { AdminContext.getSessionAttributes().setUserProfile(userProfile); ((MyVaadinApplication) getApplication()).loginComplete(); } } }); okBTN.setImmediate(true); return p; }
From source file:helpers.Utils.java
License:Open Source License
public static HorizontalLayout questionize(Component c, final String info, final String header) { final HorizontalLayout res = new HorizontalLayout(); res.setSpacing(true);// ww w.jav a 2 s.c om if (c instanceof CustomVisibilityComponent) { CustomVisibilityComponent custom = (CustomVisibilityComponent) c; c = custom.getInnerComponent(); custom.addListener(new VisibilityChangeListener() { @Override public void setVisible(boolean b) { res.setVisible(b); } }); } res.setVisible(c.isVisible()); res.setCaption(c.getCaption()); c.setCaption(null); res.addComponent(c); PopupView pv = new PopupView(new Content() { @Override public Component getPopupComponent() { Label l = new Label(info, ContentMode.HTML); l.setCaption(header); l.setIcon(FontAwesome.INFO); l.setWidth("250px"); l.addStyleName("info"); return new VerticalLayout(l); } @Override public String getMinimizedValueAsHTML() { return "[?]"; } }); pv.setHideOnMouseOut(false); res.addComponent(pv); return res; }
From source file:io.subutai.plugin.accumulo.ui.wizard.WelcomeStep.java
public WelcomeStep(final Wizard wizard) { setSizeFull();//from w ww . j av a 2 s . c o m GridLayout grid = new GridLayout(10, 6); grid.setSpacing(true); grid.setMargin(true); grid.setSizeFull(); Label welcomeMsg = new Label("<center><h2>Welcome to Accumulo Installation Wizard!</h2>"); welcomeMsg.setContentMode(ContentMode.HTML); grid.addComponent(welcomeMsg, 3, 1, 6, 2); Label logoImg = new Label(); // Image as a file resource logoImg.setIcon(new FileResource(FileUtil.getFile(AccumuloPortalModule.MODULE_IMAGE, this))); logoImg.setContentMode(ContentMode.HTML); logoImg.setHeight(56, Unit.PIXELS); logoImg.setWidth(220, Unit.PIXELS); grid.addComponent(logoImg, 1, 3, 2, 5); Button startOverHadoopNZK = new Button("Start over Hadoop & ZK installation"); startOverHadoopNZK.setId("startOverHadoopNZK"); startOverHadoopNZK.addStyleName("default"); grid.addComponent(startOverHadoopNZK, 4, 4, 4, 4); grid.setComponentAlignment(startOverHadoopNZK, Alignment.BOTTOM_RIGHT); startOverHadoopNZK.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { wizard.init(); wizard.getConfig().setSetupType(SetupType.OVER_HADOOP_N_ZK); wizard.next(); } }); setContent(grid); }
From source file:org.agocontrol.site.viewlet.dashboard.BuildingControlPanel.java
License:Apache License
/** * Default constructor./* w ww . ja va 2 s . co m*/ */ public BuildingControlPanel() { site = ((AgoControlSiteUI) UI.getCurrent()).getSite(); siteContext = site.getSiteContext(); entityManager = siteContext.getObject(EntityManager.class); layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.setSizeFull(); layout.setStyleName(Reindeer.LAYOUT_WHITE); final Label title = new Label("Control Panel"); title.setIcon(getSite().getIcon("inventory")); title.setStyleName(Reindeer.LABEL_H2); layout.addComponent(title); layout.setExpandRatio(title, 0); elementLayout = new VerticalLayout(); elementLayout.setSpacing(true); elementLayout.setMargin(false); layout.addComponent(elementLayout); layout.setExpandRatio(elementLayout, 1); roomIcon = site.getIcon("room"); deviceIcon = site.getIcon("device"); temperatureIcon = site.getIcon("temperature"); brightnessIcon = site.getIcon("brightness"); humidityIcon = site.getIcon("humidity"); eventIcon = site.getIcon("event"); setCompositionRoot(layout); // the Refresher polls automatically final Refresher refresher = new Refresher(); refresher.setRefreshInterval(200); refresher.addListener(new Refresher.RefreshListener() { @Override public void refresh(final Refresher refresher) { while (!recordsQueue.isEmpty()) { final List<Record> records = recordsQueue.remove(); if (records.size() > 0) { final Record record = records.get(0); final RecordSet recordSet = record.getRecordSet(); final Element element = recordSet.getElement(); final GridLayout recordsLayout = recordsLayouts.get(element.getElementId()); if (recordsLayout == null) { continue; } final int columnIndex = recordSet.getType().ordinal(); final int rowIndex = 0; if (recordsLayout.getComponent(columnIndex, rowIndex) != null) { continue; } final VerticalLayout recordLayout = new VerticalLayout(); recordLayout.setSpacing(true); final Resource recordIcon; switch (recordSet.getType()) { case TEMPERATURE: recordIcon = temperatureIcon; break; case BRIGHTNESS: recordIcon = brightnessIcon; break; case HUMIDITY: recordIcon = humidityIcon; break; default: recordIcon = eventIcon; break; } final Embedded embedded = new Embedded(null, recordIcon); recordLayout.addComponent(embedded); recordLayout.setExpandRatio(embedded, 0.1f); embedded.setWidth(32, Unit.PIXELS); embedded.setHeight(32, Unit.PIXELS); final Label label = new Label(); recordLayout.addComponent(label); recordLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT); final String recordUnit = recordSet.getUnit(); final String displayUnit = DisplayValueConversionUtil.getDisplayUnit(recordSet.getType(), recordUnit); final double displayValue = DisplayValueConversionUtil.convertValue(recordSet.getType(), recordUnit, displayUnit, record.getValue()); final String displayValueString = DisplayValueConversionUtil.formatDouble(displayValue); label.setValue(displayValueString + " " + displayUnit); label.setDescription(record.getCreated().toString()); recordsLayout.addComponent(recordLayout, columnIndex, rowIndex); } } } }); addExtension(refresher); }
From source file:org.agocontrol.site.viewlet.dashboard.EventPanel.java
License:Apache License
/** * Default constructor which constructs components. *//*from w w w .j av a2s . c o m*/ public EventPanel() { final VerticalLayout layout = new VerticalLayout(); setCompositionRoot(layout); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); layout.setStyleName(Reindeer.LAYOUT_WHITE); final Label title = new Label("Events"); title.setIcon(getSite().getIcon("event")); title.setStyleName(Reindeer.LABEL_H2); layout.addComponent(title); layout.setExpandRatio(title, 0); final List<FieldDescriptor> fieldDescriptors = AgoControlSiteFields .getFieldDescriptors(org.agocontrol.model.Event.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); final Site site = ((AgoControlSiteUI) UI.getCurrent()).getSite(); final EntityManager entityManager = site.getSiteContext().getObject(EntityManager.class); container = new LazyEntityContainer<org.agocontrol.model.Event>(entityManager, true, false, false, org.agocontrol.model.Event.class, 50, new String[] { "created" }, new boolean[] { false }, "eventId"); ContainerUtil.addContainerProperties(container, fieldDescriptors); final Table table = new FormattingTable(); grid = new Grid(table, container, false); layout.addComponent(grid); layout.setExpandRatio(grid, 1); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); //grid.setSizeUndefined(); //grid.setSizeUndefined(); table.setColumnCollapsed("eventId", true); table.setColumnCollapsed("modified", true); table.setColumnCollapsed("processed", true); table.setColumnCollapsed("processingError", true); final Company company = site.getSiteContext().getObject(Company.class); container.removeDefaultFilters(); container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId())); }
From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java
License:Open Source License
private Component buildDisclaimer() { final HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true);/*w w w .ja v a 2s .c o m*/ fields.addStyleName("disclaimer"); final Label disclaimer = new Label(uiProperties.getDemo().getDisclaimer(), ContentMode.HTML); disclaimer.setCaption(i18n.getMessage("label.login.disclaimer")); disclaimer.setIcon(FontAwesome.EXCLAMATION_CIRCLE); disclaimer.setId("login-disclaimer"); disclaimer.setWidth("525px"); fields.addComponent(disclaimer); return fields; }