List of usage examples for com.vaadin.ui Component getCaption
public String getCaption();
From source file:org.ikasan.dashboard.ui.monitor.component.MonitorPanel.java
License:BSD License
protected Component createContentWrapper(final Component small, final Component large) { final CssLayout slot = new CssLayout(); slot.setWidth("100%"); slot.addStyleName("monitor-panel-slot"); final CssLayout card1 = new CssLayout(); card1.setWidth("100%"); card1.addStyleName(ValoTheme.LAYOUT_CARD); final CssLayout card2 = new CssLayout(); card2.setWidth("100%"); card2.addStyleName(ValoTheme.LAYOUT_CARD); final HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("dashboard-panel-toolbar"); toolbar.setWidth("100%"); Label caption = new Label(large.getCaption()); caption.addStyleName(ValoTheme.LABEL_H4); caption.addStyleName(ValoTheme.LABEL_COLORED); caption.addStyleName(ValoTheme.LABEL_NO_MARGIN); large.setCaption(null);/*from ww w . ja v a2 s.c o m*/ MenuBar tools = new MenuBar(); tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS); MenuItem max = tools.addItem("", VaadinIcons.EXPAND, new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (!slot.getStyleName().contains("max")) { selectedItem.setIcon(FontAwesome.COMPRESS); slot.removeAllComponents(); card2.removeAllComponents(); card2.addComponents(toolbar, large); slot.addComponents(card2); toggleMaximized(slot, true); } else { slot.removeStyleName("max"); selectedItem.setIcon(FontAwesome.EXPAND); toggleMaximized(slot, false); card1.removeAllComponents(); card1.addComponents(toolbar, small); slot.removeAllComponents(); slot.addComponents(card1); } } }); max.setStyleName("icon-only"); MenuItem root = tools.addItem("", VaadinIcons.COG, null); root.addItem("Configure", new Command() { @Override public void menuSelected(final MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }); root.addSeparator(); root.addItem("Close", new Command() { @Override public void menuSelected(final MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }); toolbar.addComponents(caption, tools); toolbar.setExpandRatio(caption, 1); toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT); card1.addComponents(toolbar, small); // card2.addComponents(toolbar, large); slot.addComponent(card1); return slot; }
From source file:org.metawidget.vaadin.ui.layout.FormLayout.java
License:LGPL
public void layoutWidget(Component component, String elementName, Map<String, String> attributes, ComponentContainer container, VaadinMetawidget metawidget) { // Do not render empty stubs if (component instanceof Stub && !((Stub) component).getComponentIterator().hasNext()) { return;/* w ww .jav a 2 s.co m*/ } // Fix caption if (component.getCaption() != null && component.getCaption().length() != 0 && mLabelSuffix != null && mLabelSuffix.length() != 0) { if (!(component instanceof Button) || component instanceof CheckBox) { component.setCaption(component.getCaption() + mLabelSuffix); } } // Add it com.vaadin.ui.FormLayout layout = (com.vaadin.ui.FormLayout) container.getComponentIterator().next(); component.setWidth("100%"); layout.addComponent(component); }
From source file:org.opencms.ui.dialogs.CmsNewDialog.java
License:Open Source License
/** * Creates a new instance.<p>//from ww w . j a va2 s. c om * * @param folderResource the folder resource * @param context the context */ public CmsNewDialog(CmsResource folderResource, I_CmsDialogContext context) { m_folderResource = folderResource; m_dialogContext = context; Design.read(this); CmsVaadinUtils.visitDescendants(this, new Predicate<Component>() { public boolean apply(Component component) { component.setCaption(CmsVaadinUtils.localizeString(component.getCaption())); return true; } }); CmsUUID initViewId = (CmsUUID) VaadinService.getCurrentRequest().getWrappedSession() .getAttribute(SETTING_STANDARD_VIEW); if (initViewId == null) { try { CmsUserSettings settings = new CmsUserSettings(A_CmsUI.getCmsObject()); String viewSettingStr = settings .getAdditionalPreference(CmsElementViewPreference.EXPLORER_PREFERENCE_NAME, true); if ((viewSettingStr != null) && CmsUUID.isValidUUID(viewSettingStr)) { initViewId = new CmsUUID(viewSettingStr); } } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } } if (initViewId == null) { initViewId = CmsUUID.getNullUUID(); } CmsElementView initView = initViews(initViewId); m_cancelButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { finish(new ArrayList<CmsUUID>()); } }); m_defaultLocationCheckbox.setValue(getInitialValueForUseDefaultLocationOption(folderResource)); m_defaultLocationCheckbox.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; public void valueChange(ValueChangeEvent event) { try { init(m_currentView, ((Boolean) event.getProperty().getValue()).booleanValue()); } catch (Exception e) { m_dialogContext.error(e); } } }); m_viewSelector.setNullSelectionAllowed(false); m_viewSelector.setTextInputAllowed(false); m_typeContainer.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; public void layoutClick(LayoutClickEvent event) { CmsResourceTypeBean clickedType = (CmsResourceTypeBean) (((AbstractComponent) (event .getChildComponent())).getData()); handleSelection(clickedType); } }); setActionHandler(new CmsOkCancelActionHandler() { private static final long serialVersionUID = 1L; @Override protected void cancel() { finish(new ArrayList<CmsUUID>()); } @Override protected void ok() { // nothing to do } }); init(initView, true); }
From source file:org.opennms.features.jmxconfiggenerator.webui.ui.mbeans.MBeansView.java
License:Open Source License
private AbstractSplitPanel initMainPanel(Component first, Component second) { AbstractSplitPanel layout = new HorizontalSplitPanel(); layout.setSizeFull();//from w w w . j av a2s. c o m layout.setLocked(false); layout.setSplitPosition(20, UNITS_PERCENTAGE); layout.setFirstComponent(first); layout.setSecondComponent(second); layout.setCaption(first.getCaption()); return layout; }
From source file:org.opennms.features.jmxconfiggenerator.webui.ui.mbeans.MBeansView.java
License:Open Source License
private Panel wrapToPanel(Component component) { Panel panel = new Panel(component.getCaption()); panel.setSizeFull();/*from www . j a v a 2s. co m*/ VerticalLayout layout = new VerticalLayout(); layout.setMargin(false); layout.setSpacing(false); layout.setSizeFull(); layout.addComponent(component); panel.setContent(layout); component.setCaption(null); return panel; }
From source file:org.opennms.features.vaadin.dashboard.config.ui.WallboardTabSheet.java
License:Open Source License
/** * The default constructor.//from ww w. j a v a2 s .co m */ public WallboardTabSheet() { m_plusTab = new CssLayout(); m_plusTab.setCaption("+"); m_plusTab.setDescription("Add a new Ops Board configuration"); addTab(m_plusTab).setClosable(false); addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) { Component selectedTab = getSelectedTab(); if ("+".equals(selectedTab.getCaption())) { setSelectedTab((m_lastTab != null ? m_lastTab : iterator().next())); addNewTabComponent(); } else { m_lastTab = selectedTab; } } }); }
From source file:org.opennms.features.vaadin.dashboard.dashlets.BSMConfigurationWindow.java
License:Open Source License
/** * Adds a component to a given vertical layout and applies some sizing and formatting options. * * @param verticalLayout the vertical layout * @param component the component to be added */// www.j av a 2 s . c om private void addToComponent(VerticalLayout verticalLayout, Component component) { HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setWidth(100, Unit.PERCENTAGE); Label label = new Label(component.getCaption()); label.setWidth(200, Unit.PIXELS); component.setSizeFull(); component.setCaption(null); horizontalLayout.addComponent(label); horizontalLayout.addComponent(component); horizontalLayout.setExpandRatio(component, 1.0f); verticalLayout.addComponent(horizontalLayout); }
From source file:org.vaadin.henrik.drawer.Drawer.java
License:Apache License
/** * Get the currently shown caption./* ww w . j av a 2 s .c o m*/ * * @return If a {@link Component} is in the drawer and it has a caption, * that will be returned. Otherwise, the default caption is * returned. * @see #getDefaultCaption() * @see #setDefaultCaption(String) * @see #setDrawerComponent(Component) */ public String getVisibleCaption() { final Component drawerContent = getDrawerContent(); if (drawerContent != null && drawerContent.getCaption() != null) { return drawerContent.getCaption(); } else { return getDefaultCaption(); } }
From source file:v7cr.ReviewTab.java
License:Open Source License
private void reload() { final V7CR v7 = V7CR.getInstance(); r = new Review(v7.load("reviews", reviewId)); Project p = new Project(v7.load("projects", r.getProjectName())); SVNLogEntry svn = r.getSVNLogEntry(); String url;/* w ww. j a v a2 s. co m*/ if (svn != null) { url = r.getProjectName() + "-" + svn.getRevision(); setCaption(url); } else { url = reviewId.toString(); setCaption(StringUtils.abbreviate(r.getTitle(), 20)); } VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.addComponent(getBasicInfo(v7, r, p, url)); Panel s = getSVNPanel(v7, r.getSchemaDefinition(), svn, p); if (s != null) vl.addComponent(s); final BSONBackedObject[] notes = r.getObjectFieldAsArray("notes"); if (notes != null) { for (BSONBackedObject note : notes) { vl.addComponent(getNotesPanel(note)); } } final BSONBackedObject[] votes = r.getObjectFieldAsArray("v"); if (votes != null) { for (BSONBackedObject vote : votes) { vl.addComponent(new CommentPanel(vote)); } } { HorizontalLayout commentGrid = new HorizontalLayout(); newComment = new TextArea(); newComment.setColumns(50); newComment.setRows(10); commentGrid.addComponent(newComment); voteOptions = new OptionGroup(); voteOptions.addItem("+"); voteOptions.addItem("0"); voteOptions.addItem("-"); voteOptions.setValue("0"); commentGrid.addComponent(voteOptions); vl.addComponent(commentGrid); fileArea = new VerticalLayout(); vl.addComponent(fileArea); MultiFileUpload uploader = new MultiFileUpload() { @Override protected void handleFile(File file, String fileName, String mimeType, long length) { try { BSONBackedObject gf = v7.storeFile(file, fileName, mimeType); TemporaryFile tf = new TemporaryFile(v7, gf); fileArea.addComponent(tf); } catch (IOException e) { throw new RuntimeException(e); } } }; vl.addComponent(uploader); Button submitButton = new Button(v7.getMessage("button.submit")); submitButton.addListener(this); vl.addComponent(submitButton); } setCompositionRoot(vl); Component parent = getParent(); if (parent instanceof TabSheet) { TabSheet t = (TabSheet) parent; Iterator<Component> i = t.getComponentIterator(); while (i.hasNext()) { Component c = i.next(); if (c instanceof ReviewList && r.getProjectName().equals(c.getCaption())) { ((ReviewList) c).reload(); break; } } } }
From source file:VaadinIRC.VaadinIRC.VaadinIRC.java
License:Open Source License
@Override public void onTabClose(TabSheet tabsheet, Component tabContent) { String name = tabContent.getCaption(); if (name.startsWith("#")) { ircInterface.sendMessageToServer("/PART " + name); ircInterface.leftChannel(name, session.getServer()); ircInterface.pushChangesToClient(); } else/*from w w w.j av a 2s. com*/ removeChannel(name); }