List of usage examples for com.vaadin.ui Label setValue
public void setValue(String value)
From source file:org.lucidj.explorer.OpenView.java
License:Apache License
@Override // Runnable public void run() { install_pane.addComponent(new Label("Installing " + artifact_url)); try {//from w w w .java2 s . c o m install_instance = artifactDeployer.installArtifact(artifact_url, true); install_pane.addComponent(new Label("Bundle installed: " + install_instance)); Button go_to_bundle = new Button("Go to new bundle"); go_to_bundle.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { String view_name = BundleView.buildViewName(install_instance.getMainBundle().getSymbolicName()); getUI().getNavigator().navigateTo(view_name); } }); boolean artifact_open = false; String opening = "Opening"; Label animation_label = new Label(); install_pane.addComponent(animation_label); for (;;) { opening += "."; animation_label.setValue(opening); // TODO: MAKE THIS WITH Artifact.addListener(ArtifactEvent) int ext_state = install_instance.getExtState(); if (ext_state == Artifact.STATE_EX_OPEN) { install_pane.addComponent(new Label("Artifact is now Open")); artifact_open = true; break; } else if (ext_state == Artifact.STATE_EX_ERROR) { install_pane.addComponent(new Label("Error opening artifact (ext state " + ext_state + ")")); break; } try { Thread.sleep(250); } catch (InterruptedException ignore) { } ; } if (artifact_open) { install_pane.addComponent(go_to_bundle); navigate_to_artifact(); } } catch (Exception e) { log.error("Exception installing artifact", e); String msg = "Exception installing artifact: " + e.toString(); String exception_msg = e.getMessage(); if (exception_msg != null) { msg += " (" + exception_msg + ")"; } install_pane.addComponent(new Label(msg)); } }
From source file:org.lunifera.christmastree.control.DesktopControlComponent.java
License:Creative Commons License
protected AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);//from ww w . j a v a2 s . co m mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // title area ThemeResource resource = new ThemeResource("images/Title.png"); Image title = new Image(" ", resource); title.setHeight("108px"); title.setWidth("827px"); mainLayout.addComponent(title, "top:22.0px;left:120.0px"); VerticalLayout vl = new VerticalLayout(); vl.setHeight("500px"); vl.setWidth("400px"); vl.setSpacing(true); mainLayout.addComponent(vl, "top:140.0px;left:100.0px;"); contentLayout = buildContent(); vl.addComponent(contentLayout); vl.setExpandRatio(contentLayout, 1.0f); // licenses PopupView licenseLink = new PopupView("Attributions", new Label("<div><i>Monitor/tablet/smartphone</i> and <i>tree</i> icons </br> made by " + "<a href=\"http://www.freepik.com\" title=\"Freepik\">Freepik</a> " + "from <a href=\"http://www.flaticon.com\" title=\"Flaticon\">www.flaticon.com</a> </br>" + "is licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" " + "title=\"Creative Commons BY 3.0\">CC BY 3.0</a></div>", ContentMode.HTML)); licenseLink.setPrimaryStyleName("attributions"); vl.addComponent(licenseLink); Label image = new Label(); image.setHeight("400px"); image.setWidth("100%"); // image.setValue("<div style=\"overflow:hidden; width: 400px; // margin-left: -60px;\">" // + "<img src=\"http://77.119.240.22:8081\"/>" + "</div>"); image.setValue("<div style=\"overflow:hidden; width: 370px; margin-left: -60px;\">" + "<img src=\"http://192.168.0.108:8081\"/>" + "</div>"); image.setContentMode(ContentMode.HTML); mainLayout.addComponent(image, "top:140.0px;left:600.0px;"); return mainLayout; }
From source file:org.lunifera.christmastree.control.MobileControlComponent.java
License:Creative Commons License
protected AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);/* w w w . j a v a 2 s . co m*/ mainLayout.setWidth("1280px"); mainLayout.setHeight("720px"); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // title area ThemeResource resource = new ThemeResource("images/Title.png"); Image title = new Image(" ", resource); title.setHeight("54px"); title.setWidth("413px"); mainLayout.addComponent(title, "top:11.0px;left:60.0px"); Label image = new Label(); image.setHeight("340px"); image.setWidth("600px"); image.setValue("<div style=\"overflow:hidden; width: 320px; height: 600px; margin-left: -60px;\">" + "<img src=\"http://192.168.0.108:8081\"/>" + "</div>"); image.setContentMode(ContentMode.HTML); mainLayout.addComponent(image, "top:70.0px;left:125px;"); // Image image = new Image(); // image.setHeight("240px"); // image.setWidth("320px"); // image.setSource(new // ExternalResource("http://192.168.0.108:8081/stream", // "video/x-motion-jpeg")); // mainLayout.addComponent(image, "top:70.0px;left:50.0px;"); VerticalLayout vl = new VerticalLayout(); // vl.setHeight("250px"); vl.setWidth("200px"); vl.setSpacing(true); mainLayout.addComponent(vl, "top:180.0px;left:535.0px;"); contentLayout = buildContent(); vl.addComponent(contentLayout); vl.setExpandRatio(contentLayout, 1.0f); // licenses PopupView licenseLink = new PopupView("Attributions", new Label("<div><i>Monitor/tablet/smartphone</i> and <i>tree</i> icons </br> made by " + "<a href=\"http://www.freepik.com\" title=\"Freepik\">Freepik</a> " + "from <a href=\"http://www.flaticon.com\" title=\"Flaticon\">www.flaticon.com</a> </br>" + "is licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" " + "title=\"Creative Commons BY 3.0\">CC BY 3.0</a></div>", ContentMode.HTML)); licenseLink.setPrimaryStyleName("attributions"); vl.addComponent(licenseLink); return mainLayout; }
From source file:org.lunifera.example.vaadin.osgi.bootstrap.ds.SimpleDSUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { HorizontalLayout layout = new HorizontalLayout(); setContent(layout);//w ww. jav a2 s . c om layout.setStyleName(Reindeer.LAYOUT_BLUE); layout.setSizeFull(); Label label = new Label(); label.setValue("<h1>Vaadin wired to Servlet by OSGi-DS component</h1>"); label.setContentMode(ContentMode.HTML); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.TOP_CENTER); }
From source file:org.lunifera.example.vaadin.osgi.bootstrap.simple.SimpleUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { HorizontalLayout layout = new HorizontalLayout(); setContent(layout);// ww w .j a v a 2 s. c om layout.setStyleName(Reindeer.LAYOUT_BLUE); layout.setSizeFull(); Label label = new Label(); label.setValue("<h1>Simple OSGi integration</h1>"); label.setContentMode(ContentMode.HTML); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.TOP_CENTER); }
From source file:org.metawidget.vaadin.ui.layout.HeadingTagLayoutDecorator.java
License:LGPL
@Override protected void addSectionWidget(String section, int level, ComponentContainer container, VaadinMetawidget metawidget) {//from w ww.j a v a2 s .co m String currentActiveSection = metawidget.getClientProperty("currentActiveSection"); if ((currentActiveSection != null) && currentActiveSection.equals(section)) { return; } Label label = new Label(); // Section name (possibly localized) String localizedSection = metawidget.getLocalizedKey(StringUtils.camelCase(section)); if (localizedSection == null) { label.setValue(section); } else { label.setValue(localizedSection); } int headingLevel = level + 1; label.setStyleName("h" + headingLevel); // Add to parent container Map<String, String> attributes = CollectionUtils.newHashMap(); getDelegate().layoutWidget(label, PROPERTY, attributes, container, metawidget); metawidget.putClientProperty("currentActiveSection", section); }
From source file:org.opencms.ui.apps.projects.CmsProjectHistoryTable.java
License:Open Source License
/** * Loads the projects table.<p>//from ww w. j a v a 2 s . c om */ public void loadProjects() { CmsObject cms = A_CmsUI.getCmsObject(); Locale locale = UI.getCurrent().getLocale(); m_container.removeAllItems(); boolean isMultiOU = false; // hide ou column if only one ou exists try { isMultiOU = !OpenCms.getOrgUnitManager().getOrganizationalUnits(cms, "", true).isEmpty(); } catch (CmsException e) { // noop } if (isMultiOU) { setVisibleColumns(CmsProjectsTable.PROP_NAME, CmsProjectsTable.PROP_DESCRIPTION, PROP_PUBLISH_DATE, PROP_PUBLISH_USER, CmsProjectsTable.PROP_ORG_UNIT, CmsProjectsTable.PROP_OWNER, CmsProjectsTable.PROP_MANAGER, CmsProjectsTable.PROP_USER, CmsProjectsTable.PROP_DATE_CREATED, CmsProjectsTable.PROP_RESOURCES); } else { setVisibleColumns(CmsProjectsTable.PROP_NAME, CmsProjectsTable.PROP_DESCRIPTION, PROP_PUBLISH_DATE, PROP_PUBLISH_USER, CmsProjectsTable.PROP_OWNER, CmsProjectsTable.PROP_MANAGER, CmsProjectsTable.PROP_USER, CmsProjectsTable.PROP_DATE_CREATED, CmsProjectsTable.PROP_RESOURCES); } // get content try { List<CmsHistoryProject> projects = cms.getAllHistoricalProjects(); for (CmsHistoryProject project : projects) { Item item = m_container.addItem(new Integer(project.getPublishTag())); if (item != null) { item.getItemProperty(CmsProjectsTable.PROP_ID).setValue(project.getUuid()); item.getItemProperty(CmsProjectsTable.PROP_NAME).setValue(project.getSimpleName()); item.getItemProperty(CmsProjectsTable.PROP_DESCRIPTION).setValue(project.getDescription()); item.getItemProperty(PROP_PUBLISH_DATE).setValue(new Date(project.getPublishingDate())); item.getItemProperty(PROP_PUBLISH_USER).setValue(project.getPublishedByName(cms)); try { item.getItemProperty(CmsProjectsTable.PROP_ORG_UNIT).setValue(OpenCms.getOrgUnitManager() .readOrganizationalUnit(cms, project.getOuFqn()).getDisplayName(locale)); item.getItemProperty(CmsProjectsTable.PROP_OWNER) .setValue(cms.readUser(project.getOwnerId()).getName()); item.getItemProperty(CmsProjectsTable.PROP_MANAGER) .setValue(cms.readGroup(project.getManagerGroupId()).getSimpleName()); item.getItemProperty(CmsProjectsTable.PROP_USER) .setValue(cms.readGroup(project.getGroupId()).getSimpleName()); } catch (CmsException e) { // TODO Auto-generated catch block e.printStackTrace(); } item.getItemProperty(CmsProjectsTable.PROP_DATE_CREATED) .setValue(new Date(project.getDateCreated())); StringBuffer html = new StringBuffer(512); for (String resource : cms.readProjectResources(project)) { html.append(resource); html.append("<br />"); } Label resLabel = new Label(); resLabel.setContentMode(ContentMode.HTML); resLabel.setValue(html.toString()); item.getItemProperty(CmsProjectsTable.PROP_RESOURCES).setValue(resLabel); } } m_container.sort(new Object[] { PROP_PUBLISH_DATE }, new boolean[] { false }); } catch (CmsException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.opencms.ui.apps.projects.CmsProjectsTable.java
License:Open Source License
/** * Loads the projects table.<p>/*ww w.j av a2s . co m*/ */ public void loadProjects() { CmsObject cms = A_CmsUI.getCmsObject(); Locale locale = UI.getCurrent().getLocale(); m_container.removeAllItems(); boolean isMultiOU = false; // hide ou column if only one ou exists try { isMultiOU = !OpenCms.getOrgUnitManager().getOrganizationalUnits(cms, "", true).isEmpty(); } catch (CmsException e) { // noop } if (isMultiOU) { setVisibleColumns(PROP_NAME, PROP_DESCRIPTION, PROP_ORG_UNIT, PROP_OWNER, PROP_MANAGER, PROP_USER, PROP_DATE_CREATED, PROP_RESOURCES); } else { setVisibleColumns(PROP_NAME, PROP_DESCRIPTION, PROP_OWNER, PROP_MANAGER, PROP_USER, PROP_DATE_CREATED, PROP_RESOURCES); } // get content try { List<CmsProject> projects = OpenCms.getOrgUnitManager().getAllManageableProjects(cms, "", true); for (CmsProject project : projects) { Item item = m_container.addItem(project.getUuid()); item.getItemProperty(PROP_ID).setValue(project.getUuid()); item.getItemProperty(PROP_NAME).setValue(project.getSimpleName()); item.getItemProperty(PROP_DESCRIPTION).setValue(project.getDescription()); try { item.getItemProperty(PROP_ORG_UNIT).setValue(OpenCms.getOrgUnitManager() .readOrganizationalUnit(cms, project.getOuFqn()).getDisplayName(locale)); item.getItemProperty(PROP_OWNER).setValue(cms.readUser(project.getOwnerId()).getName()); item.getItemProperty(PROP_MANAGER) .setValue(cms.readGroup(project.getManagerGroupId()).getSimpleName()); item.getItemProperty(PROP_USER).setValue(cms.readGroup(project.getGroupId()).getSimpleName()); } catch (CmsException e) { LOG.error("Error reading project properties for " + project.getSimpleName()); } item.getItemProperty(PROP_DATE_CREATED).setValue(new Date(project.getDateCreated())); StringBuffer html = new StringBuffer(512); try { for (String resource : cms.readProjectResources(project)) { html.append(resource); html.append("<br />"); } } catch (CmsException e) { LOG.error("Error reading project resources for " + project.getSimpleName()); } Label resLabel = new Label(); resLabel.setContentMode(ContentMode.HTML); resLabel.setValue(html.toString()); item.getItemProperty(PROP_RESOURCES).setValue(resLabel); } } catch (CmsException e) { LOG.error("Error reading manageable projects", e); CmsErrorDialog.showErrorDialog(e); } }
From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.LicenceDescriptorPanel.java
License:Apache License
/** * updates the metadata fields from the licence string * if unable to read the metadata then returns false * @param licenceStr/*w w w .j a v a 2s.com*/ * @return true if metadata read, false if not */ public boolean updateMetadata(String licenceStr) { boolean success = false; if (licenceStr != null) { LicenceMetadata licenceMetadata = null; try { licenceMetadata = Licence.getUnverifiedMetadata(licenceStr); } catch (Exception e) { // can't decode string licenceMetadata will be null } if (licenceMetadata == null) { //create empty licenceMetadata panel licenceMetadata = new LicenceMetadata(); licenceMetadata.setStartDate(null); licenceMetadata.setProductId("cannot decode licence string"); success = false; } else success = true; productIdTextField.setReadOnly(false); productIdTextField .setValue((licenceMetadata.getProductId() == null) ? "" : licenceMetadata.getProductId()); productIdTextField.setReadOnly(noUpdate); featureRepositoryTextField.setReadOnly(false); featureRepositoryTextField.setValue( (licenceMetadata.getFeatureRepository() == null) ? "" : licenceMetadata.getFeatureRepository()); featureRepositoryTextField.setReadOnly(noUpdate); Format formatter = new SimpleDateFormat("yyyy-MM-dd"); startDateTextField.setReadOnly(false); startDateTextField.setValue((licenceMetadata.getStartDate() == null) ? "" : formatter.format(licenceMetadata.getStartDate())); startDateTextField.setReadOnly(noUpdate); expiryDateTextField.setReadOnly(false); expiryDateTextField.setValue((licenceMetadata.getExpiryDate() == null) ? "" : formatter.format(licenceMetadata.getExpiryDate())); expiryDateTextField.setReadOnly(noUpdate); durationTextField.setReadOnly(false); durationTextField .setValue((licenceMetadata.getDuration() == null) ? "" : licenceMetadata.getDuration()); durationTextField.setReadOnly(noUpdate); licenseeTextField.setReadOnly(false); licenseeTextField .setValue((licenceMetadata.getLicensee() == null) ? "" : licenceMetadata.getLicensee()); licenseeTextField.setReadOnly(noUpdate); licensorTextField.setReadOnly(false); licensorTextField .setValue((licenceMetadata.getLicensor() == null) ? "" : licenceMetadata.getLicensor()); licensorTextField.setReadOnly(noUpdate); maxSizeSystemIdsTextField.setReadOnly(false); maxSizeSystemIdsTextField.setValue( (licenceMetadata.getMaxSizeSystemIds() == null) ? "" : licenceMetadata.getMaxSizeSystemIds()); maxSizeSystemIdsTextField.setReadOnly(noUpdate); // display systemIds if present systemIdsVerticalLayout.removeAllComponents(); // add error messages if system ids defined when not expected Label l1 = new Label(); l1.setContentMode(ContentMode.HTML); Integer licenceMetadataMaxSizeSystemIds = null; try { licenceMetadataMaxSizeSystemIds = Integer.parseInt(licenceMetadata.getMaxSizeSystemIds()); } catch (Exception e) { } if (licenceMetadataMaxSizeSystemIds == null || licenceMetadataMaxSizeSystemIds == 0) { // if maxSizeSystemIds=0 check if systemId's list has entries (an error) if (licenceMetadata.getSystemIds() == null || licenceMetadata.getSystemIds().isEmpty()) { l1.setValue("<div style=\"color: green;\">" + "All SystemId's Accepted" + "</div>"); } else { l1.setValue("<div style=\"color: red;\">" + "Licence Error: MaxSizeSystemIds=0 but " + licenceMetadata.getSystemIds().size() + " systemId's are defined" + "</div>"); } systemIdsVerticalLayout.addComponent(l1); } else if (licenceMetadata.getSystemIds() == null || licenceMetadata.getSystemIds().isEmpty()) { l1.setValue("<div style=\"color: green;\">" + "No SystemId's Defined" + "</div>"); systemIdsVerticalLayout.addComponent(l1); } else if (licenceMetadata.getSystemIds().size() > licenceMetadataMaxSizeSystemIds) { l1.setValue("<div style=\"color: red;\">Licence Error: more system id's defined in licence (" + licenceMetadata.getSystemIds().size() + ") than allowed in maxSizeSystemIds=" + licenceMetadata.getMaxSizeSystemIds() + "</div>"); systemIdsVerticalLayout.addComponent(l1); } // add system id strings if present if (licenceMetadata.getSystemIds() != null) { for (String systemId : licenceMetadata.getSystemIds()) { Label systemIdField = new Label(); systemIdField.setImmediate(true); systemIdField.setWidth("400px"); systemIdField.setHeight("-1px"); systemIdField.setValue(systemId); systemIdsVerticalLayout.addComponent(systemIdField); } } // display licence options if present licenceOptionsVerticalLayout.removeAllComponents(); if (licenceMetadata.getOptions() == null || licenceMetadata.getOptions().isEmpty()) { Label l = new Label("No Licence Options Defined"); licenceOptionsVerticalLayout.addComponent(l); } else { for (OptionMetadata option : licenceMetadata.getOptions()) { TextField optionField = new TextField(); optionField.setImmediate(true); optionField.setWidth("400px"); optionField.setHeight("-1px"); optionField.setCaption(option.getName()); optionField.setValue(option.getValue()); optionField.setDescription(option.getDescription()); optionField.setReadOnly(noUpdate); licenceOptionsVerticalLayout.addComponent(optionField); } } mainLayout.markAsDirty(); } return success; }
From source file:org.opennms.features.vaadin.dashboard.dashlets.AlarmDetailsDashlet.java
License:Open Source License
/** * Returns the component for visualising the alarms data. * * @param onmsAlarm an {@link OnmsAlarm} instance * @param onmsNode an {@link OnmsNode} instance * @return component for this alarm/* w ww. j a va 2 s.co m*/ */ @Deprecated public Component createAlarmComponent(OnmsAlarm onmsAlarm, OnmsNode onmsNode) { HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeFull(); horizontalLayout.addStyleName("alert-details"); horizontalLayout.addStyleName("alert-details-font"); horizontalLayout.addStyleName(onmsAlarm.getSeverity().name().toLowerCase()); VerticalLayout verticalLayout1 = new VerticalLayout(); VerticalLayout verticalLayout2 = new VerticalLayout(); horizontalLayout.addComponent(verticalLayout1); horizontalLayout.addComponent(verticalLayout2); Label lastEvent = new Label(); lastEvent.setSizeUndefined(); lastEvent.addStyleName("alert-details-font"); lastEvent.setCaption("Last event"); lastEvent.setValue(onmsAlarm.getLastEventTime().toString()); Label firstEvent = new Label(); firstEvent.setSizeUndefined(); firstEvent.addStyleName("alert-details-font"); firstEvent.setCaption("First event"); firstEvent.setValue(onmsAlarm.getFirstEventTime().toString()); verticalLayout1.addComponent(firstEvent); verticalLayout1.addComponent(lastEvent); Label nodeId = new Label(); nodeId.setSizeUndefined(); nodeId.addStyleName("alert-details-font"); nodeId.setCaption("Node Id"); if (onmsNode != null) { nodeId.setValue(onmsNode.getNodeId()); } else { nodeId.setValue("-"); } Label nodeLabel = new Label(); nodeLabel.setSizeUndefined(); nodeLabel.addStyleName("alert-details-font"); nodeLabel.setCaption("Node Label"); if (onmsNode != null) { nodeLabel.setValue(onmsNode.getLabel()); } else { nodeLabel.setValue("-"); } Label logMessage = new Label(); logMessage.addStyleName("alert-details-font"); logMessage.setSizeFull(); logMessage.setCaption("Log message"); logMessage.setValue(onmsAlarm.getLogMsg().replaceAll("<[^>]*>", "")); HorizontalLayout horizontalLayout2 = new HorizontalLayout(); horizontalLayout2.setSizeFull(); horizontalLayout2.setSpacing(true); horizontalLayout2.addComponent(nodeId); horizontalLayout2.addComponent(nodeLabel); verticalLayout2.addComponent(horizontalLayout2); verticalLayout2.addComponent(logMessage); horizontalLayout.setExpandRatio(verticalLayout1, 1.0f); horizontalLayout.setExpandRatio(verticalLayout2, 4.0f); return horizontalLayout; }