List of usage examples for com.vaadin.ui AbstractComponent setDescription
public void setDescription(String description)
From source file:com.esofthead.mycollab.module.project.view.bug.components.BugRowComponent.java
License:Open Source License
public BugRowComponent(final SimpleBug bug) { this.bug = bug; withSpacing(true).withMargin(false).withFullWidth().addStyleName(UIConstants.BORDER_LIST_ROW); bugSettingPopupBtn = new PopupButton(); bugSettingPopupBtn.setIcon(FontAwesome.COGS); bugSettingPopupBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); OptionPopupContent filterBtnLayout = createPopupContent(); bugSettingPopupBtn.setContent(filterBtnLayout); final ToggleBugSummaryField bugWrapper = new ToggleBugSummaryField(bug); BugPopupFieldFactory popupFieldFactory = ViewManager.getCacheComponent(BugPopupFieldFactory.class); MHorizontalLayout headerLayout = new MHorizontalLayout().withFullWidth() .withMargin(new MarginInfo(false, true, false, false)); Component priorityField = popupFieldFactory.createPriorityPopupField(bug); Component assigneeField = popupFieldFactory.createAssigneePopupField(bug); headerLayout.with(bugSettingPopupBtn, priorityField, assigneeField, bugWrapper).expand(bugWrapper); CssLayout footer = new CssLayout(); Component commentsField = popupFieldFactory.createCommentsPopupField(bug); footer.addComponent(commentsField);/* w w w . j ava 2s .c o m*/ Component followerField = popupFieldFactory.createFollowersPopupField(bug); footer.addComponent(followerField); Component statusField = popupFieldFactory.createStatusPopupField(bug); footer.addComponent(statusField); Component milestoneField = popupFieldFactory.createMilestonePopupField(bug); footer.addComponent(milestoneField); String deadlineTooltip = String.format("%s: %s", AppContext.getMessage(GenericI18Enum.FORM_DUE_DATE), AppContext.formatDate(bug.getDuedate())); AbstractComponent deadlineField = popupFieldFactory.createDeadlinePopupField(bug); deadlineField.setDescription(deadlineTooltip); footer.addComponent(deadlineField); Component startDateField = popupFieldFactory.createStartDatePopupField(bug); footer.addComponent(startDateField); Component endDateField = popupFieldFactory.createEndDatePopupField(bug); footer.addComponent(endDateField); if (!SiteConfiguration.isCommunityEdition()) { Component billableHoursView = popupFieldFactory.createBillableHoursPopupField(bug); footer.addComponent(billableHoursView); Component nonBillableHoursView = popupFieldFactory.createNonbillableHoursPopupField(bug); footer.addComponent(nonBillableHoursView); } this.with(headerLayout, footer); }
From source file:com.esofthead.mycollab.module.project.view.task.components.TaskRowRenderer.java
License:Open Source License
public TaskRowRenderer(final SimpleTask task) { this.task = task; withSpacing(true).withMargin(false).withFullWidth().addStyleName(UIConstants.BORDER_LIST_ROW); taskSettingPopupBtn = new PopupButton(); taskSettingPopupBtn.setIcon(FontAwesome.COGS); taskSettingPopupBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); OptionPopupContent filterBtnLayout = createPopupContent(); taskSettingPopupBtn.setContent(filterBtnLayout); toogleTaskField = new ToggleTaskSummaryField(task); MHorizontalLayout headerLayout = new MHorizontalLayout().withFullWidth() .withMargin(new MarginInfo(false, true, false, false)); TaskPopupFieldFactory popupFieldFactory = ViewManager.getCacheComponent(TaskPopupFieldFactory.class); AbstractComponent priorityField = popupFieldFactory.createPriorityPopupField(task); AbstractComponent assigneeField = popupFieldFactory.createAssigneePopupField(task); headerLayout.with(taskSettingPopupBtn, priorityField, assigneeField, toogleTaskField) .expand(toogleTaskField);//www . j ava2 s . c om CssLayout footer = new CssLayout(); AbstractComponent commentField = popupFieldFactory.createCommentsPopupField(task); footer.addComponent(commentField); AbstractComponent followerView = popupFieldFactory.createFollowersPopupField(task); footer.addComponent(followerView); AbstractComponent statusField = popupFieldFactory.createStatusPopupField(task); footer.addComponent(statusField); AbstractComponent milestoneField = popupFieldFactory.createMilestonePopupField(task); footer.addComponent(milestoneField); AbstractComponent percentageField = popupFieldFactory.createPercentagePopupField(task); footer.addComponent(percentageField); String deadlineTooltip = String.format("%s: %s", AppContext.getMessage(GenericI18Enum.FORM_DUE_DATE), AppContext.formatDate(task.getDeadline())); AbstractComponent deadlineField = popupFieldFactory.createDeadlinePopupField(task); deadlineField.setDescription(deadlineTooltip); footer.addComponent(deadlineField); AbstractComponent startDateField = popupFieldFactory.createStartDatePopupField(task); footer.addComponent(startDateField); AbstractComponent endDateField = popupFieldFactory.createEndDatePopupField(task); footer.addComponent(endDateField); if (!SiteConfiguration.isCommunityEdition()) { AbstractComponent billableHoursField = popupFieldFactory.createBillableHoursPopupField(task); footer.addComponent(billableHoursField); AbstractComponent nonBillableHours = popupFieldFactory.createNonBillableHoursPopupField(task); footer.addComponent(nonBillableHours); } this.with(headerLayout, footer); }
From source file:com.foc.vaadin.gui.FocXMLGuiComponentStatic.java
License:Apache License
public static void applyAttributes(FocXMLGuiComponent xmlComponent, Attributes attributes) { if (attributes != null && xmlComponent != null) { try {/*www. j a v a2s. co m*/ Component component = (Component) xmlComponent; String visible = attributes.getValue(FXML.ATT_VISIBLE); if (visible != null) { if (visible.equals("false")) { component.setVisible(false); } else { component.setVisible(true); } } String captionMode = attributes.getValue(FXML.ATT_CAPTION_MODE); if (captionMode != null) { if (captionMode.equals("vertical")) { component.addStyleName("vertical"); } } applyAttributes_WidthHeight(component, attributes); if (component instanceof AbstractOrderedLayout) { String spacing = attributes.getValue(FXML.ATT_SPACING); if (spacing == null || spacing.equals("false")) { ((AbstractOrderedLayout) component).setSpacing(false); } else { ((AbstractOrderedLayout) component).setSpacing(true); } } if (component instanceof AbstractLayout) { String margin = attributes.getValue(FXML.ATT_MARGIN); if (Globals.isValo()) { if (margin != null && margin.equals("true")) { ((AbstractLayout) component).addStyleName("focMargin"); } } else { if (margin == null || margin.equals("false")) { ((AbstractLayout) component).addStyleName("focNoMargin"); } } } String description = attributes.getValue(FXML.ATT_DESCRIPTION); if (description != null && !description.isEmpty() && component instanceof AbstractComponent) { AbstractComponent abstractComponent = (AbstractComponent) component; abstractComponent.setDescription(description); } String caption = attributes.getValue(FXML.ATT_CAPTION); String captPos = attributes.getValue(FXML.ATT_CAPTION_POSITION); if (caption != null) { if (captPos != null) { if (!captPos.equals("left") && !captPos.equals("right")) component.setCaption(caption); } else { component.setCaption(caption); } } String captMargin = attributes.getValue(FXML.ATT_CAPTION_MARGIN); if (captMargin != null && captMargin.equals("0") && (caption == null || (captPos != null && !captPos.equals("top")))) { setCaptionMargin_Zero(component); } //Style Attribute String style = attributes.getValue(FXML.ATT_STYLE); applyStyle(component, style); xmlComponent.refreshEditable(); if (attributes != null) { String border = attributes.getValue(FXML.ATT_BORDER); if (border != null) { border = border.toLowerCase(); if (border.equals("true")) { component.addStyleName("border"); } else { component.addStyleName("foc-border-" + border); } } } String tabIndexString = attributes.getValue(FXML.ATT_TABINDEX); if (!Utils.isStringEmpty(tabIndexString) && xmlComponent.getFormField() != null) { int tabIndex = Utils.parseInteger(tabIndexString, -1); xmlComponent.getFormField().setTabIndex(tabIndex); } String iconName = attributes.getValue(FXML.ATT_ICON); if (!Utils.isStringEmpty(iconName)) { FontIcon icon = FontAwesome.valueOf(iconName.toUpperCase()); if (icon != null) { component.setIcon(icon); } } if (!(component instanceof Layout) && ConfigInfo.isGuiRTL() && !(component instanceof FVTextField) && !(component instanceof FVDateField) && !(component instanceof FVComboBox) && !(component instanceof FVTextArea) && !(component instanceof FVObjectComboBox) && !(component instanceof FVMultipleChoiceComboBox)) { component.addStyleName("foc-floatNone"); } } catch (Exception e) { Globals.logException(e); } } }
From source file:com.foc.vaadin.gui.xmlForm.FocXMLLayout.java
License:Apache License
public String putComponent(String name, Component component) { if (name == null) { name = ASCII.generateRandomString(10); } else {/* w ww. j ava2s. c o m*/ FocXMLGuiComponent oldGuiComponent = (FocXMLGuiComponent) getComponentByName(name); if (oldGuiComponent != null) { oldGuiComponent.dispose(); } } getComponentMap().put(name, (FocXMLGuiComponent) component); if (component != null) { ((FocXMLGuiComponent) component).getDelegate().setNameInMap(name); } if (component != null && ConfigInfo.isUnitDevMode() && component instanceof AbstractComponent) { if (component instanceof FVWrapperLayout) { AbstractComponent field = (AbstractComponent) ((FVWrapperLayout) component).getFormField(); if (field != null) field.setDescription("Name : " + name); } else { ((AbstractComponent) component).setDescription("Name : " + name); } } return name; }
From source file:com.mycollab.module.project.ui.ProjectAssetsUtil.java
License:Open Source License
public static Component buildProjectLogo(String projectShortname, Integer projectId, String projectAvatarId, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(projectAvatarId)) { wrapper = new Image(null, new ExternalResource(StorageFactory.getResourcePath(String.format("%s/%s_%d.png", PathUtils.getProjectLogoPath(MyCollabUI.getAccountId(), projectId), projectAvatarId, size))));/*w w w .j av a 2s. c o m*/ } else { ELabel projectIcon = new ELabel(projectShortname).withStyleName(UIConstants.TEXT_ELLIPSIS, ValoTheme.LABEL_LARGE, "center"); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(projectIcon); ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(ProjectI18nEnum.OPT_CHANGE_LOGO_HELP, UserUIContext.getMessage(ProjectI18nEnum.EDIT))); return wrapper; }
From source file:com.mycollab.module.project.ui.ProjectAssetsUtil.java
License:Open Source License
public static Component buildClientLogo(SimpleAccount account, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(account.getAvatarid())) { wrapper = new Image(null, new ExternalResource( StorageFactory.getEntityLogoPath(MyCollabUI.getAccountId(), account.getAvatarid(), 100))); } else {/*from ww w .j ava 2 s . c om*/ String accountName = account.getAccountname(); accountName = (accountName.length() > 3) ? accountName.substring(0, 3) : accountName; ELabel projectIcon = new ELabel(accountName).withStyleName(UIConstants.TEXT_ELLIPSIS, "center"); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(projectIcon); ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(ClientI18nEnum.OPT_CHANGE_LOGO_HELP, UserUIContext.getMessage(ClientI18nEnum.EDIT))); return wrapper; }
From source file:org.lunifera.runtime.web.vaadin.databinding.component.internal.ComponentDescriptionProperty.java
License:Open Source License
protected void doSetValue(Object source, Object value) { if (source instanceof AbstractComponent) { AbstractComponent comp = (AbstractComponent) source; comp.setDescription((String) value); } else {/* w w w .ja v a2s .c om*/ throw new UnsupportedOperationException("setDescription missing in interface!"); } }
From source file:pt.ist.vaadinframework.ui.AbstractViewerFactory.java
License:Open Source License
@Override public Viewer createViewer(Item item, Object propertyId, Component uiContext) { Viewer viewer = makeViewer(item, propertyId, uiContext); AbstractComponent component = (AbstractComponent) viewer; component.setCaption(makeCaption(item, propertyId, uiContext)); component.setDescription(makeDescription(item, propertyId, uiContext)); return viewer; }
From source file:pt.ist.vaadinframework.ui.DefaultViewerFactory.java
License:Open Source License
@Override public final Viewer createViewer(Item item, Object propertyId, Component uiContext) { Viewer viewer = makeViewer(item, propertyId, uiContext); AbstractComponent component = (AbstractComponent) viewer; component.setDescription(makeDescription(item, propertyId, uiContext)); component.setCaption(makeCaption(item, propertyId, uiContext)); return viewer; }
From source file:uk.co.q3c.v7.i18n.AnnotationI18NInterpreter.java
License:Apache License
private void processComponent(I18NListener listener, Field field) { if (field.isAnnotationPresent(I18N.class)) { I18N annotation = field.getAnnotation(I18N.class); LabelKeys captionKey = annotation.caption(); DescriptionKeys descriptionKey = annotation.description(); DescriptionKeys valueKey = annotation.value(); String captionValue = captionKey.equals(LabelKeys._notdefined_) ? null : captionKey.getValue(locale); String descriptionValue = descriptionKey.equals(DescriptionKeys._notdefined_) ? null : descriptionKey.getValue(locale); field.setAccessible(true);//w w w.jav a2 s . c om try { AbstractComponent c = (AbstractComponent) field.get(listener); if (captionValue != null) { c.setCaption(captionValue); } if (descriptionValue != null) { c.setDescription(descriptionValue); } c.setLocale(locale); } catch (IllegalArgumentException | IllegalAccessException e) { log.error("Unable to set I18N caption or description for " + field.getName(), e); } // These components have a value. Usually I18N would only be used for Label values. If no key is provided // the component value is left unchanged if (valueKey != null) { if (Property.class.isAssignableFrom(field.getType())) { try { @SuppressWarnings("unchecked") Property<String> c = (Property<String>) field.get(listener); String valueValue = valueKey.equals(DescriptionKeys._notdefined_) ? null : valueKey.getValue(locale); if (valueValue != null) { c.setValue(valueValue); } } catch (Exception e) { log.error("Unable to set I18N value for " + field.getName(), e); } } } } }