java.beans
Class PropertyEditorSupport
java.lang.Object
|
+--java.beans.PropertyEditorSupport
All Implemented Interfaces:
PropertyEditor
PropertyEditorSupport helps with PropertyEditors,
implementing base functionality that they usually must
have but which is a pain to implement. You may extend
from this class or use it as a standalone.
This class does not do any painting or actual editing.
For that, you must use or extend it. See the
PropertyEditor class for better descriptions of what
the various methods do.
Since:Author:PropertyEditorSupport
protected PropertyEditorSupport()
Call this constructor when you are deriving from
PropertyEditorSupport.
PropertyEditorSupport
protected PropertyEditorSupport(java.lang.Object eventSource)
Call this constructor when you are using
PropertyEditorSupport as a helper object.
Parameters:
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a property change listener to this property editor.
Parameters:
firePropertyChange
public void firePropertyChange()
Notify people that we've changed, although we don't
tell them just how. The only thing I can think of to
send in the event is the new value (since the old value
is unavailable and there is no property name).
I confess I do not understand the point of this method.
getAsText
public String getAsText()
Get the value as text.
In this class, you cannot count on getAsText() doing
anything useful, although in this implementation I
do toString().
Returns:
getCustomEditor
public Component getCustomEditor()
Return a custom component to edit the value.
Returns:
getJavaInitializationString
public String getJavaInitializationString()
Get the Java initialization String for the current
value of the Object. This class returns gibberish or
null (though the spec does not say which).
Implementation Note: This class
returns the string "@$#^" to make sure the code will
be broken, so that you will know to override it when
you create your own property editor.
Returns:
- the Java initialization string.
getTags
public String[] getTags()
Returns a list of possible choices for the value.
Returns:
getValue
public Object getValue()
Get the current value of the property.
Returns:
- the current value of the property.
isPaintable
public boolean isPaintable()
Get whether this object is paintable or not.
Returns:
paintValue
public void paintValue(java.awt.Graphics g, java.awt.Rectangle r)
Paint this object. This class does nothing in
this method.
Parameters:
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a property change listener from this property editor.
Parameters:
setAsText
public void setAsText(java.lang.String s)
Set the value as text.
In this class, you cannot count on setAsText() doing
anything useful across implementations.
Implementation Note: In this
implementation it checks if the String is "null", and
if it is, sets the value to null, otherwise it throws
an IllegalArgumentException.
Parameters:
Throws:
setValue
public void setValue(java.lang.Object val)
Set the current value of the property.
Implementation Note Sun does not
state what exactly this version of the method does.
Thus, in this implementation, it sets the value, and
then if the old and new values are different, it
fires a property change event with no property name
and the old and new values.
Parameters:
supportsCustomEditor
public boolean supportsCustomEditor()
Find out whether this property editor supports a
custom component to edit its value.
Returns:
This class does not do any painting or actual editing. For that, you must use or extend it. See the PropertyEditor class for better descriptions of what the various methods do.