...
A Xul Binding object consists of four primary and two optional pieces of data and two optional:
- Two XulEventSource objects, one "Source" the other "Target" and a property for each to "Bind" together.
- Optionally, A binding strategy , (one-way, bi-directional , or bind-once).
- Optionally, A Convertor Object to manages manage data translation between the two.
...
There are several methods provided for in the Xul Framework for creating a Binding Object. Some are as simple as calling bind() with four Strings from an Event Handler. We'll not cover all of those here as they're addressed in detail in MVC in Pentaho Xul Applications. Instead, let's have a look from the ground up.
This Below is the most basic representation of a binding.
...
Binding Strategies
By default, a binding object represents a synchronization bi-directionally. Any change to the source will update the target and visa-versa. You can optionally prescribe for a one-way bindings binding between source and target as seen below:
...
Where ONE_WAY is a type defined in Binding.Type enumeration. A one-way binding will send data from the source to the target but not the other way around.
Future versions will introduce the concept of a "bind-once" strategy that will in essence "flash" as a snapshot of data between objects at the time of the bindings binding's instantiation.
Conversions
We can further extend the flexibility of our Bindings bindings by providing a BindingConvertor object to manage the translation of data between objects. The BindingConvertor class itself is so small that it's worth taking a look at right here.
...
Bindings in and of themselves don't actually do anything. They simply describe the Binding relationship between objects. The actual establishing establishment of a binding is performed by a BindingContext object. However, you never have to deal with a BindingContext directly as every XulDomContainer has one. To add a new Binding object to the context, simply pass the Binding binding to the addBinding() method of the XulDomContainer.