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

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

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

Grid.sort介绍

[英]Sort this Grid in ascending order by a specified column.
[中]按指定列按升序排序此网格。

代码示例

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

/**
 * Sort this Grid in ascending order by a specified column.
 *
 * @param column
 *            a column to sort against
 *
 */
public void sort(Column<T, ?> column) {
  sort(column, SortDirection.ASCENDING);
}

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

/**
 * Sort this Grid in ascending order by a specified column defined by id.
 *
 * @param columnId
 *            the id of the column to sort against
 *
 * @see Column#setId(String)
 */
public void sort(String columnId) {
  sort(columnId, SortDirection.ASCENDING);
}

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

/**
 * Sort this Grid in a user-specified direction by a column defined by id.
 *
 * @param columnId
 *            the id of the column to sort against
 * @param direction
 *            a sort order value (ascending/descending)
 *
 * @see Column#setId(String)
 */
public void sort(String columnId, SortDirection direction) {
  sort(getColumnOrThrow(columnId), direction);
}

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

private void setSortOrder(List<GridSortOrder<T>> order,
    boolean userOriginated) {
  Objects.requireNonNull(order, "Sort order list cannot be null");
  // Update client state to display sort order.
  List<String> sortColumns = new ArrayList<>();
  List<SortDirection> directions = new ArrayList<>();
  order.stream().forEach(sortOrder -> {
    sortColumns.add(sortOrder.getSorted().getInternalId());
    directions.add(sortOrder.getDirection());
  });
  getState().sortColumns = sortColumns.toArray(new String[0]);
  getState().sortDirs = directions.toArray(new SortDirection[0]);
  sortOrder.clear();
  sortOrder.addAll(order);
  sort(userOriginated);
}

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

@Override
protected void init(VaadinRequest request) {
  BeanContainer<Long, DecemberBean> dataSource = new BeanContainer<Long, DecemberBean>(DecemberBean.class);
  Grid grid = new Grid(dataSource);
  Runnable r = () -> {
    while (true) {
      System.out.println("update");
      try{Thread.sleep(2000);}catch(Exception e){e.printStackTrace();};
      UI.getCurrent().access(() -> {
        for (Long item : dataSource.getItemIds()) {
          DecemberBean k = dataSource.getItem(item).getBean();
          k.setNumber(k.getNumber() + 100);
        }
        grid.sort(grid.getContainerDataSource().getContainerPropertyIds().iterator().next());
      });
    }
  };
  dataSource.setBeanIdResolver(bean -> new Long(bean.getNumber()));
  for (int i = 0; i < 100; i++) {
    dataSource.addBean(new DecemberBean(i));
  }
  setContent(grid);
  new Thread(r).start();
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

@Override
public void sort(String columnId, SortDirection direction) {
  ColumnImpl<E> column = (ColumnImpl<E>) getColumnNN(columnId);
  component.sort(column.getGridColumn(), WebWrapperUtils.convertToGridSortDirection(direction));
}

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

getGrid().sort(gridSort);

相关文章

Grid类方法