eas grouping of kdtable

  • How to specify whether you want the data packets and which column grouping
// specify KDTable to be a data packet
table.getGroupManager().setGroup(true);
// specified to be 0 , 1 , 2 three grouping
table.getColumn(0).setGroup(true);
table.getColumn(1).setGroup(true);
table.getColumn(2).setGroup(true);
  • How to specify whether the cell fusion according to packet
// specified to be 0 , 1 , 2 grouping columns is fused cells
table.getColumn(0).setMergeable(true);
table.getColumn(1).setMergeable(true);
table.getColumn(2).setMergeable(true);
  • How to specify whether to do statistics, which are grouped statistics, and whether to do a total of
// After the specified group to do a total of
table.getGroupManager().setTotalize(true);
// indicate to the first 0 statistical columns
table.getColumn(0).setStat(true);
// indicate to the first one statistical column
table.getColumn(1).setStat(true);
// indicate to the first 2 statistics columns
table.getColumn(2).setStat(true);
  • How to specify the location of the line of statistics
// position is in line statistical data rows below
table.getGroupManager().setOrientation(KDTStyleConstants.DOWN);
// position is at the top of the line statistical data row
table.getGroupManager().setOrientation(KDTStyleConstants.UP);
  • How to define the content and style of the statistical line display
// define two variables
IRow row0;
KDTDataStyle ds;
// set the template line statistics
// get the template Total row (row total group level is - 1 )
row0 = (IRow)table.getGroupManager().getStatRowTemplate(-1);
// modify the Total row background color is blue
row0.getStyleAttributes().getInterior().setBackground(Color.blue);
// Set total row 0 value units of
row0.getCell (0) .setValue ( " Total ");
// 设置总计行第3个单元的统计公式
row0.getCell(3). setExpressions(KDTGroupManager.STAT_SUM);
        
// 获取第0级统计的模板
row0 = (IRow)table.getGroupManager().getStatRowTemplate(0);
// 设置第0级统计行的背景色
row0.getStyleAttributes().getInterior().setBackground(Color.green);
// 设置第0级统计行的第0个单元的值
row0.getCell(0).setValue("平均值");
// 设置第0级统计行第3个单元的统计公式
row0.getCell(3).setExpressions(KDTGroupManager.STAT_AVERAGE);
        
// 获取第1级统计的模板
row0 = (IRow)table.getGroupManager().getStatRowTemplate(1);
// 设置第1级统计行的背景色
row0.getStyleAttributes().getInterior().setBackground(Color.cyan);
// 设置第1级统计行的第0个单元的值
row0.getCell(1).setValue("最大值");
// 设置第1级统计行第3个单元的统计公式
row0.getCell(3).setExpressions(KDTGroupManager.STAT_MAX);
// 获取第2级统计的模板
row0 = (IRow)table.getGroupManager().getStatRowTemplate(2);
// 设置第2级统计行的背景色
row0.getStyleAttributes().getInterior().setBackground(Color.darkGray);
// 设置第2级统计行的第0个单元的值
row0.getCell(2).setValue("最小值");
// 设置第2级统计行第3个单元的统计公式
row0.getCell(3).setExpressions(KDTGroupManager.STAT_MIN);
  • 如何根据分组统计的情况生成树
// 生成树
table.getGroupManager().toTreeColumn();
// 重新调整布局并刷新
table.reLayoutAndPaint();

Guess you like

Origin www.cnblogs.com/luojiabao/p/10963686.html
EAS