jimm.datavision.field
Class SpecialField

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

public class SpecialField
extends Field

A SpecialField represents a special value such as the report name or current page number. The value of a SpecialField is a string that identifies which value to display.

Author:
Jim Menard, jimm@io.com

Field Summary
static java.lang.String TYPE_STRING
           
 
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
SpecialField(java.lang.Long id, Report report, Section section, java.lang.Object value, boolean visible)
          Constructs a special field with the specified id in the specified report section whose special value is value.
 
Method Summary
 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.
 java.lang.String formulaString()
          Returns a string representing the field as it appears in a formula.
 java.lang.Object getValue()
          Returns the value of this field.
protected static java.lang.Integer groupCount(Field f)
          Returns the group count for the group in which this field resides.
static java.util.HashMap specialFieldNames()
          Returns an array of all of the special field names.
 java.lang.String typeString()
          Returns the string that specifies this field's type in the report XML.
static java.lang.Object value(Field f, java.lang.String str, Report report)
          Returns the value associated with the given special field name string.
 
Methods inherited from class jimm.datavision.field.Field
canBeAggregated, clone, create, createFromDragString, finalize, getBorder, getBorderOrDefault, getBounds, getFormat, getId, getOutputHeight, makeWidget, refersTo, refersTo, refersTo, refersTo, 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

TYPE_STRING

public static final java.lang.String TYPE_STRING
See Also:
Constant Field Values
Constructor Detail

SpecialField

public SpecialField(java.lang.Long id,
                    Report report,
                    Section section,
                    java.lang.Object value,
                    boolean visible)
Constructs a special field with the specified id in the specified report section whose special value 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 magic string
visible - show/hide flag
Method Detail

specialFieldNames

public static java.util.HashMap specialFieldNames()
Returns an array of all of the special field names. We read the map each time because (in theory) the language could have changed and all the strings could be different.

Returns:
an array strings containing all of the special field names

value

public static java.lang.Object value(Field f,
                                     java.lang.String str,
                                     Report report)
Returns the value associated with the given special field name string.

Parameters:
str - the special field name string
report - the report that is running
Returns:
a string

groupCount

protected static java.lang.Integer groupCount(Field f)
Returns the group count for the group in which this field resides. If we are in the detail section, return the count of the innermost group. Else If the group is null (for example, we are in the report footer), returns the report.row value. If f is null, return 0.

Parameters:
f - a field
Returns:
the number of records in the group or the current record number within the group.

dragString

public java.lang.String dragString()
Description copied from class: Field
Returns the string used to identify a field type when dragging. Usually returns Field.typeString() plus a value or an id.

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

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

getValue

public java.lang.Object getValue()
Returns the value of this field.

Overrides:
getValue in class Field
Returns:
a string