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

x33g5p2x  于2022-01-20 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(178)

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

Grid.setContainerDataSource介绍

暂无

代码示例

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

/**
 * Set the listing data source.
 * @param <D> Data source type
 * @param container The data source to set (not null)
 */
public <D extends ItemDataSource<T, P> & Indexed> void setDataSource(D container) {
  ObjectUtils.argumentNotNull(container, "Container datasource must be not null");
  this.dataSource = container;
  switch (getRenderingMode()) {
  case GRID:
    getGrid().setContainerDataSource(container);
    break;
  case TABLE:
    getTable().setContainerDataSource(container);
    break;
  default:
    break;
  }
}

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

protected Grid createMetadataGrid() {
  final Grid metadataGrid = new Grid();
  metadataGrid.addStyleName(SPUIStyleDefinitions.METADATA_GRID);
  metadataGrid.setImmediate(true);
  metadataGrid.setHeight("100%");
  metadataGrid.setWidth("100%");
  metadataGrid.setId(UIComponentIdProvider.METDATA_TABLE_ID);
  metadataGrid.setSelectionMode(SelectionMode.SINGLE);
  metadataGrid.setColumnReorderingAllowed(true);
  metadataGrid.setContainerDataSource(getMetadataContainer());
  metadataGrid.getColumn(KEY).setHeaderCaption(i18n.getMessage("header.key"));
  metadataGrid.getColumn(VALUE).setHeaderCaption(i18n.getMessage("header.value"));
  metadataGrid.getColumn(VALUE).setHidden(true);
  metadataGrid.addSelectionListener(this::onRowClick);
  metadataGrid.getColumn(DELETE_BUTTON).setHeaderCaption("");
  metadataGrid.getColumn(DELETE_BUTTON).setRenderer(new HtmlButtonRenderer(this::onDelete));
  metadataGrid.getColumn(DELETE_BUTTON).setWidth(50);
  metadataGrid.getColumn(KEY).setExpandRatio(1);
  return metadataGrid;
}

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

protected Grid createMetadataGrid() {
  final Grid metadataGrid = new Grid();
  metadataGrid.addStyleName(SPUIStyleDefinitions.METADATA_GRID);
  metadataGrid.setImmediate(true);
  metadataGrid.setHeight("100%");
  metadataGrid.setWidth("100%");
  metadataGrid.setId(UIComponentIdProvider.METDATA_TABLE_ID);
  metadataGrid.setSelectionMode(SelectionMode.SINGLE);
  metadataGrid.setColumnReorderingAllowed(true);
  metadataGrid.setContainerDataSource(getMetadataContainer());
  metadataGrid.getColumn(KEY).setHeaderCaption(i18n.getMessage("header.key"));
  metadataGrid.getColumn(VALUE).setHeaderCaption(i18n.getMessage("header.value"));
  metadataGrid.getColumn(VALUE).setHidden(true);
  metadataGrid.addSelectionListener(this::onRowClick);
  metadataGrid.getColumn(DELETE_BUTTON).setHeaderCaption("");
  metadataGrid.getColumn(DELETE_BUTTON).setRenderer(new HtmlButtonRenderer(this::onDelete));
  metadataGrid.getColumn(DELETE_BUTTON).setWidth(50);
  metadataGrid.getColumn(KEY).setExpandRatio(1);
  return metadataGrid;
}

相关文章

Grid类方法