|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
jimm.datavision.Element
jimm.datavision.field.Field
jimm.datavision.field.AggregateField
public class AggregateField
An aggregate field represents a field's aggregated values, either ColumnField or FormulaField. It also may be associated with a
group (assigned in ReportReader.field or when editing a report),
meaning that the aggregate value is reset whenever the group's value
changes. The value of an aggregate field holds the id of some other field
whose value we are aggregating.
| Field Summary | |
|---|---|
protected Field |
fieldToAggregate
|
protected AggregateFunction |
function
|
protected java.lang.String |
functionName
|
protected static java.lang.Object[] |
functionNames
A sorted array of the function names. |
protected static java.util.HashMap |
functions
Maps function names to AggregateFunction objects. |
protected Group |
group
|
protected static int |
START_VALUES_LENGTH
|
protected double[] |
values
|
protected int |
valuesIndex
|
| Fields inherited from class jimm.datavision.field.Field |
|---|
border, bounds, cache, DEFAULT_HEIGHT, DEFAULT_WIDTH, format, id, maxIdSeen, value |
| Fields inherited from class jimm.datavision.Element |
|---|
report, section, visible |
| Constructor Summary | |
|---|---|
AggregateField(java.lang.Long id,
Report report,
Section section,
java.lang.Object value,
boolean visible,
java.lang.String functionName)
Constructs a field with the specified id in the specified report section that aggregates the field with id value. |
|
| Method Summary | |
|---|---|
boolean |
canBeAggregated()
Returns true if this field can be aggregated. |
java.lang.String |
designLabel()
Returns a string representing the field in the GUI during report design. |
java.lang.String |
dragString()
Returns the string used to identify a field type when dragging. |
protected void |
finalize()
|
java.lang.String |
formulaString()
Returns a string representing the field as it appears in a formula. |
static java.lang.Object[] |
functionNameArray()
Returns the list of function names as an array of objects. |
double |
getAggregateValue()
Returns the current aggregate value. |
Field |
getField()
Returns the field over which we are aggregating. |
java.lang.Long |
getFieldId()
Returns the id of the field over which we are aggregating. |
java.lang.String |
getFunction()
|
Group |
getGroup()
Returns the group over which this field is aggregating. |
java.lang.Object |
getValue()
Returns the value of this field: the aggregate as a Double. |
void |
initialize()
Resets this aggregate. |
static boolean |
isAggregateFunctionName(java.lang.String functionName)
Returns true if functionName is a legal aggregate
function name. |
boolean |
refersTo(Field f)
Returns true if this field contains a reference to the
specified field. |
boolean |
refersTo(Formula f)
Returns true if this field contains a reference to the
specified formula. |
boolean |
refersTo(Parameter p)
Returns true if this field contains a reference to the
specified parameter. |
boolean |
refersTo(UserColumn uc)
Returns true if this field contains a reference to the
specified user column. |
void |
setFunction(java.lang.String newFunctionName)
|
void |
setGroup(Group newGroup)
Sets the group this field is aggregate. |
java.lang.String |
typeString()
Returns the string that specifies this field's type in the report XML. |
void |
updateAggregate()
Updates the aggregate value. |
| Methods inherited from class jimm.datavision.field.Field |
|---|
clone, create, createFromDragString, getBorder, getBorderOrDefault, getBounds, getFormat, getId, getOutputHeight, makeWidget, setBorder, setBounds, setFormat, setValue, toString, update, writeFieldGuts, writeXML |
| Methods inherited from class jimm.datavision.Element |
|---|
getReport, getSection, isVisible, setSection, setVisible |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int START_VALUES_LENGTH
protected static java.util.HashMap functions
AggregateFunction objects.
protected static java.lang.Object[] functionNames
protected Group group
protected java.lang.String functionName
protected AggregateFunction function
protected double[] values
protected int valuesIndex
protected Field fieldToAggregate
| Constructor Detail |
|---|
public AggregateField(java.lang.Long id,
Report report,
Section section,
java.lang.Object value,
boolean visible,
java.lang.String functionName)
id - the new field's idreport - the report containing this elementsection - the report section in which the field residesvalue - the magic stringvisible - show/hide flagfunctionName - "xxx", where xxx is the aggregate function| Method Detail |
|---|
public static boolean isAggregateFunctionName(java.lang.String functionName)
true if functionName is a legal aggregate
function name.
functionName - an aggregate function name (hopefully)
true if it's a function namepublic static java.lang.Object[] functionNameArray()
protected void finalize()
throws java.lang.Throwable
finalize in class Fieldjava.lang.Throwablepublic java.lang.String getFunction()
public void setFunction(java.lang.String newFunctionName)
public void initialize()
public java.lang.String dragString()
FieldField.typeString() plus a value or an id.
dragString in interface DraggabledragString in class Fieldpublic Group getGroup()
null since not all aggregate fields are associated with
a group.
null if this aggregate field is not
associated with any grouppublic void setGroup(Group newGroup)
null.
newGroup - a grouppublic Field getField()
public java.lang.Long getFieldId()
public double getAggregateValue()
public java.lang.String typeString()
Field
typeString in class Fieldpublic java.lang.String designLabel()
Field
designLabel in class Fieldpublic java.lang.String formulaString()
Field
formulaString in class Fieldpublic boolean refersTo(Field f)
Fieldtrue if this field contains a reference to the
specified field. Most fields return false; only a AggregateField or FormulaField would return true.
refersTo in class Fieldf - a field
true if this field contains a reference to the
specified fieldpublic boolean refersTo(Formula f)
Fieldtrue if this field contains a reference to the
specified formula. Most fields return false; only a AggregateField or FormulaField would return true.
refersTo in class Fieldf - a formula
true if this field contains a reference to the
specified fieldpublic boolean refersTo(UserColumn uc)
Fieldtrue if this field contains a reference to the
specified user column. Most fields return false; only a AggregateField, UserColumnField, or FormulaField would
return true.
refersTo in class Fielduc - a user column
true if this field contains a reference to the
specified user columnpublic boolean refersTo(Parameter p)
Fieldtrue if this field contains a reference to the
specified parameter. Most fields return false; only a AggregateField or FormulaField would return true.
refersTo in class Fieldp - a parameter
true if this field contains a reference to the
specified fieldpublic boolean canBeAggregated()
Fieldtrue if this field can be aggregated. This method
returns false by default but is overridded by classes whose
values may be aggregated.
canBeAggregated in class Fieldtrue if this field can be aggregatedpublic void updateAggregate()
public java.lang.Object getValue()
getValue in class Field
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||