com.vaadin.ui.Table.setItemDescriptionGenerator()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(274)

本文整理了Java中com.vaadin.ui.Table.setItemDescriptionGenerator()方法的一些代码示例,展示了Table.setItemDescriptionGenerator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.setItemDescriptionGenerator()方法的具体详情如下:
包路径:com.vaadin.ui.Table
类名称:Table
方法名:setItemDescriptionGenerator

Table.setItemDescriptionGenerator介绍

暂无

代码示例

代码示例来源:origin: eclipse/hawkbit

  1. protected void addTooltip() {
  2. sourceTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
  3. private static final long serialVersionUID = 1L;
  4. @Override
  5. public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
  6. final Item item = sourceTable.getItem(itemId);
  7. final String description = (String) item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue();
  8. if (DIST_TYPE_NAME.equals(propertyId) && !StringUtils.isEmpty(description)) {
  9. return i18n.getMessage("label.description") + description;
  10. }
  11. return null;
  12. }
  13. });
  14. }

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

  1. protected void addTooltip() {
  2. sourceTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
  3. private static final long serialVersionUID = 1L;
  4. @Override
  5. public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
  6. final Item item = sourceTable.getItem(itemId);
  7. final String description = (String) item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue();
  8. if (DIST_TYPE_NAME.equals(propertyId) && !StringUtils.isEmpty(description)) {
  9. return i18n.getMessage("label.description") + description;
  10. }
  11. return null;
  12. }
  13. });
  14. }

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

  1. private void addTooltTipToSelectedTable() {
  2. selectedTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
  3. private static final long serialVersionUID = 1L;
  4. @Override
  5. public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
  6. final Item item = selectedTable.getItem(itemId);
  7. final String description = (String) (item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue());
  8. if (DIST_TYPE_NAME.equals(propertyId) && !StringUtils.isEmpty(description)) {
  9. return i18n.getMessage("label.description") + description;
  10. } else if (DIST_TYPE_MANDATORY.equals(propertyId)) {
  11. return i18n.getMessage(UIMessageIdProvider.TOOLTIP_CHECK_FOR_MANDATORY);
  12. }
  13. return null;
  14. }
  15. });
  16. }

代码示例来源:origin: eclipse/hawkbit

  1. private void addTooltTipToSelectedTable() {
  2. selectedTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
  3. private static final long serialVersionUID = 1L;
  4. @Override
  5. public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
  6. final Item item = selectedTable.getItem(itemId);
  7. final String description = (String) (item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue());
  8. if (DIST_TYPE_NAME.equals(propertyId) && !StringUtils.isEmpty(description)) {
  9. return i18n.getMessage("label.description") + description;
  10. } else if (DIST_TYPE_MANDATORY.equals(propertyId)) {
  11. return i18n.getMessage(UIMessageIdProvider.TOOLTIP_CHECK_FOR_MANDATORY);
  12. }
  13. return null;
  14. }
  15. });
  16. }

代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin

  1. /**
  2. * Set the {@link ItemDescriptionGenerator} to use to generate item descriptions (tooltips).
  3. * @param rowDescriptionGenerator Generator to set (not null)
  4. */
  5. public void setDescriptionGenerator(final ItemDescriptionGenerator<T> rowDescriptionGenerator) {
  6. ObjectUtils.argumentNotNull(rowDescriptionGenerator, "Generator must be not null");
  7. switch (getRenderingMode()) {
  8. case GRID:
  9. getGrid().setRowDescriptionGenerator(row -> getItem(row.getItemId())
  10. .map(i -> rowDescriptionGenerator.getItemDescription(i)).orElse(null));
  11. break;
  12. case TABLE:
  13. getTable().setItemDescriptionGenerator(
  14. (c, id, p) -> getItem(id).map(i -> rowDescriptionGenerator.getItemDescription(i)).orElse(null));
  15. break;
  16. default:
  17. break;
  18. }
  19. }

相关文章