jimm.datavision.field
Class ImageField

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

public class ImageField
extends Field

Represents an external image. The value instance value stores the images file's path.

Author:
Jim Menard, jimm@io.com

Field Summary
protected  javax.swing.ImageIcon hiddenImageIcon
           
protected  javax.swing.ImageIcon imageIcon
           
protected  java.net.URL imageURL
           
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
ImageField(java.lang.Long id, Report report, Section section, java.lang.Object value, boolean visible)
          Constructor.
 
Method Summary
 boolean canLoad()
           
 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.
 javax.swing.ImageIcon getHiddenImageIcon()
          Returns a dimmed version of the the image icon.
 javax.swing.ImageIcon getImageIcon()
          Returns the image icon, visually dimmed if the field is hidden.
 java.net.URL getImageURL()
          Returns the image URL.
 double getOutputHeight()
          Always returns the bounds height.
 javax.swing.ImageIcon getVisibleImageIcon()
          Returns the image icon.
 FieldWidget makeWidget(SectionWidget sw)
          Returns a new widget of the appropriate FieldWidget subclass for this field.
 void setValue(java.lang.Object newValue)
          Sets our value and image URL.
 java.lang.String toString()
          Returns this fields formatted value, ready for display in the report.
 java.lang.String typeString()
          Returns the string that specifies this field's type in the report XML.
 
Methods inherited from class jimm.datavision.field.Field
canBeAggregated, clone, create, createFromDragString, designLabel, finalize, getBorder, getBorderOrDefault, getBounds, getFormat, getId, getValue, refersTo, refersTo, refersTo, refersTo, setBorder, setBounds, setFormat, 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

imageURL

protected java.net.URL imageURL

imageIcon

protected javax.swing.ImageIcon imageIcon

hiddenImageIcon

protected javax.swing.ImageIcon hiddenImageIcon
Constructor Detail

ImageField

public ImageField(java.lang.Long id,
                  Report report,
                  Section section,
                  java.lang.Object value,
                  boolean visible)
Constructor. We make sure the value (a file path) is an absolute file path.

Parameters:
id - the unique identifier for the new field
report - the report containing this line
section - the section containing this line
value - the value; a file path string
visible - show/hide flag
Method Detail

getOutputHeight

public double getOutputHeight()
Always returns the bounds height.

Overrides:
getOutputHeight in class Field

getImageURL

public java.net.URL getImageURL()
Returns the image URL.

Returns:
the image URL

getImageIcon

public javax.swing.ImageIcon getImageIcon()
Returns the image icon, visually dimmed if the field is hidden.

Returns:
the image icon, dimmed if the field is not visible

getVisibleImageIcon

public javax.swing.ImageIcon getVisibleImageIcon()
Returns the image icon.

Returns:
the image icon

getHiddenImageIcon

public javax.swing.ImageIcon getHiddenImageIcon()
Returns a dimmed version of the the image icon.

Returns:
a dimmed version of the the image icon

setValue

public void setValue(java.lang.Object newValue)
Sets our value and image URL.

Overrides:
setValue in class Field
Parameters:
newValue - the new value

canLoad

public boolean canLoad()

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()
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

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

toString

public java.lang.String toString()
Description copied from class: Field
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.

Overrides:
toString in class Field
Returns:
the report display string; may be null