Java 类com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator 实例源码

项目:hawkbit    文件:CreateUpdateDistSetTypeLayout.java   
private void addTooltTipToSelectedTable() {

        selectedTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
            private static final long serialVersionUID = 99432397408575324L;

            @Override
            public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
                final Item item = selectedTable.getItem(itemId);
                final String description = (String) (item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue());
                if (DIST_TYPE_NAME.equals(propertyId) && HawkbitCommonUtil.trimAndNullIfEmpty(description) != null) {
                    return i18n.getMessage("label.description") + description;
                } else if (DIST_TYPE_MANDATORY.equals(propertyId)) {
                    return i18n.getMessage("tooltip.check.for.mandatory");
                }
                return null;
            }
        });
    }
项目:hawkbit    文件:CreateUpdateDistSetTypeLayout.java   
private void addTooltip() {

        sourceTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
            private static final long serialVersionUID = 1L;

            @Override
            public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
                final Item item = sourceTable.getItem(itemId);
                final String description = (String) item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue();
                if (DIST_TYPE_NAME.equals(propertyId) && HawkbitCommonUtil.trimAndNullIfEmpty(description) != null) {
                    return i18n.getMessage("label.description") + description;
                }
                return null;
            }
        });
    }
项目:jain-I18n    文件:I18NTableHandler.java   
public void applyI18N(Component component, Locale locale) {
    super.applyI18N(component, locale);
    Table table = ((Table) component);
    table.setColumnHeaders(getHeaders (locale));

    Object [] visibleColumns = table.getVisibleColumns();

    for (Object propertyId : visibleColumns) {
        table.setColumnFooter(propertyId, getColumnFooter(locale, propertyId));
    }

    ItemDescriptionGenerator descriptionGenerator = table.getItemDescriptionGenerator();

    if (descriptionGenerator != null && descriptionGenerator instanceof I18NItemDescriptionGenerator) {
        I18NItemDescriptionGenerator generator = (I18NItemDescriptionGenerator) descriptionGenerator;

        if (generator.getLocale() != locale) {
            table.setItemDescriptionGenerator(null);
            generator.setLocale(locale);
            table.setItemDescriptionGenerator(generator);
        }
    }
}
项目:ExpressZip    文件:ExpressZipTreeTable.java   
public ExpressZipTreeTable() {
    super();
    addStyleName("expresszip");

    setSizeFull();

    // turn off column reordering and collapsing
    setColumnReorderingAllowed(false);
    setPageLength(0); // turn off paging

    setMultiSelect(true);
    setImmediate(true);
    setMultiSelectMode(MultiSelectMode.DEFAULT);
    setSelectable(true);

    setItemDescriptionGenerator(new ItemDescriptionGenerator() {

        @Override
        public String generateDescription(Component source, Object itemId, Object propertyId) {
            String tooltip = "";
            if(null != propertyId && propertyId.equals(LAYER) && itemId instanceof ExpressZipLayer) {
                ExpressZipLayer l = (ExpressZipLayer)itemId;
                Set<String> projs = l.getSupportedProjections();
                tooltip = "<p>Click to view layer boundary. Right-click for options.</p><h2>" + l.getName() + "</h2><ul>";
                Iterator<String> iter = projs.iterator();
                while(iter.hasNext()) {
                    tooltip += "<li>" + iter.next() + "</li>";
                }
                tooltip += "</ul>";
            }
                return tooltip;
        }
    });

    enableFirstColumnHighlighter(this);
}