|
||||||||||
| 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
public abstract class Field
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.
| Field Summary | |
|---|---|
protected Border |
border
|
protected Rectangle |
bounds
|
protected FormattedValueCache |
cache
|
static double |
DEFAULT_HEIGHT
|
static double |
DEFAULT_WIDTH
|
protected Format |
format
|
protected java.lang.Long |
id
|
(package private) static java.lang.Long |
maxIdSeen
|
protected java.lang.Object |
value
|
| Fields inherited from class jimm.datavision.Element |
|---|
report, section, visible |
| Constructor Summary | |
|---|---|
protected |
Field(java.lang.Long id,
Report report,
Section section,
java.lang.Object value,
boolean visible)
Constructor. |
| Method Summary | |
|---|---|
boolean |
canBeAggregated()
Returns true if this field can be aggregated. |
java.lang.Object |
clone()
Returns a clone. |
static Field |
create(java.lang.Long id,
Report report,
Section section,
java.lang.String type,
java.lang.Object value,
boolean visible)
This factory method constructs and returns a new instance of a subclass of Field based on the type string. |
static Field |
createFromDragString(Report report,
java.lang.String str)
Creates a field from a drag string. |
java.lang.String |
designLabel()
Returns a string representing the field in the GUI during report design. |
abstract java.lang.String |
dragString()
Returns the string used to identify a field type when dragging. |
protected void |
finalize()
|
abstract java.lang.String |
formulaString()
Returns a string representing the field as it appears in a formula. |
Border |
getBorder()
Returns the border for this field. |
Border |
getBorderOrDefault()
Returns the border for this field or, if it is null, the
report's default border. |
Rectangle |
getBounds()
Returns the bounds rectangle for this field. |
Format |
getFormat()
Returns the format for this field. |
java.lang.Object |
getId()
Returns the identity. |
double |
getOutputHeight()
Returns the height needed to output the current value of this field. |
java.lang.Object |
getValue()
Returns the value for this field. |
FieldWidget |
makeWidget(SectionWidget sw)
Returns a new widget of the appropriate FieldWidget
subclass for this field. |
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 |
setBorder(Border newBorder)
Sets the border. |
void |
setBounds(Rectangle newBounds)
Sets the bounds rectangle. |
void |
setFormat(Format newFormat)
Sets the format. |
void |
setValue(java.lang.Object newValue)
Sets the value. |
java.lang.String |
toString()
Returns this fields formatted value, ready for display in the report. |
abstract 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)
|
protected void |
writeFieldGuts(XMLWriter out)
Writes objects contained within this field (bounds, border, and format). |
void |
writeXML(XMLWriter out)
Writes this field as an XML tag. |
| 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 |
|---|
public static final double DEFAULT_WIDTH
public static final double DEFAULT_HEIGHT
static java.lang.Long maxIdSeen
protected java.lang.Long id
protected Rectangle bounds
protected Format format
protected Border border
protected java.lang.Object value
protected FormattedValueCache cache
| Constructor Detail |
|---|
protected Field(java.lang.Long id,
Report report,
Section section,
java.lang.Object value,
boolean visible)
id - the unique identifier for the new fieldreport - the report containing this elementsection - the report section containing the fieldvalue - the value this field represents visuallyvisible - show/hide flag| Method Detail |
|---|
public static Field create(java.lang.Long id,
Report report,
Section section,
java.lang.String type,
java.lang.Object value,
boolean visible)
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.
id - the unique identifier for the new field; if null,
generate a new idsection - the report section containing the fieldtype - one of "special", "text", "column", "formula", "parameter",
"image", or one of the aggregate function names; found in report XML
public static Field createFromDragString(Report report,
java.lang.String str)
dragString() method.
report - the report containing this elementstr - a drag string
public java.lang.Object clone()
clone in class java.lang.Object
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
public void update(java.util.Observable o,
java.lang.Object arg)
update in interface java.util.Observerupdate in class Elementpublic java.lang.Object getId()
Identity
getId in interface Identitypublic Rectangle getBounds()
public void setBounds(Rectangle newBounds)
newBounds - the new bounds rectanglepublic double getOutputHeight()
public Format getFormat()
null.
nullpublic void setFormat(Format newFormat)
newFormat - the formatpublic Border getBorder()
null.
nullpublic Border getBorderOrDefault()
null, the
report's default border. If we return the default border, we clone it
in order to give it this field.
public void setBorder(Border newBorder)
newBorder - the new borderpublic java.lang.Object getValue()
null.
nullpublic void setValue(java.lang.Object newValue)
newValue - the new valuepublic FieldWidget makeWidget(SectionWidget sw)
FieldWidget
subclass for this field. Subclasses override this method to return
different types of widgets.
sw - a field widgetpublic abstract java.lang.String typeString()
public abstract java.lang.String dragString()
typeString() plus a value or an id.
dragString in interface Draggablepublic java.lang.String designLabel()
public abstract java.lang.String formulaString()
public boolean refersTo(Field f)
true if this field contains a reference to the
specified field. Most fields return false; only a AggregateField or FormulaField would return true.
f - a field
true if this field contains a reference to the
specified fieldpublic boolean refersTo(Formula f)
true if this field contains a reference to the
specified formula. Most fields return false; only a AggregateField or FormulaField would return true.
f - a formula
true if this field contains a reference to the
specified fieldpublic boolean refersTo(UserColumn uc)
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.
uc - a user column
true if this field contains a reference to the
specified user columnpublic boolean refersTo(Parameter p)
true if this field contains a reference to the
specified parameter. Most fields return false; only a AggregateField or FormulaField would return true.
p - a parameter
true if this field contains a reference to the
specified fieldpublic boolean canBeAggregated()
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 aggregatedpublic java.lang.String toString()
getValue returns
null then this method will return null.
toString in class java.lang.Objectnullpublic void writeXML(XMLWriter out)
writeXML in interface WriteablewriteXML in class Elementout - a writer that knows how to write XMLprotected void writeFieldGuts(XMLWriter out)
out - a writer that knows how to write XML
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||