List of usage examples for com.vaadin.ui Label setValue
public void setValue(String value)
From source file:de.decidr.ui.view.uibuilder.FieldBuilder.java
License:Apache License
/** * Adds a pretty label for a read-only information item to the given form. * /*from ww w .j a v a 2 s . c o m*/ * @param form * form to manipulate (must not be <code>null</code>) * @param information * read-only information item to turn into a control (must not be * <code>null</code>) */ public void addControl(Form form, TInformation information) { if (form == null) { throw new IllegalArgumentException("Form is null"); } if (information == null) { throw new IllegalArgumentException("Information is null"); } Label label = new Label(); /* * An information item may contain plain text or XHTML, we change the * content mode of our label accordingly. */ label.setContentMode(information.getContent().getType().equals(ContentType.XHTML) ? Label.CONTENT_XHTML : Label.CONTENT_TEXT); label.setValue(information.getContent().getValue()); /* * TODO there's a high chance that this label will look like crap when * slapped into the default layout. Remove this marker if it looks * pretty ~dh */ form.getLayout().addComponent(label); }
From source file:de.escidoc.admintool.view.EscidocPagedTable.java
License:Open Source License
public HorizontalLayout createControls() { // final Label itemsPerPageLabel = new Label("Items per page:"); final Label pageLabel = new Label("Page: ", Label.CONTENT_XHTML); final TextField currentPageTextField = new TextField(); currentPageTextField.setValue(String.valueOf(getCurrentPage())); currentPageTextField.addValidator(new IntegerValidator(null)); final Label separatorLabel = new Label(" / ", Label.CONTENT_XHTML); final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML); currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL); currentPageTextField.setImmediate(true); currentPageTextField.addListener(new ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) { if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) { @SuppressWarnings("boxing") final int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue())); setCurrentPage(page);/*ww w .java2s. c o m*/ } } }); pageLabel.setWidth(null); currentPageTextField.setWidth("20px"); separatorLabel.setWidth(null); totalPagesLabel.setWidth(null); final HorizontalLayout controlBar = new HorizontalLayout(); final HorizontalLayout pageSize = new HorizontalLayout(); final HorizontalLayout pageManagement = new HorizontalLayout(); final Button first = new Button("<<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(0); } }); final Button previous = new Button("<", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { previousPage(); } }); final Button next = new Button(">", new ClickListener() { private static final long serialVersionUID = -1927138212640638452L; public void buttonClick(final ClickEvent event) { nextPage(); } }); final Button last = new Button(">>", new ClickListener() { private static final long serialVersionUID = -355520120491283992L; public void buttonClick(final ClickEvent event) { setCurrentPage(getTotalAmountOfPages()); } }); first.setStyleName(BaseTheme.BUTTON_LINK); previous.setStyleName(BaseTheme.BUTTON_LINK); next.setStyleName(BaseTheme.BUTTON_LINK); last.setStyleName(BaseTheme.BUTTON_LINK); pageLabel.addStyleName("pagedtable-pagecaption"); currentPageTextField.addStyleName("pagedtable-pagefield"); separatorLabel.addStyleName("pagedtable-separator"); totalPagesLabel.addStyleName("pagedtable-total"); first.addStyleName("pagedtable-first"); previous.addStyleName("pagedtable-previous"); next.addStyleName("pagedtable-next"); last.addStyleName("pagedtable-last"); pageLabel.addStyleName("pagedtable-label"); currentPageTextField.addStyleName("pagedtable-label"); separatorLabel.addStyleName("pagedtable-label"); totalPagesLabel.addStyleName("pagedtable-label"); first.addStyleName("pagedtable-button"); previous.addStyleName("pagedtable-button"); next.addStyleName("pagedtable-button"); last.addStyleName("pagedtable-button"); pageSize.setSpacing(true); pageManagement.addComponent(first); pageManagement.addComponent(previous); pageManagement.addComponent(pageLabel); pageManagement.addComponent(currentPageTextField); pageManagement.addComponent(separatorLabel); pageManagement.addComponent(totalPagesLabel); pageManagement.addComponent(next); pageManagement.addComponent(last); pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT); pageManagement.setWidth(null); pageManagement.setSpacing(true); controlBar.addComponent(pageSize); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER); controlBar.setWidth("100%"); controlBar.setExpandRatio(pageSize, 1); addListener(new PageChangeListener() { @SuppressWarnings("boxing") public void pageChanged(final PagedTableChangeEvent event) { previous.setEnabled(true); next.setEnabled(true); currentPageTextField.setValue(String.valueOf(getCurrentPage())); totalPagesLabel.setValue(getTotalAmountOfPages()); } }); return controlBar; }
From source file:de.fatalix.bookery.view.admin.ServerSettingsLayout.java
License:Open Source License
private void checkSolr() { try {//from w ww .j av a 2s . c om long numDocs = presenter.getSolrInfo(); for (Label label : statusFields) { if (label.getCaption().equals("Status")) { label.setValue("Online " + FontAwesome.CHECK_CIRCLE.getHtml()); label.removeStyleName("red-icon"); label.addStyleName("green-icon"); } else if (label.getCaption().equals("Library")) { label.setValue(numDocs + " Books"); } } } catch (SolrServerException | IOException ex) { logger.error(ex, ex); for (Label label : statusFields) { if (label.getCaption().equals("Status")) { label.setValue(ex.getLocalizedMessage() + " " + FontAwesome.CHECK_CIRCLE.getHtml()); label.addStyleName("red-icon"); label.removeStyleName("green-icon"); } else if (label.getCaption().equals("Num Docs")) { label.setValue("NA"); } } } }
From source file:de.fatalix.lighty.web.component.LightyNotificationBar.java
public void showNotification(@Observes @ShowNotification final String message) { Label notificationLabel = new Label(""); notificationLabel.setSizeUndefined(); layout.removeAllComponents();//from www . j a v a2 s . c om layout.addComponents(proxy, notificationLabel); layout.setComponentAlignment(notificationLabel, Alignment.MIDDLE_CENTER); addStyleName(LightyTheme.NOTIFICATION); proxy.animate(notificationLabel, AnimType.FADE_IN).setDuration(500); notificationLabel.setValue(message); }
From source file:de.fzi.fhemapi.view.vaadin.ui.model.DeviceDetailEntry.java
License:Apache License
private static Label buildRichTextField(String text) { Label label = new Label(); label.setImmediate(false);/* w w w . j a v a 2s . c o m*/ label.setWidth("-1px"); label.setHeight("-1px"); label.setValue(text); label.setContentMode(Label.CONTENT_XHTML); return label; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java
License:Apache License
private static HorizontalLayout getTitlePanel() { HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setImmediate(false);//from www .j av a2 s . c om titleLayout.setWidth("-1"); titleLayout.setHeight("-1"); titleLayout.setMargin(false); // deviceTitle Label title = new Label(); title.setImmediate(true); title.setWidth("100%"); title.setHeight("50"); title.setValue("<h1>Neues Gert..</h1>"); title.setContentMode(Label.CONTENT_XHTML); titleLayout.addComponent(title); titleLayout.setComponentAlignment(title, Alignment.TOP_CENTER); return titleLayout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewRoomPanel.java
License:Apache License
private VerticalLayout buildMainLayout() { VerticalLayout layout = new VerticalLayout(); nameTextField = new TextField(); HorizontalLayout nameLay = UIHelper.buildAttributePanel("Name", nameTextField); layout.addComponent(nameLay);/*from ww w.j a v a 2 s .com*/ typeComboBox = new ComboBox(); for (String type : roomTypes) { typeComboBox.addItem(type); } HorizontalLayout typeLay = UIHelper.buildAttributePanel("Typ", typeComboBox); layout.addComponent(typeLay); layout.setComponentAlignment(typeLay, Alignment.TOP_CENTER); Label devicesLabel = new Label(); devicesLabel.setImmediate(false); devicesLabel.setWidth("100%"); devicesLabel.setHeight("50"); devicesLabel.setValue("<b>Gerte</b>"); devicesLabel.setContentMode(Label.CONTENT_XHTML); layout.addComponent(devicesLabel); layout.setComponentAlignment(devicesLabel, Alignment.TOP_CENTER); List<Device> deviceList = parent.server.getDeviceManager().getDevices(); devicesCheckBox = new CheckBox[deviceList.size()]; for (int i = 0; i < deviceList.size(); i++) { devicesCheckBox[i] = new CheckBox(deviceList.get(i).getName()); layout.addComponent(devicesCheckBox[i]); layout.setComponentAlignment(devicesCheckBox[i], Alignment.MIDDLE_CENTER); } Button saveButton = new Button("Speichern"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> names = new LinkedList<String>(); for (CheckBox checkbox : devicesCheckBox) { if (checkbox.booleanValue()) names.add(checkbox.getCaption()); } Structure struc = new Structure((String) nameTextField.getValue(), (String) typeComboBox.getValue(), names); MessageResponse response = parent.server.getStructureManager().createNewStructure(struc); getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION); parent.server.getStructureManager().rereadFromFHEM(); parent.reloadTree(); } }); layout.addComponent(saveButton); layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER); return layout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.UIHelper.java
License:Apache License
/** * Builds a rich text field./*from w ww .ja v a 2 s .c o m*/ * @param text * @return */ public static Label buildRichTextField(String text) { Label label = new Label(); label.setImmediate(false); label.setWidth("-1px"); label.setHeight("-1px"); label.setValue(text); label.setContentMode(Label.CONTENT_XHTML); return label; }
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);// w ww . j a va 2 s . c o m label.setValue("<img src=\"" + this.getThemeURI() + resource.getResourceId() + "\" />"); return (label); }
From source file:de.mendelson.comm.as2.webclient2.AS2WebUI.java
public void refreshFooterLabel(Label label, ThemeResource resource, int count) { label.setContentMode(Label.CONTENT_XHTML); label.setValue("<img src=\"" + this.getThemeURI() + resource.getResourceId() + "\" align=\"top\"/>" + String.valueOf(count)); }