Class GridAggregate

java.lang.Object
com.codename1.ui.table.GridAggregate

public abstract class GridAggregate extends Object

What a group row of a DataGrid shows in a column: the values of the group's rows folded into one.

fold is called once per row of the group, in order, with what it returned for the rows before; the first call gets null. finish turns the last result into what is shown. An aggregate keeps no state of its own, so one instance serves every group and every column.

  • Field Details

    • SUM

      public static final GridAggregate SUM
      The sum of the numbers; other values are skipped.
    • AVERAGE

      public static final GridAggregate AVERAGE
      The mean of the numbers; other values are skipped.
    • MIN

      public static final GridAggregate MIN
      The smallest value in the column's order.
    • MAX

      public static final GridAggregate MAX
      The largest value in the column's order.
    • COUNT

      public static final GridAggregate COUNT
      How many rows have a value that is not null.
  • Constructor Details

    • GridAggregate

      public GridAggregate()
  • Method Details

    • fold

      public abstract Object fold(GridColumn column, Object soFar, Object value)

      Folds one more value into the result so far.

      Parameters
      • column: the column, for its order
      • soFar: what the previous call returned, null on the first
      • value: the row's value
    • finish

      public Object finish(Object soFar)
      What is shown for the folded result; by default the result itself.