Package it.tidalwave.role.ui
Class BoundProperty<T>
java.lang.Object
it.tidalwave.role.ui.BoundProperty<T>
- All Implemented Interfaces:
Changeable<T>
,ChangingSource<T>
- Author:
- Fabrizio Giudici
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(ChangingSource<T> source) Binds this property to aChangingSource
.get()
Returns the value of this object.static <T> BoundProperty
<T> of
(T value) Creates a newBoundProperty
with the given initial value.void
Sets a new value to this object.void
Removes all the bindings of this object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.tidalwave.role.ui.ChangingSource
addPropertyChangeListener, getPropertyChangeListeners, removePropertyChangeListener
-
Field Details
-
PROP_VALUE
- See Also:
-
-
Constructor Details
-
BoundProperty
public BoundProperty()
-
-
Method Details
-
of
Creates a newBoundProperty
with the given initial value.- Type Parameters:
T
- the type of the property- Parameters:
value
- the initial value- Returns:
- the property
- Since:
- 3.2-ALPHA-2
-
set
Sets a new value to this object. This method fires a property change event associated toPROP_VALUE
.- Specified by:
set
in interfaceChangeable<T>
- Parameters:
value
- the new value
-
get
Returns the value of this object.- Specified by:
get
in interfaceChangingSource<T>
- Returns:
- the value
-
bind
Binds this property to aChangingSource
. Every change in the value of the source will be synchronized to the value of this property. If the source is aChangeable
binding will be bidirectional, that is the object will be set to the current value of this property and will be kept in sync.- Parameters:
source
- the source
-
unbindAll
public void unbindAll()Removes all the bindings of this object.- Specified by:
unbindAll
in interfaceChangingSource<T>
-