...
- model: the model object you are binding to.
- modelProperty: the model property you are binding to.
- childrenProperty:Used in TreeViewers to specify the children property of the model object.
- target: the widget you are binding to.
- targetProperty: the widget property you are binding to.
- model2target: a UpdateValueStrategyallowing you to specify validators, converter, etc.
- target2model: a UpdateValueStrategyallowing you to specify validators, converter, etc.
- closure: a simple way to create ComputedValues.
Builder styles
There are (at least) two ways you can write your bindings using the groovy-swt builder:
...
| Code Block |
|---|
text(text:bind(model:viewModel, modelProperty:'text'))
// NOTE: Bind can not find the properties to bind to if they are hidden inside a GString.
label(text:bind {"You have written "+viewModel.text?.size()+ " characters"})
label('Characters left: ')
label(text:bind{(50-viewModel.text?.size()).toString()})
|
You can also use the model2target.converter to create a simple calculated value:
| Code Block |
|---|
button('Remove', enabled: bind(model: peopleViewer, modelProperty:'name', 'model2target.converter': {t1.selectionCount>0})
|
Threads
TODO: Realms, updating models in the realm,