Java Reference
In-Depth Information
Setting phoneNumber on the JavaBeans property
JavaFX property StringProperty [bean: Person@6d311334, name: phoneNumber, value: 800-555-1212]
changed:
oldValue = null, newValue = 800-555-1212
Bind phoneNumberProperty to another property
JavaFX property StringProperty [bean: Person@6d311334, name: phoneNumber, value: 866-555-1212]
changed:
oldValue = 800-555-1212, newValue = 866-555-1212
Setting phoneNumber on the JavaBeans property
A JavaBeans property change is vetoed.
person.getPhoneNumber() = 866-555-1212
Summary
In this chapter, you learned the fundamentals of the JavaFX properties and bindings framework and the JavaFX Beans
specification. You should now understand the following important principles.
JavaFX properties and bindings framework properties and bindings are the fundamental
workhorses of the framework.
They conform to the key interfaces of the framework.
They fire two kinds of events: invalidation event and change event.
All properties and bindings provided by the JavaFX properties and bindings framework
recalculate their values lazily, only when a value is requested. To force them into eager
reevaluation, attach a ChangeListener to them.
New bindings are created out of existing properties and bindings in one of three ways: using
the factory methods of the Bindings utility class, using the fluent interface API, or directly
extending the IntegerBinding series of abstract classes.
The JavaFX Beans specification uses three methods to define a property: the getter, the setter,
and the property getter.
JavaFX Beans properties can be implemented through the eager, half-lazy, and full-lazy
strategies.
Old-style JavaBeans properties can be adapted easily to JavaFX properties.
Resources
Here are some useful resources for understanding properties and bindings:
Martin Fowler's write-up on fluent interface APIs :
http://www.martinfowler.com/bliki/FluentInterface.html
The Properties and Binding tutorial at Oracle's JavaFX.com site :
http://docs.oracle.com/javase/8/javafx/properties-binding-tutorial/
Michael Heinrichs's blog includes entries on JavaFX properties and bindings :
http://blog.netopyr.com/
 
 
Search WWH ::




Custom Search