Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public abstract class GridAggregate

  1. Object
  2. GridAggregate

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.

Fields

public static final GridAggregate SUMThe sum of the numbers; other values are skipped.
public static final GridAggregate AVERAGEThe mean of the numbers; other values are skipped.
public static final GridAggregate MINThe smallest value in the column’s order.
public static final GridAggregate MAXThe largest value in the column’s order.
public static final GridAggregate COUNTHow many rows have a value that is not null.

Constructors

public GridAggregate()

Methods

public abstract Object fold(GridColumn column, Object soFar, Object value)Folds one more value into the result so far.
public Object finish(Object soFar)What is shown for the folded result; by default the result itself.

Inherited methods

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 GridColumn
the column, for its order
soFar Object
what the previous call returned, null on the first
value Object
the row’s value

finish

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