jimm.datavision.field
Class ParameterField

java.lang.Object
  extended by java.util.Observable
      extended by jimm.datavision.Element
          extended by jimm.datavision.field.Field
              extended by jimm.datavision.field.ParameterField
All Implemented Interfaces:
java.lang.Cloneable, java.util.Observer, Draggable, Identity, Writeable

public class ParameterField
extends Field
implements java.util.Observer

A parameter field represents a parameter. The value of a parameter field holds a Parameter object. In the XML, the parameter field's value is the id of the parameter.

Author:
Jim Menard, jimm@io.com

Field Summary
protected  Parameter parameter
           
 
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
ParameterField(java.lang.Long id, Report report, Section section, java.lang.Object value, boolean visible)
          Constructs a parameter field with the specified id in the specified report section whose Parameter's id is value.
 
Method Summary
 boolean canBeAggregated()
          This override returns true if this parameter is in a detail section and returns a number.
 java.lang.String designLabel()
          Returns a string representing the field in the GUI during report design.
 java.lang.String dragString()
          Not really used; we drag parameters, not parameter fields.
protected  void finalize()
           
 java.lang.String formulaString()
          Returns a string representing the field as it appears in a formula.
 Parameter getParameter()
          Returns the parameter.
 java.lang.Object getValue()
          Returns the value of this field.
 FieldWidget makeWidget(SectionWidget sw)
          Returns a new widget of the appropriate FieldWidget subclass for this field.
 boolean refersTo(Parameter p)
          Returns true if this field contains a reference to the specified parameter.
 void setParameter(Parameter newParameter)
          Sets the parameter.
 java.lang.String typeString()
          Returns the string that specifies this field's type in the report XML.
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class jimm.datavision.field.Field
clone, create, createFromDragString, getBorder, getBorderOrDefault, getBounds, getFormat, getId, getOutputHeight, refersTo, refersTo, refersTo, setBorder, setBounds, setFormat, setValue, toString, 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

parameter

protected Parameter parameter
Constructor Detail

ParameterField

public ParameterField(java.lang.Long id,
                      Report report,
                      Section section,
                      java.lang.Object value,
                      boolean visible)
Constructs a parameter field with the specified id in the specified report section whose Parameter's id is value.

Parameters:
id - the new field's id
report - the report containing this element
section - the report section in which the field resides
value - the id of a parameter
visible - show/hide flag
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class Field
Throws:
java.lang.Throwable

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer
Overrides:
update in class Field

makeWidget

public FieldWidget makeWidget(SectionWidget sw)
Description copied from class: Field
Returns a new widget of the appropriate FieldWidget subclass for this field. Subclasses override this method to return different types of widgets.

Overrides:
makeWidget in class Field
Parameters:
sw - a field widget

dragString

public java.lang.String dragString()
Not really used; we drag parameters, not parameter fields.

Specified by:
dragString in interface Draggable
Specified by:
dragString in class Field
Returns:
the string used to identify the field when dragging

getParameter

public Parameter getParameter()
Returns the parameter.

Returns:
the parameter

setParameter

public void setParameter(Parameter newParameter)
Sets the parameter.

Parameters:
newParameter - the new parameter

typeString

public java.lang.String typeString()
Description copied from class: Field
Returns the string that specifies this field's type in the report XML.

Specified by:
typeString in class Field
Returns:
a string representing this field's type; used in XML files

designLabel

public java.lang.String designLabel()
Description copied from class: Field
Returns a string representing the field in the GUI during report design.

Overrides:
designLabel in class Field
Returns:
a string useful for display in the design GUI

formulaString

public java.lang.String formulaString()
Description copied from class: Field
Returns a string representing the field as it appears in a formula.

Specified by:
formulaString in class Field
Returns:
a string useful in a formula

refersTo

public boolean refersTo(Parameter p)
Description copied from class: Field
Returns true if this field contains a reference to the specified parameter. Most fields return false; only a AggregateField or FormulaField would return true.

Overrides:
refersTo in class Field
Parameters:
p - a parameter
Returns:
true if this field contains a reference to the specified field

canBeAggregated

public boolean canBeAggregated()
This override returns true if this parameter is in a detail section and returns a number.

Overrides:
canBeAggregated in class Field
Returns:
true if this field can be aggregated

getValue

public java.lang.Object getValue()
Returns the value of this field. For parameter fields, this is the value generated by evaluating the Parameter.

Overrides:
getValue in class Field
Returns:
the result of evaluating the parameter