org.favabeans.base
Class BeanProperty

java.lang.Object
  |
  +--org.favabeans.base.BeanProperty
All Implemented Interfaces:
Faceted, Feature, Property

public class BeanProperty
extends Object
implements Property, Faceted

A BeanProperty is a Property implementation corresponding directly to a Java Bean property of an object.


Constructor Summary
BeanProperty(Object target, PropertyDescriptor descriptor)
           
BeanProperty(Object target, String propertyName)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void addPropertyChangeListener(String propertyName, PropertyChangeListener l)
           
protected  PropertyEditor createPropertyEditor()
           
protected  void finalize()
           
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
           
protected  void fireStateChanged()
           
protected  void fireValuePropertyChange(Object oldValue, Object newValue)
           
 Facet getFacet(Type type)
          Obtain a Facet of the requested Type for this object.
 String getName()
          Obtain the programmatic name of this property.
 Object getTarget()
          Obtain the target of this Feature.
 Object getValue()
          Obtain the value of the Property.
 Class getValueClass()
          Determine the most general Java class of the objects which are values of this Property.
 boolean isEnabled()
          Determine whether this Property is enabled.
 boolean isValueSettable()
          Determine whether the value of this Property can be set.
 boolean isValueSettable(Object value)
          Check if the given value is an allowable argument to setValue(Object).
 PropertyEditor newEditor()
          Obtain a PropertyEditor instance suitable for editing the value of ths Property object, as in a "property sheet" view.
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void removePropertyChangeListener(String propertyName, PropertyChangeListener l)
           
 void setValue(Object value)
          Set the value of the Property.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanProperty

public BeanProperty(Object target,
                    String propertyName)

BeanProperty

public BeanProperty(Object target,
                    PropertyDescriptor descriptor)
Method Detail

finalize

protected void finalize()
Overrides:
finalize in class Object

getTarget

public Object getTarget()
Description copied from interface: Feature
Obtain the target of this Feature.
Specified by:
getTarget in interface Feature
Following copied from interface: org.favabeans.base.Feature
Returns:
the target.

getFacet

public Facet getFacet(Type type)
Description copied from interface: Faceted
Obtain a Facet of the requested Type for this object.
Specified by:
getFacet in interface Faceted
Following copied from interface: org.favabeans.base.Faceted
Parameters:
type - the Type of Facet requested for this object.
Returns:
a Facet, or null if none can be created as requested.

getName

public String getName()
Description copied from interface: Property
Obtain the programmatic name of this property.
Specified by:
getName in interface Property
Following copied from interface: org.favabeans.base.Property
Returns:
the programmatic name of the property.

getValueClass

public Class getValueClass()
Description copied from interface: Property
Determine the most general Java class of the objects which are values of this Property. As a minimum, this operation should return Object.
Specified by:
getValueClass in interface Property
Following copied from interface: org.favabeans.base.Property
Returns:
the appropriate class.

isEnabled

public boolean isEnabled()
Description copied from interface: Property
Determine whether this Property is enabled. a "disabled" property is one which should be displayed in UI elements, but in a state which indicates that it is non-functional and/or non-applicable (e.g., by "graying out").
Specified by:
isEnabled in interface Property
Following copied from interface: org.favabeans.base.Property
Returns:
true if this Property is enabled; false if it is disabled.

newEditor

public PropertyEditor newEditor()
Description copied from interface: Property
Obtain a PropertyEditor instance suitable for editing the value of ths Property object, as in a "property sheet" view.
Specified by:
newEditor in interface Property
Following copied from interface: org.favabeans.base.Property
Returns:
a suitable PropertyEditor.

getValue

public Object getValue()
Description copied from interface: Property
Obtain the value of the Property.
Specified by:
getValue in interface Property
Following copied from interface: org.favabeans.base.Property
Returns:
the value of the Property.

isValueSettable

public boolean isValueSettable()
Description copied from interface: Property
Determine whether the value of this Property can be set. If this method returns false, calls to setValue will return silently with no effect.
Specified by:
isValueSettable in interface Property
Following copied from interface: org.favabeans.base.Property
Returns:
true if the value can be set; false otherwise.

isValueSettable

public boolean isValueSettable(Object value)
Description copied from interface: Property
Check if the given value is an allowable argument to Property.setValue(Object). This should be overridden to provide end-user feedback regarding the correctness of a property value, where such information is available to the implementation.

The default behavior of this method is to return true, and throw an exception in Property.setValue(Object) if necessary.

Specified by:
isValueSettable in interface Property
Following copied from interface: org.favabeans.base.Property
Parameters:
value - the candidate property value.
Returns:
false if the candidate value is known to be unacceptable; true otherwise.

setValue

public void setValue(Object value)
              throws PropertyValueException
Description copied from interface: Property
Set the value of the Property.
Specified by:
setValue in interface Property
Following copied from interface: org.favabeans.base.Property
Parameters:
value - the desired new value of the Property.
Throws:
PropertyValueException - if there was a problem setting the value, or if the value was not acceptable.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface Property

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface Property

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface Property

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface Property

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)

fireValuePropertyChange

protected void fireValuePropertyChange(Object oldValue,
                                       Object newValue)

fireStateChanged

protected void fireStateChanged()

createPropertyEditor

protected PropertyEditor createPropertyEditor()


Copyright © 2000-2001, Regents of the University of Minnesota. All Rights Reserved.