|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.beansbinding.Binding<SS,SV,TS,TV>
SS - the type of source objectSV - the type of value that the source property representsTS - the type of target objectTV - the type of value that the target property representspublic abstract class Binding<SS,SV,TS,TV>
Binding is an abstract class that represents the concept of a
binding between two properties, typically of two objects, and contains
methods for explicitly syncing the values of the two properties. Binding
itself does no automatic syncing between property values. Subclasses
will typically keep the values in sync according to some strategy.
Some Bindings are managed, often by another Binding.
A managed Binding does not allow certain methods to be called by
the user. These methods are identified in their documentation.
Subclasses should call setManaged(true) to make themselves managed.
Binding provides protected versions of the managed methods with the
suffix "Unmanaged" for subclasses to use internally without
checking whether or not they are managed.
Any PropertyResolutionExceptions thrown by Property
objects used by this binding are allowed to flow through to the caller
of the Binding methods.
| Nested Class Summary | |
|---|---|
static class |
Binding.SyncFailure
SyncFailure represents a failure to sync (save or refresh) a
Binding. |
static class |
Binding.SyncFailureType
An enumeration representing the reasons a sync ( save or refresh)
can fail on a Binding. |
static class |
Binding.ValueResult<V>
Encapsulates the result from calling getSourceValueForTarget() or
getTargetValueForSource(), which
can either be a successful value or a failure. |
| Constructor Summary | |
|---|---|
protected |
Binding(SS sourceObject,
Property<SS,SV> sourceProperty,
TS targetObject,
Property<TS,TV> targetProperty,
java.lang.String name)
Create an instance of Binding between two properties of two objects. |
| Method Summary | |
|---|---|
void |
addBindingListener(BindingListener listener)
Adds a BindingListener to be notified of changes to this Binding. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to be notified when any property of
this Binding changes. |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to be notified when the property identified
by the propertyName argument changes on this Binding. |
void |
bind()
Binds this binding. |
protected abstract void |
bindImpl()
Called by bind() to allow subclasses to initiate binding. |
protected void |
bindUnmanaged()
A protected version of bind() that allows managed
subclasses to bind without throwing an exception
for being managed. |
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Sends a PropertyChangeEvent to the PropertyChangeListeners
registered on the Binding. |
BindingListener[] |
getBindingListeners()
Returns the list of BindingListeners registered on this
Binding. |
Converter<SV,TV> |
getConverter()
Returns the Binding's Converter, which may be null. |
java.lang.String |
getName()
Returns the Binding's name, which may be null. |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners()
Returns the list of PropertyChangeListeners registered on this
Binding. |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners(java.lang.String propertyName)
Returns the list of PropertyChangeListeners registered on this
Binding for the given property name. |
TV |
getSourceNullValue()
Returns the value to be returned by getSourceValueForTarget()
when the source property returns null for the source object. |
SS |
getSourceObject()
Returns the Binding's source object, which may be null. |
Property<SS,SV> |
getSourceProperty()
Returns the Binding's source property, which may not be null. |
TV |
getSourceUnreadableValue()
If set, returns the value to be returned by getSourceValueForTarget()
when the source property is unreadable for the source object. |
Binding.ValueResult<TV> |
getSourceValueForTarget()
Fetches the value of the source property for the source object and returns a ValueResult representing that value in terms that
can be set on the target property for the target object. |
SV |
getTargetNullValue()
Returns the value to be returned by getTargetValueForSource()
when the target property returns null for the target object. |
TS |
getTargetObject()
Returns the Binding's target object, which may be null. |
Property<TS,TV> |
getTargetProperty()
Returns the Binding's target property, which may not be null. |
Binding.ValueResult<SV> |
getTargetValueForSource()
Fetches the value of the target property for the target object and returns a ValueResult representing that value in terms that
can be set on the source property for the source object. |
Validator<? super SV> |
getValidator()
Returns the Binding's Validator, which may be null. |
boolean |
isBound()
Returns whether or not this Binding is bound. |
boolean |
isManaged()
Returns whether or not this Binding is managed. |
boolean |
isSourceUnreadableValueSet()
Returns the value of the sourceUnreadableValueSet property,
which indicates whether or not the sourceUnreadableValue property
is set on the Binding. |
protected void |
notifySynced()
Notifies all registered BindingListeners of a successful
sync (refresh or save), by calling synced
on each one. |
protected void |
notifySyncFailed(Binding.SyncFailure failure)
Notifies all registered BindingListeners of a failure to
sync (refresh or save), by calling
syncFailed on each one. |
protected java.lang.String |
paramString()
Returns a string representing the internal state of the Binding. |
Binding.SyncFailure |
refresh()
Fetches the value of the source property for the source object and sets it as the value of the target property for the target object. |
Binding.SyncFailure |
refreshAndNotify()
The same as refresh() with the additional
behavior of notifying all registered BindingListeners
with synced if refresh returns null
or syncFailed if refresh returns a
SyncFailure. |
protected Binding.SyncFailure |
refreshAndNotifyUnmanaged()
A protected version of refreshAndNotify() that allows managed
subclasses to refresh and notify without throwing an exception
for being managed. |
protected Binding.SyncFailure |
refreshUnmanaged()
A protected version of refresh() that allows managed
subclasses to refresh without throwing an exception
for being managed. |
void |
removeBindingListener(BindingListener listener)
Removes a BindingListener from the Binding. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the Binding. |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the Binding for the given
property name. |
Binding.SyncFailure |
save()
Fetches the value of the target property for the target object and sets it as the value of the source property for the source object. |
Binding.SyncFailure |
saveAndNotify()
The same as save() with the additional
behavior of notifying all registered BindingListeners
with synced if save returns null
or syncFailed if save returns a
SyncFailure. |
protected Binding.SyncFailure |
saveAndNotifyUnmanaged()
A protected version of saveAndNotify() that allows managed
subclasses to save and notify without throwing an exception
for being managed. |
protected Binding.SyncFailure |
saveUnmanaged()
A protected version of save() that allows managed
subclasses to save without throwing an exception
for being managed. |
void |
setConverter(Converter<SV,TV> converter)
Sets the Converter for the Binding, which may be null. |
protected void |
setManaged(boolean isManaged)
Sets whether or not this Binding is managed. |
void |
setSourceNullValue(TV sourceNullValue)
Sets the value to be returned by getSourceValueForTarget()
when the source property returns null for the source object. |
void |
setSourceObject(SS sourceObject)
Sets the Binding's source object, which may be null. |
protected void |
setSourceObjectUnmanaged(SS sourceObject)
A protected version of setSourceObject(SS) that allows managed
subclasses to set the source object without throwing an exception
for being managed. |
protected void |
setSourceProperty(Property<SS,SV> sourceProperty)
Sets the Binding's source property. |
void |
setSourceUnreadableValue(TV sourceUnreadableValue)
Sets the value to be returned by getSourceValueForTarget()
when the source property is unreadable for the source object. |
void |
setTargetNullValue(SV targetNullValue)
Sets the value to be returned by getTargetValueForSource()
when the target property returns null for the target object. |
void |
setTargetObject(TS targetObject)
Sets the Binding's target object, which may be null. |
protected void |
setTargetObjectUnmanaged(TS targetObject)
A protected version of setTargetObject(TS) that allows managed
subclasses to set the target object without throwing an exception
for being managed. |
protected void |
setTargetProperty(Property<TS,TV> targetProperty)
Sets the Binding's target property. |
void |
setValidator(Validator<? super SV> validator)
Sets the Validator for the Binding, which may be null. |
protected void |
sourceChangedImpl(PropertyStateEvent pse)
Called to indicate that the source property has fired a PropertyStateEvent to indicate that its state has changed for
the source object. |
protected void |
targetChangedImpl(PropertyStateEvent pse)
Called to indicate that the target property has fired a PropertyStateEvent to indicate that its state has changed for
the target object. |
protected void |
throwIfBound()
Throws an IllegalStateException if the Binding is bound. |
protected void |
throwIfManaged()
Throws an UnsupportedOperationException if the Binding is managed. |
protected void |
throwIfUnbound()
Throws an IllegalStateException if the Binding is unbound. |
java.lang.String |
toString()
Returns a string representation of the Binding. |
void |
unbind()
Unbinds this binding. |
protected abstract void |
unbindImpl()
Called by unbind() to allow subclasses to uninitiate binding. |
protected void |
unbindUnmanaged()
A protected version of unbind() that allows managed
subclasses to unbind without throwing an exception
for being managed. |
void |
unsetSourceUnreadableValue()
Unsets the value of the sourceUnreadableValue property by clearing
the value and setting the value of the sourceUnreadableValueSet
property to false. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Binding(SS sourceObject,
Property<SS,SV> sourceProperty,
TS targetObject,
Property<TS,TV> targetProperty,
java.lang.String name)
Binding between two properties of two objects.
sourceObject - the source objectsourceProperty - a property on the source objecttargetObject - the target objecttargetProperty - a property on the target objectname - a name for the Binding
java.lang.IllegalArgumentException - if the source property or target property is null| Method Detail |
|---|
protected final void setSourceProperty(Property<SS,SV> sourceProperty)
Binding's source property.
Binding fires a property change notification with
property name "sourceProperty" when the value of
this property changes.
This method may not be called on a bound binding.
sourceProperty - the source property
java.lang.IllegalArgumentException - if the source property is null
java.lang.IllegalStateException - if the Binding is boundisBound()protected final void setTargetProperty(Property<TS,TV> targetProperty)
Binding's target property.
Binding fires a property change notification with
property name "targetProperty" when the value of
this property changes.
This method may not be called on a bound binding.
targetProperty - the target property
java.lang.IllegalArgumentException - if the target property is null
java.lang.IllegalStateException - if the Binding is boundisBound()public final java.lang.String getName()
Binding's name, which may be null.
Binding's name, or nullpublic final Property<SS,SV> getSourceProperty()
Binding's source property, which may not be null.
Binding's source property, non-nullsetSourceProperty(org.jdesktop.beansbinding.Property) public final Property<TS,TV> getTargetProperty()
Binding's target property, which may not be null.
Binding's target property, non-nullsetTargetProperty(org.jdesktop.beansbinding.Property) public final SS getSourceObject()
Binding's source object, which may be null.
Binding's source object, or nullsetSourceObject(SS)public final TS getTargetObject()
Binding's target object, which may be null.
Binding's target object, or nullsetTargetObject(TS)public final void setSourceObject(SS sourceObject)
Binding's source object, which may be null.
Binding fires a property change notification with
property name "sourceObject" when the value of
this property changes.
This method may not be called on a managed or bound binding.
sourceObject - the source object, or null
java.lang.UnsupportedOperationException - if the Binding is managed
java.lang.IllegalStateException - if the Binding is boundisManaged(),
isBound()protected final void setSourceObjectUnmanaged(SS sourceObject)
setSourceObject(SS) that allows managed
subclasses to set the source object without throwing an exception
for being managed.
sourceObject - the source object, or null
java.lang.IllegalStateException - if the Binding is boundisManaged(),
isBound()public final void setTargetObject(TS targetObject)
Binding's target object, which may be null.
Binding fires a property change notification with
property name "targetObject" when the value of
this property changes.
This method may not be called on a managed or bound binding.
targetObject - the target object, or null
java.lang.UnsupportedOperationException - if the Binding is managed
java.lang.IllegalStateException - if the Binding is boundisManaged(),
isBound()protected final void setTargetObjectUnmanaged(TS targetObject)
setTargetObject(TS) that allows managed
subclasses to set the target object without throwing an exception
for being managed.
targetObject - the target object, or null
java.lang.IllegalStateException - if the Binding is boundisManaged(),
isBound()public final void setValidator(Validator<? super SV> validator)
Validator for the Binding, which may be null.
Binding fires a property change notification with
property name "validator" when the value of
this property changes.
This method may not be called on a bound binding.
See the documentation on getTargetValueForSource() for details on how
a Binding's Validator is used.
validator - the Validator, or null
java.lang.IllegalStateException - if the Binding is boundisBound()public final Validator<? super SV> getValidator()
Binding's Validator, which may be null.
Binding's Validator, or nullsetValidator(org.jdesktop.beansbinding.Validator super SV>)public final void setConverter(Converter<SV,TV> converter)
Converter for the Binding, which may be null.
Binding fires a property change notification with
property name "converter" when the value of
this property changes.
This method may not be called on a bound binding.
See the documentation on getTargetValueForSource() and
getSourceValueForTarget() for details on how
a Binding's Converter is used.
converter - the Converter, or null
java.lang.IllegalStateException - if the Binding is boundisBound()public final Converter<SV,TV> getConverter()
Binding's Converter, which may be null.
Binding's Converter, or nullsetConverter(org.jdesktop.beansbinding.Converter) public final void setSourceNullValue(TV sourceNullValue)
getSourceValueForTarget()
when the source property returns null for the source object.
The default for this property is null.
Binding fires a property change notification with
property name "sourceNullValue" when the value of
this property changes.
This method may not be called on a bound binding.
sourceNullValue - the value, or null
java.lang.IllegalStateException - if the Binding is boundpublic final TV getSourceNullValue()
getSourceValueForTarget()
when the source property returns null for the source object.
The default for this property is null.
null, or null
if there is no replacementsetSourceNullValue(TV)public final void setTargetNullValue(SV targetNullValue)
getTargetValueForSource()
when the target property returns null for the target object.
The default for this property is null.
Binding fires a property change notification with
property name "targetNullValue" when the value of
this property changes.
This method may not be called on a bound binding.
targetNullValue - the value, or null
java.lang.IllegalStateException - if the Binding is boundpublic final SV getTargetNullValue()
getTargetValueForSource()
when the target property returns null for the target object.
The default for this property is null.
null, or null
if there is no replacementsetTargetNullValue(SV)public final void setSourceUnreadableValue(TV sourceUnreadableValue)
getSourceValueForTarget()
when the source property is unreadable for the source object.
Calling this method stores the given value and indicates that
getSourceValueForTarget should use it, by setting the
sourceUnreadableValueSet property to true.
By default, the sourceUnreadableValue property is unset,
indicated by the sourceUnreadableValueSet property being
false.
Setting this property to null acts the same as setting it to
any other value. To return the property to the unset state (clearing
the value and setting sourceUnreadableValueSet back to
false) call unsetSourceUnreadableValue().
If this property was previously unset, this method fires a property
change notification with property name "sourceUnreadableValueSet".
For all invocations, it also fires a property change notification with
property name "sourceUnreadableValue", if necessary, to indicate
a change in the property value. If previously unset, the event will
indicate an old value of null.
This method may not be called on a bound binding.
sourceUnreadableValue - the value, which may be null
java.lang.IllegalStateException - if the Binding is boundisSourceUnreadableValueSet(),
getSourceUnreadableValue()public final void unsetSourceUnreadableValue()
sourceUnreadableValue property by clearing
the value and setting the value of the sourceUnreadableValueSet
property to false.
If the property was previously set, fires a property change notification
with property name "sourceUnreadableValueSet", and a property
change notification with property name "sourceUnreadableValue".
The event for the latter notification will have a new value of null.
See the documentation for setSourceUnreadableValue(TV) for more
information on the sourceUnreadableValue property.
This method may not be called on a bound binding.
java.lang.IllegalStateException - if the Binding is boundisSourceUnreadableValueSet(),
getSourceUnreadableValue()public final boolean isSourceUnreadableValueSet()
sourceUnreadableValueSet property,
which indicates whether or not the sourceUnreadableValue property
is set on the Binding.
See the documentation for setSourceUnreadableValue(TV) for more
information on the sourceUnreadableValue property.
sourceUnreadableValue property
is set on the BindingunsetSourceUnreadableValue(),
getSourceUnreadableValue()public final TV getSourceUnreadableValue()
getSourceValueForTarget()
when the source property is unreadable for the source object. Throws
UnsupportedOperationException if the property is not set,
as indicated by isSourceUnreadableValueSet().
See the documentation for setSourceUnreadableValue(TV) for more
information on this property.
null
java.lang.UnsupportedOperationException - if the property is not set,
as indicated by isSourceUnreadableValueSetunsetSourceUnreadableValue()public final void addBindingListener(BindingListener listener)
BindingListener to be notified of changes to this Binding.
Does nothing if the listener is null. If a listener is added more than once,
notifications are sent to that listener once for every time that it has
been added. The ordering of listener notification is unspecified.
listener - the listener to addpublic final void removeBindingListener(BindingListener listener)
BindingListener from the Binding. Does
nothing if the listener is null or is not one of those registered.
If the listener being removed was registered more than once, only one
occurrence of the listener is removed from the list of listeners.
The ordering of listener notification is unspecified.
listener - the listener to removeaddBindingListener(org.jdesktop.beansbinding.BindingListener)public final BindingListener[] getBindingListeners()
BindingListeners registered on this
Binding. Order is undefined. Returns an empty array if there are
no listeners.
BindingListeners registered on this BindingaddBindingListener(org.jdesktop.beansbinding.BindingListener)public final Binding.ValueResult<TV> getSourceValueForTarget()
ValueResult representing that value in terms that
can be set on the target property for the target object.
First, if the target property is not writeable for the target object,
a ValueResult is returned representing a failure
with failure type SyncFailureType.TARGET_UNWRITEABLE.
Then, if the source property is unreadable for the source object,
the value of isSourceUnreadableValueSet() is checked. If true
then a ValueResult is returned containing the value of the
Binding's getSourceUnreadableValue(). Otherwise a
ValueResult is returned representing a failure with failure
type SyncFailureType.SOURCE_UNREADABLE.
Next, the value of the source property is fetched for the source
object. If the value is null, a ValueResult is
returned containing the value of the Binding's
getSourceNullValue(). If the value is non-null,
the Binding's Converter, if any, is run to convert
the value from source type to the target property's
getWriteType, by calling its convertForward
method with the value. If no Converter is registered,
a set of default converters is checked to see if one of them
can convert the value to the target type. Finally, the value
(converted or not) is cast to the target write type.
This final value is returned in a ValueResult.
Any RuntimeException or ClassCastException thrown by a
converter or the final cast is propogated up to the caller of this method.
ValueResult as described above
java.lang.RuntimeException - if thrown by any of the converters
java.lang.ClassCastException - if thrown by a converter or the final castpublic final Binding.ValueResult<SV> getTargetValueForSource()
ValueResult representing that value in terms that
can be set on the source property for the source object.
First, if the source property is not writeable for the source object,
a ValueResult is returned representing a failure
with failure type SyncFailureType.SOURCE_UNWRITEABLE.
Then, if the target property is not readable for the target object,
a ValueResult is returned representing a failure
with failure type SyncFailureType.TARGET_UNREADABLE.
Next, the value of the target property is fetched for the target
object. If the value is null, a ValueResult is
returned containing the value of the Binding's
getTargetNullValue(). If the value is non-null,
the Binding's Converter, if any, is run to convert
the value from target type to the source property's
getWriteType, by calling its convertReverse
method with the value. If no Converter is registered,
a set of default converters is checked to see if one of them
can convert the value to the source type. Finally, the value
(converted or not) is cast to the source write type.
If a converter throws a RuntimeException other than
ClassCastException, this method returns a
ValueResult containing the failure, with failure type
SyncFailureType.CONVERSION_FAILURE.
As the last step, the Binding's Validator, if any, is called
upon to validate the final value. If the Validator
returns non-null from its validate method,
a ValueResult is returned containing the validation
result, with failure type SyncFailureType.VALIDATION_FAILURE.
Otherwise a ValueResult is returned containing the
final validated value.
Any ClassCastException thrown by a converter or the final
cast is propogated up to the caller of this method.
ValueResult as described above
java.lang.ClassCastException - if thrown by a converter or the final castpublic final void bind()
bindImpl() to allow subclasses
to initiate binding, adds a PropertyStateListener to the source
property for the source object and the target property for the target
object to start tracking changes, notifies all registered
BindingListeners that the binding has become bound, and
fires a property change notification to indicate a change to the
"bound" property.
java.lang.UnsupportedOperationException - if the Binding is managed
java.lang.IllegalStateException - if the Binding is already boundisBound(),
isManaged(),
unbind()protected final void bindUnmanaged()
bind() that allows managed
subclasses to bind without throwing an exception
for being managed.
java.lang.IllegalStateException - if the Binding is boundisManaged(),
isBound()protected abstract void bindImpl()
bind() to allow subclasses to initiate binding.
Subclasses typically need not install PropertyStateListeners
on the source property and target property as they will be notified
by calls to sourceChangedImpl(org.jdesktop.beansbinding.PropertyStateEvent) and targetChangedImpl(org.jdesktop.beansbinding.PropertyStateEvent)
when the source and target properties change respectively.
unbindImpl()public final void unbind()
PropertyStateListeners
added by bind, calls unbindImpl() to allow subclasses
to uninitiate binding, notifies all registered BindingListeners
that the binding has become unbound, and fires a property change
notification to indicate a change to the "bound" property.
java.lang.UnsupportedOperationException - if the Binding is managed
java.lang.IllegalStateException - if the Binding is not boundisBound(),
isManaged(),
bind()protected final void unbindUnmanaged()
unbind() that allows managed
subclasses to unbind without throwing an exception
for being managed.
java.lang.IllegalStateException - if the Binding is not boundisManaged(),
isBound()protected abstract void unbindImpl()
unbind() to allow subclasses to uninitiate binding.
bindImpl()public final boolean isBound()
Binding is bound.
Binding fires a property change notification with
property name "bound" when the value of
this property changes.
Binding is boundbind(),
unbind()protected final void setManaged(boolean isManaged)
Binding is managed. Some
Bindings are managed, often by another Binding.
A managed Binding does not allow certain methods to be called by
the user. These methods are identified in their documentation.
Subclasses should call setManaged(true) to make themselves managed.
Binding provides protected versions of the managed methods, with the
suffix "Unmanaged", for subclasses to use internally without
checking whether or not they are managed.
public final boolean isManaged()
Binding is managed. Some
Bindings are managed, often by another Binding.
A managed Binding does not allow certain methods to be called by
the user. These methods are identified in their documentation.
Subclasses should call setManaged(true) to make themselves managed.
Binding provides protected versions of the managed methods, with the
suffix "Unmanaged", for subclasses to use internally without
checking whether or not they are managed.
Binding is managedsetManaged(boolean)protected final void notifySynced()
BindingListeners of a successful
sync (refresh or save), by calling synced
on each one.
protected final void notifySyncFailed(Binding.SyncFailure failure)
BindingListeners of a failure to
sync (refresh or save), by calling
syncFailed on each one.
failure - the reason that the sync failedpublic final Binding.SyncFailure refreshAndNotify()
refresh() with the additional
behavior of notifying all registered BindingListeners
with synced if refresh returns null
or syncFailed if refresh returns a
SyncFailure.
refresh
java.lang.UnsupportedOperationException - if the Binding is managed
java.lang.RuntimeException - as specified by refresh()
java.lang.ClassCastException - as specified by refresh()isManaged()protected final Binding.SyncFailure refreshAndNotifyUnmanaged()
refreshAndNotify() that allows managed
subclasses to refresh and notify without throwing an exception
for being managed.
refresh
java.lang.RuntimeException - as specified by refresh()
java.lang.ClassCastException - as specified by refresh()isManaged()public final Binding.SyncFailure saveAndNotify()
save() with the additional
behavior of notifying all registered BindingListeners
with synced if save returns null
or syncFailed if save returns a
SyncFailure.
save
java.lang.UnsupportedOperationException - if the Binding is managed
java.lang.ClassCastException - as specified by refresh()isManaged()protected final Binding.SyncFailure saveAndNotifyUnmanaged()
saveAndNotify() that allows managed
subclasses to save and notify without throwing an exception
for being managed.
save
java.lang.ClassCastException - as specified by save()isManaged()public final Binding.SyncFailure refresh()
getSourceValueForTarget(). If the return value
from that method represents a failure, this method returns the failure.
Otherwise, it calls setValue on the target property for the
target object with the value obtained from the source.
null for success
java.lang.UnsupportedOperationException - if the Binding is managed
java.lang.RuntimeException - if thrown by getSourceValueForTarget()
java.lang.ClassCastException - if thrown by getSourceValueForTarget()isManaged(),
save()protected final Binding.SyncFailure refreshUnmanaged()
refresh() that allows managed
subclasses to refresh without throwing an exception
for being managed.
null for success
java.lang.RuntimeException - if thrown by getSourceValueForTarget()
java.lang.ClassCastException - if thrown by getSourceValueForTarget()isManaged()public final Binding.SyncFailure save()
getTargetValueForSource(). If the return value
from that method represents a failure, this method returns the failure.
Otherwise, it calls setValue on the source property for the
source object with the value obtained from the target.
null for success
java.lang.UnsupportedOperationException - if the Binding is managed
java.lang.ClassCastException - if thrown by getTargetValueForSource()isManaged(),
refresh()protected final Binding.SyncFailure saveUnmanaged()
save() that allows managed
subclasses to save without throwing an exception
for being managed.
null for success
java.lang.ClassCastException - if thrown by getTargetValueForSource()isManaged()protected final void throwIfManaged()
Binding is managed.
Useful for calling at the beginning of method implementations that
shouldn't be called on managed Bindings
java.lang.UnsupportedOperationException - if the Binding is managedisManaged()protected final void throwIfBound()
Binding is bound.
Useful for calling at the beginning of method implementations that
shouldn't be called when the Binding is bound.
java.lang.IllegalStateException - if the Binding is bound.protected final void throwIfUnbound()
Binding is unbound.
Useful for calling at the beginning of method implementations that should
only be called when the Binding is bound.
java.lang.IllegalStateException - if the Binding is unbound.public java.lang.String toString()
Binding. 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
be null.
toString in class java.lang.ObjectBindingprotected java.lang.String paramString()
Binding.
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
be null.
Binding.protected void sourceChangedImpl(PropertyStateEvent pse)
PropertyStateEvent to indicate that its state has changed for
the source object. Called after the Binding has notified
any property change listeners and BindingListeners that
the source value has been edited (only if the PropertyStateEvent
represents a value change). This method is useful for subclasses
to detect source changes and perform syncing as appropriate.
protected void targetChangedImpl(PropertyStateEvent pse)
PropertyStateEvent to indicate that its state has changed for
the target object. Called after the Binding has notified
any property change listeners and BindingListeners that
the target value has been edited (only if the PropertyStateEvent
represents a value change). This method is useful for subclasses
to detect target changes and perform syncing as appropriate.
public final void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener to be notified when any property of
this Binding changes. Does nothing if the listener is
null. If a listener is added more than once, notifications are
sent to that listener once for every time that it has been added.
The ordering of listener notification is unspecified.
Binding fires property change notification for the following
properties:
sourceProperty
targetProperty
sourceObject
targetObject
validator
converter
sourceNullValue
targetNullValue
sourceUnreadableValueSet
sourceUnreadableValue
bound
For other types of Binding notifications register a
BindingListener.
listener - the listener to addaddBindingListener(org.jdesktop.beansbinding.BindingListener)
public final void addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
PropertyChangeListener to be notified when the property identified
by the propertyName argument changes on this Binding.
Does nothing if the property name or listener is null.
If a listener is added more than once, notifications are
sent to that listener once for every time that it has been added.
The ordering of listener notification is unspecified.
Binding fires property change notification for the following
properties:
sourceProperty
targetProperty
sourceObject
targetObject
validator
converter
sourceNullValue
targetNullValue
sourceUnreadableValueSet
sourceUnreadableValue
bound
For other types of Binding notifications register a
BindingListener.
propertyName - the name of the property to listen for changes onlistener - the listener to addpublic final void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener from the Binding. Does
nothing if the listener is null or is not one of those registered.
If the listener being removed was registered more than once, only one
occurrence of the listener is removed from the list of listeners.
The ordering of listener notification is unspecified.
listener - the listener to removeaddPropertyChangeListener(java.beans.PropertyChangeListener)
public final void removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
PropertyChangeListener from the Binding for the given
property name. Does nothing if the property name or listener is
null or the listener is not one of those registered.
If the listener being removed was registered more than once, only one
occurrence of the listener is removed from the list of listeners.
The ordering of listener notification is unspecified.
propertyName - the name of the property to remove the listener forlistener - the listener to removeaddPropertyChangeListener(String, PropertyChangeListener)public final java.beans.PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListeners registered on this
Binding. Order is undefined. Returns an empty array if there are
no listeners.
PropertyChangeListeners registered on this BindingaddPropertyChangeListener(java.beans.PropertyChangeListener)public final java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
PropertyChangeListeners registered on this
Binding for the given property name. Order is undefined. Returns an empty array
if there are no listeners registered for the property name.
propertyName - the property name to retrieve the listeners for
PropertyChangeListeners registered on this Binding
for the given property nameaddPropertyChangeListener(String, PropertyChangeListener)
protected final void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
PropertyChangeEvent to the PropertyChangeListeners
registered on the Binding.
propertyName - the name of the property that's changedoldValue - the old value of the propertynewValue - the new value of the property
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||