org.jurvis.swing.form
Class JvAbstractField

java.lang.Object
  extended by org.jurvis.swing.form.JvAbstractField
All Implemented Interfaces:
JvField
Direct Known Subclasses:
JvEnumeratorField, JvPropertyEditorField

public abstract class JvAbstractField
extends Object
implements JvField

This abstract class provides default implementation for many of the methods in the JvField interface.

Author:
Neil W. Weber

Field Summary
protected  JComponent component
          The JComponent displaying the value of this field.
protected  JLabel label
          The JLabel identifying this field on the panel.
protected static org.apache.commons.logging.Log log
          Log specific to this class.
 
Constructor Summary
protected JvAbstractField(JLabel label, JComponent component)
          Construct a new JvAbstractField.
 
Method Summary
 String getAsText()
          Gets the property value as text.
 JComponent getComponent()
          Gets the component used to implement this field.
 JLabel getLabel()
          Gets the label used for this field.
 String getMessage(String key)
          Gets the error message related to this field.
 String getName()
          Return the name of this field.
 JComponent getWrapper()
          Gets the component used to wrap the component implementing this field.
 boolean isEditable()
          Returns the boolean indicating whether this Field is editable or not.
 boolean isEnabled()
          Determines whether this field is enabled.
 void setEditable(boolean editable)
          Sets the specified boolean to indicate whether or not this Field should be editable.
 void setEnabled(boolean enabled)
          Sets whether or not this Field is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jurvis.swing.form.JvField
getValue, setValue
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
Log specific to this class.


component

protected JComponent component
The JComponent displaying the value of this field.


label

protected JLabel label
The JLabel identifying this field on the panel.

Constructor Detail

JvAbstractField

protected JvAbstractField(JLabel label,
                          JComponent component)
Construct a new JvAbstractField.

Parameters:
label - the JLabel used to identify this field
component - the component displaying the value of this field
Method Detail

getName

public String getName()
Return the name of this field.

Specified by:
getName in interface JvField
Returns:
the field's name

isEnabled

public boolean isEnabled()
Determines whether this field is enabled.

Specified by:
isEnabled in interface JvField
Returns:
true if the field is enabled; false otherwise
See Also:
JvField.setEnabled(boolean)

setEnabled

public void setEnabled(boolean enabled)
Sets whether or not this Field is enabled. A field that is enabled may respond to user input, while a field that is not enabled cannot respond to user input. Some fields may alter their visual representation when they are disabled in order to provide feedback to the user that they cannot take input.

Specified by:
setEnabled in interface JvField
Parameters:
enabled - the boolean to be set

isEditable

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

Specified by:
isEditable in interface JvField
Returns:
false

setEditable

public void setEditable(boolean editable)
Sets the specified boolean to indicate whether or not this Field should be editable.

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

getLabel

public JLabel getLabel()
Gets the label used for this field.

Specified by:
getLabel in interface JvField
Returns:
the field's label

getAsText

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

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

getComponent

public JComponent getComponent()
Gets the component used to implement this field.

Specified by:
getComponent in interface JvField
Returns:
the component implementing this field

getWrapper

public JComponent getWrapper()
Gets the component used to wrap the component implementing this field. For example, a JScrollPane. If no wrapping component is needed, this method returns the component.

Specified by:
getWrapper in interface JvField
Returns:
the wrapper component

getMessage

public String getMessage(String key)
Gets the error message related to this field.

Parameters:
key - the key of the desired error message
Returns:
key the key of the desired error message


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