jimm.datavision.field
Class UserColumnField

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

public class UserColumnField
extends Field
implements java.util.Observer

A user column field represents a user column, which in turn holds some SQL that is put in the SELECT clause of a query. The value of a user column field holds a UserColumn object. (In the XML, the user column field's value is the id of the user column.)

Author:
Jim Menard, jimm@io.com

Field Summary
protected  UserColumn usercol
           
 
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
UserColumnField(java.lang.Long id, Report report, Section section, java.lang.Object value, boolean visible)
          Constructs a user column field with the specified id in the specified report section whose UserColumn's id is value.
 
Method Summary
 boolean canBeAggregated()
          This override returns true if this user column is in a detail section.
 java.util.Collection columnsUsed()
          Returns a collection of the columns used in the user column.
 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 user columns, not user column fields.
protected  void finalize()
           
 java.lang.String formulaString()
          Returns a string representing the field as it appears in a formula.
 UserColumn getUserColumn()
          Returns the user column.
 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(Field f)
          Returns true if this field contains a reference to the specified field.
 boolean refersTo(Parameter p)
          Returns true if this field contains a reference to the specified parameter.
 void setUserColumn(UserColumn newUsercol)
          Sets the user column.
 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, 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

usercol

protected UserColumn usercol
Constructor Detail

UserColumnField

public UserColumnField(java.lang.Long id,
                       Report report,
                       Section section,
                       java.lang.Object value,
                       boolean visible)
Constructs a user column field with the specified id in the specified report section whose UserColumn'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 user column
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 user columns, not user column fields.

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

getUserColumn

public UserColumn getUserColumn()
Returns the user column.

Returns:
the user column

setUserColumn

public void setUserColumn(UserColumn newUsercol)
Sets the user column.

Parameters:
newUsercol - the new user column

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(Field f)
Description copied from class: Field
Returns true if this field contains a reference to the specified field. Most fields return false; only a AggregateField or FormulaField would return true.

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

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 user column is in a detail section. We don't really know that this user column returns a number, so we'll err on the side of allowing aggregation.

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 user column fields, this is the value generated by evaluating the UserColumn.

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

columnsUsed

public java.util.Collection columnsUsed()
Returns a collection of the columns used in the user column. This is used by the report's query when it is figuring out what columns and tables are used by the report. Calls Expression.columnsUsed().

See Also:
Query.findSelectablesUsed()