borland Packages Class Hierarchy dx.dataset Package
java.util.EventListener +----com.borland.dx.dataset.CalcAggFieldsListener
Methods
Implemented by CalcAggFieldsAdapter
This interface is used for notification of a row being added or deleted on a DataSet
having a calculation on an aggregate column. The CalcAggFieldsListener
listens for this notification in order to recompute the calculation based on the aggregation.
For example, your application uses a sum aggregator to compute the total value of an order as the sum of the extended price column for all the rows for that order. It then uses a CalcAggFieldsListener
to compute the tax and shipping charges on top of the total. When a row is added or deleted from the order, the CalcAggFieldsListener
is aware of this and recalculates the tax and shipping charges. In this example, you
calcType
to CalcType.Aggregate
.
aggDescriptor
to specify sorting (not target column or aggregation operation).
CalcAggFieldsListener
to compute the calculation based on the aggregated column.
This class differs from the CalcFieldsListener
in that this class is used to do calculations on maintained aggregates. The CalcFieldsListener
class is used for calculations on rows.
Once this listener is set on a StorageDataSet
, the name of the listener class is remembered. If another StorageDataSet
opens the same table stream without having set a listener with the same class name, the StorageDataSet
will be marked readOnly
. The StorageDataSet can be made writable again by doing one of the following:
StorageDataSet.recalc()
or StorageDataSet.restructure()
. This
will cause the system to forget the listener class name.
DataSetException.NEEDS_RECALC
.
public void calcAggAdd(ReadRow row, ReadWriteRow resultRow)
Called when a new or modified row is posted. In the case of a modified row, both calcAggDelete()
and calcAggAdd()
are called.
row
resultRow
calcAggAdd()
is called, resultRow
has the same values an row
. Typically, you only change the values in columns that are calculations on aggregate columns.
public void calcAggDelete(ReadRow row, ReadWriteRow resultRow)
Called when a row is deleted from the data set or a modified row is posted. In the case of a modified row, calcAggAdd()
is also called.
row
resultRow