List of usage examples for com.vaadin.ui Label setStyleName
@Override public void setStyleName(String style)
From source file:org.opencms.ui.components.fileselect.CmsResourceTreeTable.java
License:Open Source License
/** * Creates a new instance.<p>// w w w.j a v a 2 s .c o m * * @param cms the CMS context * @param root the root resource * @param container the data container for the tree */ public CmsResourceTreeTable(CmsObject cms, CmsResource root, CmsResourceTreeContainer container) { m_cms = cms; m_root = root; FileSorter sorter = new FileSorter(); sorter.setSortProperties(container, new Object[] { CAPTION_FOLDERS, CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT }, new boolean[] { true, true }); container.setItemSorter(sorter); setContainerDataSource(container); ColumnGenerator captionGenerator = new ColumnGenerator() { private static final long serialVersionUID = 1L; public Object generateCell(Table source, Object itemId, Object columnId) { if (CAPTION_FOLDERS.equals(columnId)) { String html = (String) source.getContainerDataSource().getItem(itemId) .getItemProperty(CmsResourceTableProperty.PROPERTY_TREE_CAPTION).getValue(); Label label = new Label(html, ContentMode.HTML); label.setStyleName("o-tree-table-caption"); return label; } else { return null; } } }; addGeneratedColumn(CAPTION_FOLDERS, captionGenerator); setVisibleColumns(CAPTION_FOLDERS, CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT); setItemCaptionPropertyId(CAPTION_FOLDERS); setColumnHeader(CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT, CmsVaadinUtils.getMessageText(CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT.getHeaderKey())); setColumnHeader(CAPTION_FOLDERS, CmsVaadinUtils.getMessageText(CmsResourceTableProperty.PROPERTY_RESOURCE_NAME.getHeaderKey())); // hide vertical and horizontal lines and disable alternating row background addStyleName(ValoTheme.TABLE_NO_STRIPES); addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); addExpandListener(new ExpandListener() { private static final long serialVersionUID = 1L; public void nodeExpand(ExpandEvent event) { getTreeContainer().readTreeLevel(m_cms, (CmsUUID) event.getItemId()); getTreeContainer().updateSort(); markAsDirtyRecursive(); // required so open / close arrows on folders without contents are rendered correctly } }); addCollapseListener(new CollapseListener() { private static final long serialVersionUID = 1L; public void nodeCollapse(CollapseEvent event) { getTreeContainer().removeChildren((CmsUUID) event.getItemId()); } }); addItemClickListener(new ItemClickListener() { private static final long serialVersionUID = 1L; public void itemClick(ItemClickEvent event) { if (isSelectable(event.getItem())) { CmsResource resource = (CmsResource) (event.getItem() .getItemProperty(CmsResourceTreeContainer.PROPERTY_RESOURCE).getValue()); handleSelection(resource); } } }); setCellStyleGenerator(new StyleGenerator()); getTreeContainer().addTreeItem(cms, m_root, null); try { setCollapsed(m_root.getStructureId(), false); markAsDirtyRecursive(); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } }
From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java
License:Apache License
private Component createTaskTitle(UserTask task) { Label label = new Label(task.getName()); label.setStyleName(Reindeer.LABEL_H2); return label; }
From source file:org.opennms.features.vaadin.dashboard.dashlets.BSMDashlet.java
License:Open Source License
private HorizontalLayout createRow(BusinessService service) { HorizontalLayout rowLayout = new HorizontalLayout(); rowLayout.setSizeFull();// w w w. ja v a 2 s .c om rowLayout.setSpacing(true); final Status severity = m_businessServiceManager.getOperationalStatus(service); Label nameLabel = new Label(service.getName()); nameLabel.setSizeFull(); nameLabel.setStyleName("h3"); nameLabel.addStyleName("bright"); nameLabel.addStyleName("severity"); nameLabel.addStyleName(severity.getLabel()); rowLayout.addComponent(nameLabel); return rowLayout; }
From source file:org.ow2.sirocco.cloudmanager.MyUI.java
License:Open Source License
@Override protected void init(final VaadinRequest request) { this.userName = request.getUserPrincipal().getName(); this.identityContext.setUserName(this.userName); this.getPage().setTitle("Sirocco Dashboard"); final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();// ww w . java 2s. c o m this.setContent(layout); // Top header ********************* HorizontalLayout header = new HorizontalLayout(); header.setMargin(true); header.setWidth("100%"); header.setHeight("70px"); header.setStyleName("topHeader"); // logo Image image = new Image(null, new ThemeResource("img/sirocco_small_logo.png")); header.addComponent(image); // spacer Label spacer = new Label(); spacer.setWidth("100%"); header.addComponent(spacer); header.setExpandRatio(spacer, 1.0f); HorizontalLayout rightButtons = new HorizontalLayout(); rightButtons.setStyleName("topHeader"); rightButtons.setSpacing(true); this.userName = request.getUserPrincipal().getName(); User user = null; try { user = this.userManager.getUserByUsername(this.userName); } catch (CloudProviderException e) { e.printStackTrace(); } Label label = new Label("Tenant:"); label.setStyleName("topHeaderLabel"); rightButtons.addComponent(label); final ComboBox tenantSelect = new ComboBox(); tenantSelect.setTextInputAllowed(false); tenantSelect.setNullSelectionAllowed(false); for (Tenant tenant : user.getTenants()) { tenantSelect.addItem(tenant.getName()); } tenantSelect.setValue(user.getTenants().iterator().next().getName()); tenantSelect.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { Notification.show("Switching to tenant " + tenantSelect.getValue()); } }); tenantSelect.setImmediate(true); rightButtons.addComponent(tenantSelect); this.tenantId = user.getTenants().iterator().next().getUuid(); this.identityContext.setTenantId(this.tenantId); // logged user name label = new Label("Logged in as: " + this.userName); label.setStyleName("topHeaderLabel"); rightButtons.addComponent(label); // sign out button Button button = new Button("Sign Out"); // button.setStyleName(BaseTheme.BUTTON_LINK); button.addClickListener(new Button.ClickListener() { public void buttonClick(final ClickEvent event) { MyUI.this.logout(); } }); rightButtons.addComponent(button); header.addComponent(rightButtons); layout.addComponent(header); // Split view HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.setSizeFull(); splitPanel.setFirstComponent(this.createLeftMenu()); this.inventoryContainer = new VerticalLayout(); this.inventoryContainer.setSizeFull(); this.inventoryContainer.addComponent(this.machineView); splitPanel.setSecondComponent(this.inventoryContainer); splitPanel.setSplitPosition(15); layout.addComponent(splitPanel); layout.setExpandRatio(splitPanel, 1.0f); this.listenToNotifications(); }
From source file:org.ripla.web.controllers.RiplaBody.java
License:Open Source License
/** * We have to clone the separator label defined in the skin. * /* www .j av a2s .co m*/ * @param inSeparator * Label * @return {@link Label} the cloned label */ private Label getSeparator(final Label inSeparator) { final Label out = new Label(inSeparator.getValue().toString(), inSeparator.getContentMode()); out.setWidth(inSeparator.getWidth(), inSeparator.getWidthUnits()); out.setStyleName(inSeparator.getStyleName()); return out; }
From source file:org.ripla.web.demo.skin.stylish.Skin.java
License:Open Source License
private Label createMargin(final String inStyle, final int inWidth) { final Label out = new Label(" ", ContentMode.HTML); out.setStyleName(inStyle); out.setWidth(inWidth, Unit.PIXELS);//from w w w .j a v a 2s .c o m out.setHeight(45, Unit.PIXELS); return out; }
From source file:org.ripla.web.util.LanguageSelect.java
License:Open Source License
/** * LanguageSelect constructor.// ww w. j av a 2 s . c o m * * @param inPreferences * {@link PreferencesHelper} * @param inConfigManager * {@link ConfigManager} * @param inUser * {@link User} */ public LanguageSelect(final PreferencesHelper inPreferences, final ConfigManager inConfigManager, final User inUser) { super(); // initialize language form prefs (1) or config admin (2) // final String lActiveLanguage = inPreferences.getLocale(inUser, // new Locale(inConfigManager.getLanguage())).getLanguage(); setStyleName("ripla-language-select"); //$NON-NLS-1$ setSizeUndefined(); layout = new HorizontalLayout(); setCompositionRoot(layout); layout.setHeight(22, Unit.PIXELS); layout.setSpacing(true); final Label lLabel = new Label(Activator.getMessages().getMessage("toolbar.label.language"), //$NON-NLS-1$ ContentMode.HTML); lLabel.setStyleName("ripla-toolbar-label"); //$NON-NLS-1$ lLabel.setSizeUndefined(); layout.addComponent(lLabel); layout.setComponentAlignment(lLabel, Alignment.MIDDLE_LEFT); layout.setExpandRatio(lLabel, 1); select = createSelect(); select.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent inEvent) { final Locale lNew = ((LocaleAdapter) select.getValue()).getLocale(); Locale lOld = null; try { VaadinSession.getCurrent().getLockInstance().lock(); lOld = VaadinSession.getCurrent().getLocale(); } finally { VaadinSession.getCurrent().getLockInstance().unlock(); } if (lOld != null && !lOld.equals(lNew)) { try { VaadinSession.getCurrent().getLockInstance().lock(); VaadinSession.getCurrent().setLocale(lNew); } finally { VaadinSession.getCurrent().getLockInstance().unlock(); } if (listener != null) { listener.processAction(new IToolbarAction() { @Override public void run() { LOG.trace("Setting language preference to {}.", lNew.getLanguage()); VaadinSession.getCurrent().getAttribute(IRiplaEventDispatcher.class).dispatch( org.ripla.interfaces.IRiplaEventDispatcher.Event.REFRESH, new HashMap<String, Object>()); } }); } } } }); layout.addComponent(select); }
From source file:org.robot.gtf.gui.GTFApplication.java
License:Apache License
@Override public void init() { buildNewProjectWindow();// ww w. j a v a 2s . c o m buildAboutWindow(); buildMenuButtons(); HorizontalLayout container = new HorizontalLayout(); window = new Window(TextResources.getAppName() + " - " + TextResources.getAppVersion()); window.setTheme("runo"); window.setContent(container); setMainWindow(window); // Main Menu VerticalLayout menuContainer = new VerticalLayout(); menuContainer.addComponent(buttonNewTestProject); menuContainer.addComponent(buttonOpenTestProject); menuContainer.addComponent(buttonSettings); menuContainer.addComponent(buttonHelp); menuContainer.setMargin(true, true, false, true); container.addComponent(menuContainer); // Main Content VerticalLayout mainContent = new VerticalLayout(); mainContent.setMargin(true, false, false, false); mainContent.setSpacing(true); // Heading Layout VerticalLayout headingContent = new VerticalLayout(); headingContent.setStyleName("v-window-header "); Label heading = new Label(TextResources.getAppName() + " - " + TextResources.getAppVersion()); heading.setStyleName("v-label-h1"); headingContent.addComponent(heading); mainContent.addComponent(headingContent); projectNameHeading = new Label(); projectNameHeading.setStyleName("v-label-h3"); mainContent.addComponent(projectNameHeading); // Testcase table and Scenario selection HorizontalLayout testcases = new HorizontalLayout(); table.setVisible(false); // Selection list with scenarios scenariosListSelect.setNullSelectionAllowed(false); scenariosListSelect.setImmediate(true); scenariosListSelect.setVisible(false); testcases.setSpacing(true); testcases.addComponent(table); testcases.addComponent(scenariosListSelect); mainContent.addComponent(testcases); // Button Container HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); // Table Add Button addRowButton = new Button("Add Testcase", new Button.ClickListener() { public void buttonClick(ClickEvent event) { if (table2 == null) { table.addItem(); } else { table2.addItem(); } } }); addRowButton.addStyleName(Runo.BUTTON_SMALL); addRowButton.addStyleName(Runo.BUTTON_DEFAULT); addRowButton.setIcon(new ThemeResource("../runo/icons/16/document-add.png")); addRowButton.setVisible(false); buttons.addComponent(addRowButton); // Table Save Button saveButton = new Button("Save", new Button.ClickListener() { public void buttonClick(ClickEvent event) { } }); saveButton.addStyleName(Runo.BUTTON_SMALL); saveButton.addStyleName(Runo.BUTTON_DEFAULT); saveButton.setIcon(new ThemeResource("../runo/icons/16/ok.png")); saveButton.setVisible(false); buttons.addComponent(saveButton); mainContent.addComponent(buttons); container.addComponent(mainContent); }
From source file:org.s23m.cell.editor.semanticdomain.ui.components.layout.ImpactAnalysisFormLayout.java
License:Mozilla Public License
private void init() { setMargin(true);//from w w w . j a va 2 s . c om resultsPanel = new Panel(); resultsPanel.addStyleName(Runo.PANEL_LIGHT); resultsPanel.setWidth(RESULTS_PANEL_WIDTH); resultsPanel.setHeight(RESULTS_PANEL_HEIGHT); addComponent(resultsPanel); parent.getMainApplication().getMainWindow().showNotification("Processing results..."); final List<Set> dependentInstances = doImapactAnalysis( analysedSet.identity().uniqueRepresentationReference().toString()); this.pageIndex = 0; final Label lblTitle = new Label(); lblTitle.setValue( analysedSet.identity().name() + "<br/> can impact : " + dependentInstances.size() + " instaces(s)"); lblTitle.setContentMode(Label.CONTENT_XHTML); lblTitle.setStyleName("title-label"); resultsPanel.addComponent(lblTitle); if (dependentInstances.size() > 0) { final int startIndex = pageIndex * PAGE_SIZE; final int endIndex = startIndex + PAGE_SIZE; final Panel resultsContentPanel = new Panel(); resultsContentPanel.setWidth(RESULTS_CONTENT_PANEL_WIDTH); resultsContentPanel.setHeight(RESULTS_CONTENT_PANEL_HEIGHT); resultsPanel.addComponent(resultsContentPanel); buildResultsPage(dependentInstances, resultsContentPanel, startIndex, endIndex); } }
From source file:org.s23m.cell.editor.semanticdomain.ui.components.MultitabPanel.java
License:Mozilla Public License
private void buildResultsPage(final Panel resultsPanel, final int startIndex, final int endIndex) { resultsPanel.removeAllComponents();// www. j a v a 2s .co m for (int n = startIndex; (n < endIndex && n < searchResults.size()); n++) { final SearchResultType r = searchResults.get(n); final Tree cTree = application.getContainmentTreePanel().getContainmentTree(); final HorizontalLayout hl1 = new HorizontalLayout(); hl1.setData(r.getInstanceIdentity()); hl1.addListener(new LayoutClickListener() { private void expandAllAncestors(final TreeNode rootNode, final TreeNode node2Select) { if (!rootNode.equals(node2Select)) { final TreeNode parentNode = (TreeNode) cTree.getParent(node2Select); cTree.expandItem(parentNode); expandAllAncestors(rootNode, parentNode); } } public void layoutClick(final LayoutClickEvent event) { if (event.getSource() instanceof HorizontalLayout) { final HorizontalLayout layout = (HorizontalLayout) event.getSource(); final InstanceIdentityType id = (InstanceIdentityType) layout.getData(); //Fetch and deserialize outershell instances if they are not available in memory application.getContainmentTreePanel().recreateOutshellInstances(); application.getContainmentTreePanel().update(); if (cTree.rootItemIds().size() > 0) { final TreeNode rootNode = (TreeNode) cTree.rootItemIds().iterator().next(); cTree.collapseItemsRecursively(rootNode); //select a corresponding tree node final Set set = Reconstitution.getSetFromLocalMemory( Reconstitution.reconstituteIdentity(id.getName(), id.getPluralName(), UUID.fromString(id.getUuid()), UUID.fromString(id.getUuid()))); // TODO name based equivalence test needs to be replaced by isEqualToRepresentation() if (!set.identity().name() .equals((S23MSemanticDomains.semanticErr_ThisSetIsNotAvailableInMemory .identity().name()))) { TreeNode node2Select = null; if (set.properClass().isEqualTo(S23MKernel.coreGraphs.edge)) { node2Select = new TreeNode( set.container().identity().uniqueRepresentationReference().toString(), TreeNode.NO_SET); } else { node2Select = new TreeNode(id.getUuid(), TreeNode.NO_SET); } expandAllAncestors(rootNode, node2Select); cTree.setValue(node2Select); } } } }// }); final HorizontalLayout hl2 = new HorizontalLayout(); final Label lblMeta = new Label(); lblMeta.setStyleName("meta-element"); final Label lblInstance = new Label(); lblInstance.setStyleName("instance-element"); final Label lblArtifact = new StyledLabel("part of: " + r.getContainerIdentity().getName(), StyledLabel.VALUE_TAG_STYLE); final Label lblNameTag = new StyledLabel("name:", StyledLabel.NAME_TAG_STYLE); final Label lblName = new StyledLabel(r.getInstanceIdentity().getName(), StyledLabel.VALUE_TAG_STYLE); final Label lblPlNameTag = new StyledLabel("plural name:", StyledLabel.NAME_TAG_STYLE); final Label lblPlName = new StyledLabel(r.getInstanceIdentity().getPluralName(), StyledLabel.VALUE_TAG_STYLE); if (r.getMetaInstanceIdentity().getName() != null) { lblMeta.setValue(r.getMetaInstanceIdentity().getName() + " : "); } else { final Set metaSet = Reconstitution.getSetFromLocalMemory(Reconstitution.reconstituteIdentity("", "", UUID.fromString(r.getMetaInstanceIdentity().getUuid()), UUID.fromString(r.getMetaInstanceIdentity().getUuid()))); // TODO name based equivalence test needs to be replaced by isEqualToRepresentation() if (!metaSet.identity().name().equals( (S23MSemanticDomains.semanticErr_ThisSetIsNotAvailableInMemory.identity().name()))) { lblMeta.setValue(metaSet.identity().name() + " : "); } else { lblMeta.setValue(" : "); } } lblInstance.setValue(r.getInstanceIdentity().getName()); hl1.addComponent(lblMeta); hl1.addComponent(lblInstance); hl2.addComponent(lblArtifact); hl2.addComponent(lblNameTag); hl2.addComponent(lblName); hl2.addComponent(lblPlNameTag); hl2.addComponent(lblPlName); resultsPanel.addComponent(hl1); resultsPanel.addComponent(hl2); } if (searchResults.size() > PAGE_SIZE) { createPagebar(resultsPanel, searchResults.size()); } }