| java.lang.Object java.util.Observable jimm.datavision.Element jimm.datavision.field.Field
All known Subclasses: jimm.datavision.field.UserColumnField, jimm.datavision.field.ImageField, jimm.datavision.field.SubreportField, jimm.datavision.field.SpecialField, jimm.datavision.field.ColumnField, jimm.datavision.field.FormulaField, jimm.datavision.field.TextField, jimm.datavision.field.ParameterField,
Field | abstract public class Field extends Element implements Identity,Draggable,Cloneable(Code) | | The abstract superclass of visual report fields that display text labels,
database columns, special values, aggregate values, formulas, and
parameters. A field has a bounds
Rectangle that determines its
position within a section and an associated
Format and
Border for determining how to display the field.
To avoid repeated font size and line width calculations, a
FormattedValueCache holds the formatted version of this field's value.
author: Jim Menard, jimm@io.com |
Method Summary | |
public boolean | canBeAggregated() Returns true if this field can be aggregated. | public Object | clone() Returns a clone. | public static Field | create(Long id, Report report, Section section, String type, Object value, boolean visible) This factory method constructs and returns a new instance of a subclass
of Field based on the type string.
If id is null , generates a new id number. | public static Field | createFromDragString(Report report, String str) Creates a field from a drag string. | public String | designLabel() Returns a string representing the field in the GUI during report design. | abstract public String | dragString() Returns the string used to identify a field type when dragging. | protected void | finalize() | abstract public String | formulaString() Returns a string representing the field as it appears in a formula. | public Border | getBorder() Returns the border for this field. | public Border | getBorderOrDefault() Returns the border for this field or, if it is null , the
report's default border. | public Rectangle | getBounds() Returns the bounds rectangle for this field. | public Format | getFormat() Returns the format for this field. | public Object | getId() | public double | getOutputHeight() Returns the height needed to output the current value of this field. | public Object | getValue() Returns the value for this field. | public FieldWidget | makeWidget(SectionWidget sw) Returns a new widget of the appropriate FieldWidget
subclass for this field. | public boolean | refersTo(Field f) Returns true if this field contains a reference to the
specified field. | public boolean | refersTo(Formula f) Returns true if this field contains a reference to the
specified formula. | public boolean | refersTo(UserColumn uc) Returns true if this field contains a reference to the
specified user column. | public boolean | refersTo(Parameter p) Returns true if this field contains a reference to the
specified parameter. | public void | setBorder(Border newBorder) Sets the border. | public void | setBounds(Rectangle newBounds) Sets the bounds rectangle. | public void | setFormat(Format newFormat) Sets the format. | public void | setValue(Object newValue) Sets the value. | public String | toString() Returns this fields formatted value, ready for display in the report. | abstract public String | typeString() Returns the string that specifies this field's type in the report XML. | public void | update(Observable o, Object arg) | protected void | writeFieldGuts(XMLWriter out) Writes objects contained within this field (bounds, border, and format). | public void | writeXML(XMLWriter out) Writes this field as an XML tag. |
DEFAULT_HEIGHT | final public static double DEFAULT_HEIGHT(Code) | | |
DEFAULT_WIDTH | final public static double DEFAULT_WIDTH(Code) | | |
Field | protected Field(Long id, Report report, Section section, Object value, boolean visible)(Code) | | Constructor.
Parameters: id - the unique identifier for the new field Parameters: report - the report containing this element Parameters: section - the report section containing the field Parameters: value - the value this field represents visually Parameters: visible - show/hide flag |
canBeAggregated | public boolean canBeAggregated()(Code) | | Returns true if this field can be aggregated. This method
returns false by default but is overridded by classes whose
values may be aggregated.
true if this field can be aggregated |
clone | public Object clone()(Code) | | Returns a clone. Subclasses may need ot override this method to copy
additional instance variables that are not set in their constructors.
an almost-ready clone of this object |
create | public static Field create(Long id, Report report, Section section, String type, Object value, boolean visible)(Code) | | This factory method constructs and returns a new instance of a subclass
of Field based on the type string.
If id is null , generates a new id number. This
number is one higher than any previously-seen id number. This does
not guarantee that no later field will be created manually with
the same id number.
Parameters: id - the unique identifier for the new field; if null ,generate a new id Parameters: section - the report section containing the field Parameters: type - one of "special", "text", "column", "formula", "parameter","image", or one of the aggregate function names; found in report XML |
createFromDragString | public static Field createFromDragString(Report report, String str)(Code) | | Creates a field from a drag string. str should a string
created by some field's
Field.dragString method.
Parameters: report - the report containing this element Parameters: str - a drag string a new field |
designLabel | public String designLabel()(Code) | | Returns a string representing the field in the GUI during report design.
a string useful for display in the design GUI |
dragString | abstract public String dragString()(Code) | | Returns the string used to identify a field type when dragging.
Usually returns
Field.typeString plus a value or an id.
the string used to identify the field when dragging |
formulaString | abstract public String formulaString()(Code) | | Returns a string representing the field as it appears in a formula.
a string useful in a formula |
getBorder | public Border getBorder()(Code) | | Returns the border for this field. May return null .
the border, possibly null |
getBorderOrDefault | public Border getBorderOrDefault()(Code) | | Returns the border for this field or, if it is null , the
report's default border. If we return the default border, we clone it
in order to give it this field.
this field's border or the default border |
getBounds | public Rectangle getBounds()(Code) | | Returns the bounds rectangle for this field.
the bounds rectangle |
getFormat | public Format getFormat()(Code) | | Returns the format for this field. May return null .
the format, possibly null |
getOutputHeight | public double getOutputHeight()(Code) | | Returns the height needed to output the current value of this field.
This default implementation returns the height of the field as
defined in the report designer (the bounds height).
|
getValue | public Object getValue()(Code) | | Returns the value for this field. May return null .
the value, possibly null |
makeWidget | public FieldWidget makeWidget(SectionWidget sw)(Code) | | Returns a new widget of the appropriate FieldWidget
subclass for this field. Subclasses override this method to return
different types of widgets.
Parameters: sw - a field widget |
refersTo | public boolean refersTo(Field f)(Code) | | Returns true if this field contains a reference to the
specified field. Most fields return false ; only a
AggregateField or
FormulaField would return true .
Parameters: f - a field true if this field contains a reference to thespecified field |
refersTo | public boolean refersTo(Formula f)(Code) | | Returns true if this field contains a reference to the
specified formula. Most fields return false ; only a
AggregateField or
FormulaField would return true .
Parameters: f - a formula true if this field contains a reference to thespecified field |
refersTo | public boolean refersTo(UserColumn uc)(Code) | | Returns true if this field contains a reference to the
specified user column. Most fields return false ; only a
AggregateField ,
UserColumnField , or
FormulaField would
return true .
Parameters: uc - a user column true if this field contains a reference to thespecified user column |
refersTo | public boolean refersTo(Parameter p)(Code) | | Returns true if this field contains a reference to the
specified parameter. Most fields return false ; only a
AggregateField or
FormulaField would return true .
Parameters: p - a parameter true if this field contains a reference to thespecified field |
setBorder | public void setBorder(Border newBorder)(Code) | | Sets the border.
Parameters: newBorder - the new border |
setBounds | public void setBounds(Rectangle newBounds)(Code) | | Sets the bounds rectangle.
Parameters: newBounds - the new bounds rectangle |
setFormat | public void setFormat(Format newFormat)(Code) | | Sets the format. If this field already has a format, you can just modify
it instead of giving it a completely new one.
Parameters: newFormat - the format |
setValue | public void setValue(Object newValue)(Code) | | Sets the value.
Parameters: newValue - the new value |
toString | public String toString()(Code) | | Returns this fields formatted value, ready for display in the report.
If this field is invisible, or getValue returns
null then this method will return null .
the report display string; may be null |
typeString | abstract public String typeString()(Code) | | Returns the string that specifies this field's type in the report XML.
a string representing this field's type; used in XML files |
writeFieldGuts | protected void writeFieldGuts(XMLWriter out)(Code) | | Writes objects contained within this field (bounds, border, and format).
Parameters: out - a writer that knows how to write XML |
writeXML | public void writeXML(XMLWriter out)(Code) | | Writes this field as an XML tag. Writes bounds, border, and format.
Parameters: out - a writer that knows how to write XML |
|
|