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

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

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

Grid.setHeightByRows介绍

[英]Sets the number of rows that should be visible in Grid's body. This method will set the height mode to be HeightMode#ROW.
[中]设置网格主体中应可见的行数。此方法将高度模式设置为高度模式#行。

代码示例

代码示例来源:origin: stackoverflow.com

Grid table...
table.setHeightMode(HeightMode.ROW);
table.setDetailsGenerator(new DetailsGenerator() {

  public Component getDetails(RowReference rowReference) {
   table.setHeightByRows(tableContainer.getItemIds().size() + 4);
   //detalis height is constant so I solve this by adding extra space which equals the size of 4 the rows
   //
   //for filtered container you can use tableContainer.getVisibleItemIds()
  }
}

代码示例来源:origin: com.vaadin/vaadin-server

@Override
protected void doReadDesign(Element design, DesignContext context) {
  Attributes attrs = design.attributes();
  if (design.hasAttr(DECLARATIVE_DATA_ITEM_TYPE)) {
    String itemType = design.attr(DECLARATIVE_DATA_ITEM_TYPE);
    setBeanType(itemType);
  }
  if (attrs.hasKey("selection-mode")) {
    setSelectionMode(DesignAttributeHandler.readAttribute(
        "selection-mode", attrs, SelectionMode.class));
  }
  Attributes attr = design.attributes();
  if (attr.hasKey("selection-allowed")) {
    setReadOnly(DesignAttributeHandler
        .readAttribute("selection-allowed", attr, Boolean.class));
  }
  if (attrs.hasKey("rows")) {
    setHeightByRows(DesignAttributeHandler.readAttribute("rows", attrs,
        double.class));
  }
  readStructure(design, context);
  // Read frozen columns after columns are read.
  if (attrs.hasKey("frozen-columns")) {
    setFrozenColumnCount(DesignAttributeHandler
        .readAttribute("frozen-columns", attrs, int.class));
  }
}

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

/**
 * Sets the number of rows that should be visible in internal Grid's body.
 * @param rows the number of rows to set
 */
public void setHeightByRows(double rows) {
  getGrid().setHeightByRows(rows);
}

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

@Override
public B heightByRows(double rows) {
  getInstance().getGrid().setHeightMode(HeightMode.ROW);
  getInstance().getGrid().setHeightByRows(rows);
  return builder();
}

代码示例来源:origin: kingbbode/spring-boot-ehcache-monitor

private Grid<Cache> createCacheGrid(CacheManager cacheManager) {
    Grid<Cache> grid = new Grid<>();
    grid.addColumn(Cache::getName).setCaption("Name");
    grid.addColumn(cache -> ((Double) (((double) cache.getStatistics().cacheHitCount()) / ((double) (cache.getStatistics().cacheMissCount() + cache.getStatistics().cacheHitCount())) * 100)).intValue() + "%").setCaption("Hit Ratio");
    grid.addColumn(cache -> cache.getCacheConfiguration().getMaxEntriesLocalHeap()).setCaption("Max Size");
    grid.addColumn(Cache::getSize).setCaption("Size");
    grid.addColumn(Cache::getStatus).setCaption("Status");
    grid.addColumn(cache -> cache.getCacheConfiguration().getTimeToIdleSeconds()).setCaption("TTldle(s)");
    grid.addColumn(cache -> cache.getCacheConfiguration().getTimeToLiveSeconds()).setCaption("TTLive(s)");
    grid.addColumn(cache -> cache.getStatistics().cacheHitCount()).setCaption("hit");
    grid.addColumn(cache -> cache.getStatistics().cacheMissExpiredCount()).setCaption("miss : Expire");
    grid.addColumn(cache -> cache.getStatistics().cacheMissNotFoundCount()).setCaption("miss : Not Found");

    grid.setItems(Arrays.stream(cacheManager.getCacheNames())
        .map(cacheManager::getCache)
        .collect(Collectors.toList()));
    grid.setSizeFull();
    grid.setSelectionMode(Grid.SelectionMode.NONE);

    int cacheSize = cacheManager.getCacheNames().length;
    if (cacheSize != 0) {
      grid.setHeightByRows(cacheSize > 10 ? 10 : cacheSize);
    }
    return grid;
  }
}

代码示例来源:origin: kingbbode/spring-boot-ehcache-monitor

private Grid<Cache> createCacheInfoGrid() {
  Grid<Cache> grid = new Grid<>();
  grid.addColumn(Cache::getName).setCaption("Name");
  grid.addColumn(cache -> ((Double) (((double) cache.getStatistics().cacheHitCount()) / ((double) (cache.getStatistics().cacheMissCount() + cache.getStatistics().cacheHitCount())) * 100)).intValue() + "%").setCaption("Hit Ratio");
  grid.addColumn(cache -> cache.getCacheConfiguration().getMaxEntriesLocalHeap()).setCaption("Max Size");
  grid.addColumn(Cache::getSize).setCaption("Size");
  grid.addColumn(Cache::getStatus).setCaption("Status");
  grid.addColumn(cache -> cache.getCacheConfiguration().getTimeToIdleSeconds()).setCaption("TTldle(s)");
  grid.addColumn(cache -> cache.getCacheConfiguration().getTimeToLiveSeconds()).setCaption("TTLive(s)");
  grid.addColumn(cache -> cache.getStatistics().cacheHitCount()).setCaption("hit");
  grid.addColumn(cache -> cache.getStatistics().cacheMissExpiredCount()).setCaption("miss : Expire");
  grid.addColumn(cache -> cache.getStatistics().cacheMissNotFoundCount()).setCaption("miss : Not Found");
  grid.setItems(Collections.singletonList(this.ehcache));
  grid.setWidth("100%");
  grid.setSelectionMode(Grid.SelectionMode.NONE);
  grid.setHeightByRows(1);
  return grid;
}

代码示例来源:origin: kingbbode/spring-boot-ehcache-monitor

int ehcacheSize = this.ehcache.getKeys().size();
if (ehcacheSize != 0) {
  grid.setHeightByRows(ehcacheSize > 15 ? 15 : ehcacheSize);

相关文章

Grid类方法