org.jurvis.swing.form
Class JvPropertyEditorField

java.lang.Object
  extended by org.jurvis.swing.form.JvAbstractField
      extended by org.jurvis.swing.form.JvPropertyEditorField
All Implemented Interfaces:
JvField

public class JvPropertyEditorField
extends JvAbstractField

A JvField that uses a PropertyEditor to convert the field's value to and from a string representation. The string representation is displayed within a JTextComponent.

Author:
Neil W. Weber
See Also:
JvField

Field Summary
protected  PropertyEditor editor
          The PropertyEditor used to convert an object to a string and vice-versa.
 
Fields inherited from class org.jurvis.swing.form.JvAbstractField
component, label
 
Constructor Summary
JvPropertyEditorField(PropertyEditor editor, JLabel label, JTextComponent textComponent)
          Construct a new JvPropertyEditorField using editor to convert an object to string and vice-versa.
 
Method Summary
 String getAsText()
          Gets the property value as text.
 Object getValue()
          Gets the field value.
 boolean isEditable()
          Returns the boolean indicating whether this field is editable or not.
 void setEditable(boolean editable)
          Sets the specified boolean to indicate whether or not this field should be editable.
 void setValue(Object value)
          Set (or change) the object that is to be edited.
 
Methods inherited from class org.jurvis.swing.form.JvAbstractField
getComponent, getLabel, getMessage, getName, getWrapper, isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

editor

protected PropertyEditor editor
The PropertyEditor used to convert an object to a string and vice-versa.

Constructor Detail

JvPropertyEditorField

public JvPropertyEditorField(PropertyEditor editor,
                             JLabel label,
                             JTextComponent textComponent)
Construct a new JvPropertyEditorField using editor to convert an object to string and vice-versa.

Parameters:
editor - the editor used for converting objects
label - the JLabel used to identify this field
textComponent - the actual GUI field editor
Method Detail

getAsText

public String getAsText()
Gets the property value as text.

Specified by:
getAsText in interface JvField
Overrides:
getAsText in class JvAbstractField
Returns:
the property value as a human editable string

getValue

public Object getValue()
Gets the field value.

Returns:
The value of the field. Primitive types such as "int" will be wrapped as the corresponding object type such as "java.lang.Integer".

setValue

public void setValue(Object value)
Set (or change) the object that is to be edited. Primitive types such as "int" must be wrapped as the corresponding object type such as "java.lang.Integer".

Parameters:
value - The new target object to be edited. Note that this object is not modified during editing, rather a new object is created to hold the modified value.

isEditable

public boolean isEditable()
Returns the boolean indicating whether this field is editable or not.

Specified by:
isEditable in interface JvField
Overrides:
isEditable in class JvAbstractField
Returns:
true if the field is editable; false otherwise

setEditable

public void setEditable(boolean editable)
Sets the specified boolean to indicate whether or not this field should be editable. Sets the GUI component to the editable setting. If the field is set to non-editable, the background and border are modified to visibly indicate the non-editable status.

Specified by:
setEditable in interface JvField
Overrides:
setEditable in class JvAbstractField
Parameters:
editable - the boolean to be set


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.