Package org.jdesktop.beansbinding
Class PropertyStateEvent
- java.lang.Object
-
- java.util.EventObject
-
- org.jdesktop.beansbinding.PropertyStateEvent
-
- All Implemented Interfaces:
Serializable
public class PropertyStateEvent extends EventObject
An event characterizing a change in aProperty'sstate for a particular source object.- Author:
- Shannon Hickey
- See Also:
Property,PropertyStateListener, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ObjectUNREADABLEUsed to indicate that a particular value is unreadable.-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description PropertyStateEvent(Property sourceProperty, Object sourceObject, boolean valueChanged, Object oldValue, Object newValue, boolean writeableChanged, boolean isWriteable)Creates an instance ofPropertyStateEventcharacterizing a change in aProperty'sstate for a particular source object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetNewValue()Returns the new value of thePropertyfor the source object, orUNREADABLEif thePropertyis not currently readable for the source object.ObjectgetOldValue()Returns the old value of thePropertyfor the source object, orUNREADABLEif thePropertywas not previously readable for the source object.booleangetReadableChanged()Returns whether or not theProperty'sreadability has changed for the source object.ObjectgetSource()Returns thePropertywhose state has changed.ObjectgetSourceObject()Returns the source object for which theProperty'sstate has changed.PropertygetSourceProperty()Returns thePropertywhose state has changed.booleangetValueChanged()Returns whether or not theProperty'svalue has changed for the source object.booleangetWriteableChanged()Returns whether or not theProperty'swriteability has changed for the source object.booleanisReadable()Returns whether or not thePropertyis currently readable for the source object.booleanisWriteable()Returns whether or not thePropertyis currently writeable for the source object.StringtoString()Returns a string representation of thePropertyStateEvent.
-
-
-
Field Detail
-
UNREADABLE
public static final Object UNREADABLE
Used to indicate that a particular value is unreadable.
-
-
Constructor Detail
-
PropertyStateEvent
public PropertyStateEvent(Property sourceProperty, Object sourceObject, boolean valueChanged, Object oldValue, Object newValue, boolean writeableChanged, boolean isWriteable)
Creates an instance ofPropertyStateEventcharacterizing a change in aProperty'sstate for a particular source object.Note: To indicate a change in readability, specify
valueChangedastrueand reflect the readability status in theoldValueandnewValuearguments.- Parameters:
sourceProperty- thePropertywhose state has changedsourceObject- the source object for which theProperty'sstate has changedvalueChanged- whether or not theProperty'svalue has changed for the source objectoldValue- the old value of thePropertyfor the source object, orUNREADABLEif thePropertywas not previously readable for the source objectnewValue- the new value of thePropertyfor the source object, orUNREADABLEif thePropertyis not currently readable for the source objectwriteableChanged- whether or not theProperty'swriteability has changed for the source objectisWriteable- whether or not thePropertyis now writeable for the source object- Throws:
IllegalArgumentException- if neither the value or the writeability has changedIllegalArgumentException- ifvalueChangedistrueand botholdValueandnewValueareUNREADABLE
-
-
Method Detail
-
getSource
public final Object getSource()
Returns thePropertywhose state has changed. The preferred way to access this value is via thegetSourceProperty()method.- Overrides:
getSourcein classEventObject- Returns:
- the
Propertywhose state has changed.
-
getSourceProperty
public final Property getSourceProperty()
Returns thePropertywhose state has changed.- Returns:
- the
Propertywhose state has changed.
-
getSourceObject
public final Object getSourceObject()
Returns the source object for which theProperty'sstate has changed.- Returns:
- the source object for which the
Property'sstate has changed
-
getValueChanged
public final boolean getValueChanged()
Returns whether or not theProperty'svalue has changed for the source object.- Returns:
- whether or not the
Property'svalue has changed for the source object.
-
getOldValue
public final Object getOldValue()
Returns the old value of thePropertyfor the source object, orUNREADABLEif thePropertywas not previously readable for the source object.Note: This method must only be called if
getValueChangedreturnstrue.- Returns:
- the old value of the
Propertyfor the source object orUNREADABLE - Throws:
UnsupportedOperationException- if the value hasn't changed
-
getNewValue
public final Object getNewValue()
Returns the new value of thePropertyfor the source object, orUNREADABLEif thePropertyis not currently readable for the source object.Note: This method must only be called if
getValueChangedreturnstrue.- Returns:
- the new value of the
Propertyfor the source object orUNREADABLE - Throws:
UnsupportedOperationException- if the value hasn't changed
-
getReadableChanged
public final boolean getReadableChanged()
Returns whether or not theProperty'sreadability has changed for the source object. In particuler, this returnstrueif the value has changed and either the old value or new value isUNREADABLE, andfalseotherwise.- Returns:
- whether or not the
Property'sreadability has changed for the source object.
-
isReadable
public final boolean isReadable()
Returns whether or not thePropertyis currently readable for the source object. In particular, this returnstrueif and only if the new value is notUNREADABLE.Note: This method must only be called if
getReadableChangedreturnstrue.- Returns:
- whether or not the
Propertyis currently readable for the source object. - Throws:
UnsupportedOperationException- if the readability hasn't changed
-
getWriteableChanged
public final boolean getWriteableChanged()
Returns whether or not theProperty'swriteability has changed for the source object.- Returns:
- whether or not the
Property'swriteability has changed for the source object.
-
isWriteable
public final boolean isWriteable()
Returns whether or not thePropertyis currently writeable for the source object.Note: This method must only be called if
getWriteableChangedreturnstrue.- Returns:
- whether or not the
Propertyis currently writeable for the source object. - Throws:
UnsupportedOperationException- if the writeability hasn't changed
-
toString
public String toString()
Returns a string representation of thePropertyStateEvent. This method is intended to be used for debugging purposes only, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not benull.- Overrides:
toStringin classEventObject- Returns:
- a string representation of this
PropertyStateEvent
-
-