|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jdesktop.beansbinding.Binding<SS,SV,TS,TV> org.jdesktop.beansbinding.AutoBinding<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 class AutoBinding<SS,SV,TS,TV>
An implementation of Binding
that automatically syncs the source
and target by refreshing and saving according to one of three update
strategies. The update strategy is specified for an AutoBinding
on creation, and is one of:
AutoBinding.UpdateStrategy.READ_ONCE
AutoBinding.UpdateStrategy.READ
AutoBinding.UpdateStrategy.READ_WRITE
The behavior of AutoBinding
for each
of the update strategies is defined as follows:
READ_ONCE |
Summary: Tries to sync the target from the source only once, at bind time.
Details: |
|
READ |
Summary: Tries to keep the target in sync with the source.
Details: |
|
READ_WRITE |
Summary: Tries to keep both the source and target in sync with each other.
Details:
Automatically responds to changes in the state of the source as follows:
If the change represents a value change, use the try-refresh-then-save
procedure mentioned above. Otherwise, if the change represents the
source becoming writeable, tries to update the source from the target
by calling
Automatically responds to changes in the state of the target as follows:
If the change represents the target simply becoming writeable, try to
sync the target from the source by calling |
Nested Class Summary | |
---|---|
static class |
AutoBinding.UpdateStrategy
An enumeration representing the possible update strategies of an AutoBinding . |
Nested classes/interfaces inherited from class org.jdesktop.beansbinding.Binding |
---|
Binding.SyncFailure, Binding.SyncFailureType, Binding.ValueResult<V> |
Constructor Summary | |
---|---|
protected |
AutoBinding(AutoBinding.UpdateStrategy strategy,
SS sourceObject,
Property<SS,SV> sourceProperty,
TS targetObject,
Property<TS,TV> targetProperty,
java.lang.String name)
Create an instance of AutoBinding between two properties of two objects,
with the given update strategy. |
Method Summary | |
---|---|
protected void |
bindImpl()
Called by Binding.bind() to allow subclasses to initiate binding. |
AutoBinding.UpdateStrategy |
getUpdateStrategy()
Returns the AutoBinding's update strategy. |
protected java.lang.String |
paramString()
Returns a string representing the internal state of the Binding . |
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 |
unbindImpl()
Called by Binding.unbind() to allow subclasses to uninitiate binding. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AutoBinding(AutoBinding.UpdateStrategy strategy, SS sourceObject, Property<SS,SV> sourceProperty, TS targetObject, Property<TS,TV> targetProperty, java.lang.String name)
AutoBinding
between two properties of two objects,
with the given update strategy.
strategy
- the update strategysourceObject
- 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 |
---|
public final AutoBinding.UpdateStrategy getUpdateStrategy()
AutoBinding's
update strategy.
protected void bindImpl()
Binding
Binding.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 Binding.sourceChangedImpl(org.jdesktop.beansbinding.PropertyStateEvent)
and Binding.targetChangedImpl(org.jdesktop.beansbinding.PropertyStateEvent)
when the source and target properties change respectively.
bindImpl
in class Binding<SS,SV,TS,TV>
Binding.unbindImpl()
protected void unbindImpl()
Binding
Binding.unbind()
to allow subclasses to uninitiate binding.
unbindImpl
in class Binding<SS,SV,TS,TV>
Binding.bindImpl()
protected 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
.
paramString
in class Binding<SS,SV,TS,TV>
Binding
.protected void sourceChangedImpl(PropertyStateEvent pse)
Binding
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.
sourceChangedImpl
in class Binding<SS,SV,TS,TV>
protected void targetChangedImpl(PropertyStateEvent pse)
Binding
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.
targetChangedImpl
in class Binding<SS,SV,TS,TV>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |