Java Reference
In-Depth Information
SimpleIntegerProperty object such as intProperty and otherProperty holds an int
value. The value can be manipulated with the get() , set() , getValue() , and setValue()
methods. The get() and set() methods perform their operation with the primitive int type.
The getValue() and setValue() methods use the Integer wrapper type.
You can add and remove
A
InvalidationListener objects to and from intProperty .
ChangeListener objects to and from intProperty .
You can add and remove
Property object such as otherProperty can bind itself to intProperty . When that
happens, otherProperty receives the value of intProperty .
Another
intProperty , whatever object that is attached to it is notified. The
notification is not sent if the object is removed.
When a new value is set on
When notified,
InvalidationListener objects are only informed of which object is sending
out the notification and that object is only known as an Observable .
When notified,
ChangeListener objects are informed on two more pieces of information—the
oldValue and the newValue —in addition to the object sending the notification. The sending
object is known as an ObservableValue .
In the case of a binding property such as
otherProperty , we cannot tell from the output when
or how it is notified of the change of value in intProperty . However, we can infer that it must
have known of the change because when we asked otherProperty for its value we got back
the latest value of intProperty .
even though this motivating example uses an Integer property, similar examples can be made to use
properties based on the Boolean , Long , Float , Double , String , and Object types. in the JavaFX properties and
bindings framework, when interfaces are extended or implemented for concrete types, they are always done for the
Boolean , Integer , Long , Float , Double , String , and Object types.
Note
This example brings to our attention some of the key interfaces and concepts of the JavaFX properties
and bindings framework: including the Observable and the associated InvalidationListener interfaces, the
ObservableValue and the associated ChangeListener interfaces, the get() , set() , getValue() , and setValue()
methods that allow us to manipulate the values of a SimpleIntegerProperty object directly, and the bind() method
that allows us to relinquish direct manipulation of the value of a SimpleIntegerProperty object by subordinating it to
another SimpleIntegerProperty object.
In the next section we show you these and some other key interfaces and concepts of the JavaFX properties and
bindings framework in more detail.
Understanding Key Interfaces and Concepts
Figure 4-1 is a UML diagram showing the key interfaces of the JavaFX properties and bindings framework. It includes
some interfaces that you have seen in the last section, and some that you haven't yet seen.
 
 
Search WWH ::




Custom Search