List of usage examples for com.vaadin.ui Component setCaption
public void setCaption(String caption);
From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.util.Util.java
License:Open Source License
public static void applyCaptions(II18nService service, String label, String i18nLabelKey, Locale locale, Component component) { if (service != null && isValid(i18nLabelKey)) { String translation = service.getValue(i18nLabelKey, locale); if (translation == null || translation.equals("")) { if (isValid(label)) { component.setCaption(label); }//from www .j a v a2s .co m if (component instanceof AbstractComponent) { ((AbstractComponent) component).setDescription(i18nLabelKey); } } else { component.setCaption(translation); } } else { if (isValid(label)) { component.setCaption(label); } } }
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;//from www .jav a 2s . c om } // 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.metawidget.vaadin.ui.widgetprocessor.CaptionProcessor.java
License:LGPL
public Component processWidget(Component component, String elementName, Map<String, String> attributes, VaadinMetawidget metawidget) {// w w w . ja va 2s . c o m component.setCaption(metawidget.getLabelString(attributes)); return component; }
From source file:org.opencms.ui.dialogs.CmsNewDialog.java
License:Open Source License
/** * Creates a new instance.<p>/* w w w . java2s . 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 Panel wrapToPanel(Component component) { Panel panel = new Panel(component.getCaption()); panel.setSizeFull();/*from w ww . ja va 2 s .c om*/ 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.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 *///from ww w. ja va2s. co m 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.johannesh.jfokus2012.touchkit.view.ShowContactView.java
License:Open Source License
private void buildLayout() { layout = new CssLayout(); layout.addStyleName("show-contact-view"); layout.setWidth("100%"); VerticalComponentGroup infoGroup = new VerticalComponentGroup(""); infoGroup.setWidth("100%"); Component label; Property p;// w w w .j ava 2 s. c om p = item.getItemProperty(ContactUtils.PROPERTY_COMPANY); label = new Label(new ContactUtils.CompanyPropertyFormatter(p)); label.setCaption(ContactUtils.formatFieldCaption(ContactUtils.PROPERTY_COMPANY)); infoGroup.addComponent(label); p = item.getItemProperty(ContactUtils.PROPERTY_MOBILE); label = new Label(p); label.setCaption(ContactUtils.formatFieldCaption(ContactUtils.PROPERTY_MOBILE)); infoGroup.addComponent(label); p = item.getItemProperty(ContactUtils.PROPERTY_EMAIL); label = new Label(p); label.setCaption(ContactUtils.formatFieldCaption(ContactUtils.PROPERTY_EMAIL)); infoGroup.addComponent(label); Embedded picture = new Embedded("", new ThemeResource("icon/picture.png")); picture.setWidth("57px"); picture.setHeight("57px"); Label firstName = new Label(item.getItemProperty(ContactUtils.PROPERTY_FIRST_NAME)); firstName.addStyleName("strong-name"); Label lastName = new Label(item.getItemProperty(ContactUtils.PROPERTY_LAST_NAME)); lastName.addStyleName("strong-name"); GridLayout nameLayout = new GridLayout(2, 2); nameLayout.setWidth("100%"); nameLayout.setSpacing(true); nameLayout.setMargin(true, true, false, true); nameLayout.setColumnExpandRatio(1, 1.0f); nameLayout.addComponent(picture, 0, 0, 0, 1); nameLayout.addComponent(firstName, 1, 0); nameLayout.addComponent(lastName, 1, 1); nameLayout.setComponentAlignment(firstName, Alignment.MIDDLE_LEFT); nameLayout.setComponentAlignment(lastName, Alignment.MIDDLE_LEFT); final Favourite favourite = new Favourite(); favourite.setImmediate(true); favourite.setReadOnly(true); favourite.setIcon(new ThemeResource("icon/favourite.png")); favourite.setPropertyDataSource(item.getItemProperty(ContactUtils.PROPERTY_FAVOURITE)); layout.addComponent(nameLayout); layout.addComponent(favourite); layout.addComponent(infoGroup); Button editButton = new Button("Edit"); editButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { getNavigationManager().navigateTo(new EditContactView(item)); } }); setRightComponent(editButton); setContent(layout); }
From source file:ru.codeinside.gses.manager.ProcedureForm.java
License:Mozilla Public License
protected void setFormToCreateMode() { createUpdateForm.setValidationVisible(false); createUpdateForm.getField(ID).setValue(""); createUpdateForm.getField(NAME).setValue(""); createUpdateForm.getField(DESCRIPTION).setValue(""); createUpdateForm.getField(SERVICE_ID).setValue(null); createUpdateForm.getField(CODE).setValue(""); Component submit = createUpdateForm.getFooter().getComponentIterator().next(); submit.setCaption(""); }
From source file:ru.codeinside.gses.manager.ProcedureForm.java
License:Mozilla Public License
protected void setFormToUpateMode() { createUpdateForm.getField(ID).setValue(p.getId()); createUpdateForm.getField(NAME).setValue(p.getName()); createUpdateForm.getField(DESCRIPTION).setValue(p.getDescription()); createUpdateForm.getField(CODE).setValue(ApInfo.formatCode(p.getRegisterCode())); Field select = createUpdateForm.getField(SERVICE_ID); if (p.getService() != null) { select.setValue(getItem(select, p.getService().getId().toString())); }/*from www. j a v a 2 s .c o m*/ Component submit = createUpdateForm.getFooter().getComponentIterator().next(); submit.setCaption(""); }