List of usage examples for com.vaadin.ui Label Label
public Label(String text, ContentMode contentMode)
From source file:at.punkt.lodms.web.dialog.AboutDialog.java
License:GNU General Public License
public AboutDialog() { super("About Open Data Interoperability Platform"); Label aboutText = new Label("<div class=\"lodms_about\" style=\"width:705px;white-space: normal;\">" + "<p>The Open Data Interoperability Platform (ODIP) is developed <a href=\"http://tenforce.com\">Tenforce</a> in the context of <a href=\"http://www.opendatasupport.eu\">Open Data Support</a>, a project funded by <a href=\"http://ec.europa.eu/dgs/connect/\">DG CONNECT</a> of the European Commission underSMART 2012/0107Lot 2:Provision of services for the Publication, Access and Reuse of Open Public Data across the European Union, through existing open data portals(Contract No. 30-CE-0530965/00-17).</p>" + "<p><a href=\"http://www.opendatasupport.eu\">Open Data Support</a> is run by <a href=\"http://www.pwc.com/gx/en/eu-institutions-services/index.jhtml\">PwC EU Services</a>.</p>" + "<p>The Linked (Open) Data Management Suite is developed by the <a href=\"http://www.semantic-web.at\">Semantic Web Company</a> in the course of the <a href=\"http://lod2.eu\">LOD2</a> FP7 project.</p>" + "<p>It is a Java based Linked (Open) Data Management Suite to schedule and monitor required ETL: Extract - Transform - Load</br>jobs for smooth and efficient Linked (Open) Data Management for web-based Linked Open Data portals (LOD platforms)</br>as well as for sustainable Data Management and Data Integration usage inside of the enterprise / the organisation.</p>" + "<p>Release 1.0, <a href=\"http://www.gnu.org/licenses/gpl-2.0.html\">GPLv2</a></div>", Label.CONTENT_XHTML); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);//ww w . jav a 2 s. c o m layout.setSpacing(true); layout.addComponent(aboutText); layout.setSizeUndefined(); setContent(layout); center(); }
From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.topic.accounting.AccountingQuestionManager.java
License:LGPL
@Override public void startQuiz() { // Remove everything from the layout, save it for displaying after // clicking OK final Component[] components = new Component[getComponentCount()]; for (int i = 0; i < components.length; i++) { components[i] = getComponent(i); }/*from w ww. ja va 2 s.co m*/ removeAllComponents(); // Create first page VerticalLayout layout = new VerticalLayout(); addComponent(layout); Label label = new Label("Answer all the questions like you were working for \"Unternehmen XY\"", ContentMode.HTML); Button cont = new Button("Continue", e -> { removeAllComponents(); for (Component c : components) { addComponent(c); } super.startQuiz(); }); layout.addComponent(components[0]);// Title of the quiz layout.addComponent(label); layout.addComponent(cont); layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER); }
From source file:by.bigvova.MainUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { EventBus.register(this); getPage().setTitle("FoodNote"); UI.getCurrent().setLocale(Locale.forLanguageTag("ru-RU")); // Let's register a custom error handler to make the 'access denied' messages a bit friendlier. setErrorHandler(new DefaultErrorHandler() { @Override//ww w . j a v a 2 s . c o m public void error(com.vaadin.server.ErrorEvent event) { if (SecurityExceptionUtils.isAccessDeniedException(event.getThrowable())) { Notification.show("Sorry, you don't have access to do that."); } else { super.error(event); } } }); HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); // By adding a security item filter, only views that are accessible to the user will show up in the side bar. sideBar.setItemFilter(new VaadinSecurityItemFilter(vaadinSecurity)); sideBar.setHeader(new CssLayout() { { Label header = new Label("<span>Food</span>Note", ContentMode.HTML); header.setWidth(100, Unit.PERCENTAGE); header.setHeightUndefined(); addComponent(header); addComponent(buildUserMenu()); } }); sideBar.getHeader().setStyleName("branding"); layout.addComponent(sideBar); CssLayout viewContainer = new CssLayout(); viewContainer.setSizeFull(); layout.addComponent(viewContainer); layout.setExpandRatio(viewContainer, 1f); Navigator navigator = new Navigator(this, viewContainer); // Without an AccessDeniedView, the view provider would act like the restricted views did not exist at all. springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class); navigator.addProvider(springViewProvider); navigator.setErrorView(ErrorView.class); navigator.navigateTo(navigator.getState()); setContent(layout); // Call this here because the Navigator must have been configured before the Side Bar can be attached to a UI. }
From source file:co.edu.icesi.academ.client.perfiles.propietario.FactoresDeImpacto.java
License:Open Source License
private Label getLabelColor(int total) { Label l;/*from w ww . j a va 2 s .c om*/ if (total != 100) { l = new Label("<font color=\"red\">" + total + "% </font>", ContentMode.HTML); } else l = new Label("<font color=\"green\">" + total + "% </font>", ContentMode.HTML); return l; }
From source file:com.aaron.mbpet.views.users.UserEditor.java
License:Apache License
public UserEditor(Item personItem, String lableText, boolean mode) { this.editMode = mode; // this.setModal(true); center();/*from w ww .j av a 2s. co m*/ setResizable(true); setClosable(true); setModal(true); // setSizeUndefined(); setWidth(25, Unit.EM); this.currsessionuser = ((MbpetUI) UI.getCurrent()).getSessionUser(); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); this.personItem = personItem; editorForm = new Form(); editorForm.setFormFieldFactory(this); editorForm.setBuffered(true); editorForm.setImmediate(true); editorForm.setItemDataSource(personItem, Arrays.asList("firstname", "lastname", "email", "username", "password", "organization")); //buttons saveButton = new Button("Save", this); saveButton.setClickShortcut(KeyCode.ENTER); cancelButton = new Button("Cancel", this); saveButton.addStyleName(ValoTheme.BUTTON_PRIMARY); HorizontalLayout buttons = new HorizontalLayout(); buttons.setWidth("100%"); buttons.addComponents(saveButton, cancelButton); buttons.setComponentAlignment(saveButton, Alignment.BOTTOM_LEFT); buttons.setComponentAlignment(cancelButton, Alignment.BOTTOM_RIGHT); // editorForm.getFooter().addComponent(buttons); // editorForm.getFooter().addComponent(cancelButton); layout.addComponent(new Label("<h3>" + lableText + "</h3>", ContentMode.HTML)); layout.addComponent(editorForm); layout.setComponentAlignment(editorForm, Alignment.MIDDLE_CENTER); layout.addComponent(buttons); setContent(layout); //editorForm setCaption(buildCaption()); }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private Label createAdditionalDependenciesLabel() { Label dependencyList = new Label("", ContentMode.HTML); dependencyList.setCaption("Other Dependencies"); if (includedDependencies != null) { String value = ""; if (includedDependencies.size() > 0) { for (File file : includedDependencies) { if (!value.equals("")) { value += "<br/>"; }/* w ww. j av a2s .c o m*/ value += file.getName(); } } else { value = "none"; } dependencyList.setValue(value); } return dependencyList; }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private Label createAddonsNotFoundLabel() { return new Label("<i>Vaadin add-ons not found from the add-on directory</i>.", ContentMode.HTML); }
From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
Panel notifications() { Panel p = new Panel("Notifications"); VerticalLayout content = new VerticalLayout() { Notification notification = new Notification(""); TextField title = new TextField("Title"); TextArea description = new TextArea("Description"); MenuBar style = new MenuBar(); MenuBar type = new MenuBar(); String typeString = ""; String styleString = ""; TextField delay = new TextField(); {/*from w w w . j a v a 2 s. co m*/ setSpacing(true); setMargin(true); title.setInputPrompt("Title for the notification"); title.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { if (title.getValue() == null || title.getValue().length() == 0) { notification.setCaption(null); } else { notification.setCaption(title.getValue()); } } }); title.setValue("Notification Title"); title.setWidth("100%"); addComponent(title); description.setInputPrompt("Description for the notification"); description.addStyleName("small"); description.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { if (description.getValue() == null || description.getValue().length() == 0) { notification.setDescription(null); } else { notification.setDescription(description.getValue()); } } }); description.setValue( "A more informative message about what has happened. Nihil hic munitissimus habendi senatus locus, nihil horum? Inmensae subtilitatis, obscuris et malesuada fames. Hi omnes lingua, institutis, legibus inter se differunt."); description.setWidth("100%"); addComponent(description); Command typeCommand = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (selectedItem.getText().equals("Humanized")) { typeString = ""; notification.setStyleName(styleString.trim()); } else { typeString = selectedItem.getText().toLowerCase(); notification.setStyleName((typeString + " " + styleString.trim()).trim()); } for (MenuItem item : type.getItems()) { item.setChecked(false); } selectedItem.setChecked(true); } }; type.setCaption("Type"); MenuItem humanized = type.addItem("Humanized", typeCommand); humanized.setCheckable(true); humanized.setChecked(true); type.addItem("Tray", typeCommand).setCheckable(true); type.addItem("Warning", typeCommand).setCheckable(true); type.addItem("Error", typeCommand).setCheckable(true); type.addItem("System", typeCommand).setCheckable(true); addComponent(type); type.addStyleName("small"); Command styleCommand = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { styleString = ""; for (MenuItem item : style.getItems()) { if (item.isChecked()) { styleString += " " + item.getText().toLowerCase(); } } if (styleString.trim().length() > 0) { notification.setStyleName((typeString + " " + styleString.trim()).trim()); } else if (typeString.length() > 0) { notification.setStyleName(typeString.trim()); } else { notification.setStyleName(null); } } }; style.setCaption("Additional style"); style.addItem("Dark", styleCommand).setCheckable(true); style.addItem("Success", styleCommand).setCheckable(true); style.addItem("Failure", styleCommand).setCheckable(true); style.addItem("Bar", styleCommand).setCheckable(true); style.addItem("Small", styleCommand).setCheckable(true); style.addItem("Closable", styleCommand).setCheckable(true); addComponent(style); style.addStyleName("small"); CssLayout group = new CssLayout(); group.setCaption("Fade delay"); group.addStyleName("v-component-group"); addComponent(group); delay.setInputPrompt("Infinite"); delay.addStyleName("align-right"); delay.addStyleName("small"); delay.setWidth("7em"); delay.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { try { notification.setDelayMsec(Integer.parseInt(delay.getValue())); } catch (Exception e) { notification.setDelayMsec(-1); delay.setValue(""); } } }); delay.setValue("1000"); group.addComponent(delay); Button clear = new Button(null, new ClickListener() { @Override public void buttonClick(final ClickEvent event) { delay.setValue(""); } }); clear.setIcon(FontAwesome.TIMES_CIRCLE); clear.addStyleName("last"); clear.addStyleName("small"); clear.addStyleName("icon-only"); group.addComponent(clear); group.addComponent(new Label(" msec", ContentMode.HTML)); GridLayout grid = new GridLayout(3, 3); grid.setCaption("Show in position"); addComponent(grid); grid.setSpacing(true); Button pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.TOP_LEFT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.TOP_CENTER); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.TOP_RIGHT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.MIDDLE_LEFT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.MIDDLE_CENTER); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.MIDDLE_RIGHT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.BOTTOM_LEFT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.BOTTOM_CENTER); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.BOTTOM_RIGHT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); } }; p.setContent(content); return p; }
From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java
License:Apache License
CssLayout buildMenu() { // Add items//from w w w . ja v a 2 s . c o m menuItems.put("common", "Common UI Elements"); menuItems.put("labels", "Labels"); menuItems.put("buttons-and-links", "Buttons & Links"); menuItems.put("textfields", "Text Fields"); menuItems.put("datefields", "Date Fields"); menuItems.put("comboboxes", "Combo Boxes"); menuItems.put("selects", "Selects"); menuItems.put("checkboxes", "Check Boxes & Option Groups"); menuItems.put("sliders", "Sliders & Progress Bars"); menuItems.put("colorpickers", "Color Pickers"); menuItems.put("menubars", "Menu Bars"); menuItems.put("trees", "Trees"); menuItems.put("tables", "Tables"); menuItems.put("dragging", "Drag and Drop"); menuItems.put("panels", "Panels"); menuItems.put("splitpanels", "Split Panels"); menuItems.put("tabs", "Tabs"); menuItems.put("accordions", "Accordions"); menuItems.put("popupviews", "Popup Views"); // menuItems.put("calendar", "Calendar"); menuItems.put("forms", "Forms"); final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top); menu.addComponent(createThemeSelect()); final Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); final Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); final StringGenerator sg = new StringGenerator(); final MenuItem settingsItem = settings.addItem( sg.nextString(true) + " " + sg.nextString(true) + sg.nextString(false), new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"), null); settingsItem.addItem("Edit Profile", null); settingsItem.addItem("Preferences", null); settingsItem.addSeparator(); settingsItem.addItem("Sign Out", null); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); Label label = null; int count = -1; for (final Entry<String, String> item : menuItems.entrySet()) { if (item.getKey().equals("labels")) { label = new Label("Components", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("panels")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Containers", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("forms")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Other", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } final Button b = new Button(item.getValue(), new ClickListener() { @Override public void buttonClick(final ClickEvent event) { navigator.navigateTo(item.getKey()); } }); if (count == 2) { b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>"); } b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); b.setIcon(testIcon.get()); menuItemsLayout.addComponent(b); count++; } label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); return menu; }
From source file:com.cms.utils.InitDateTime.java
public InitDateTime() { date.setWidth("100.0%"); date.setHeight("-1px"); final PopupDateField popupDateField = new PopupDateField(); float dateWidth = date.getWidth() - 14; popupDateField.setWidth(String.valueOf(dateWidth)); popupDateField.setId("date"); // popupDateField.addStyleName("v-textfield v-widget v-textfield-required v-required v-has-width"); popupDateField.setLocale(new Locale("vi")); popupDateField.setImmediate(false);/*w w w . ja va 2 s . c o m*/ popupDateField.setValidationVisible(false); popupDateField.addBlurListener(new FieldEvents.BlurListener() { @Override public void blur(FieldEvents.BlurEvent event) { com.vaadin.ui.JavaScript.getCurrent().execute("setValueDate();"); } }); popupDateField.addFocusListener(new FieldEvents.FocusListener() { @Override public void focus(FieldEvents.FocusEvent event) { com.vaadin.ui.JavaScript.getCurrent().execute("focusDate();"); } }); Label label = new Label( "<div id=\"error-date\" class=\"v-errorindicator\" onmouseover=\"showError()\" onmouseout=\"hideError()\" aria-hidden=\"true\" style=\"display: none;\"> </div>", ContentMode.HTML); label.setId("label"); // label.addStyleName("v-required-field-indicator"); label.setWidth("14px"); // label.setWidth("10px"); // label.setHeight("10px"); label.setDescription( "<span id=\"notification-date\" style=\" background:#fff;color:red;padding:0\">Ngy thng cha ng nh dng</span>"); date.addComponent(popupDateField); // Page.getCurrent().getJavaScript().execute("addCsstotip()"); date.addComponent(label); date.setExpandRatio(popupDateField, 3); date.setExpandRatio(label, 1); // layoutMain.addComponent(date); }