Data Binding
From Documentation
In the following sections, we'll cover ZK Bind's annotations used on a ZUL. They are all used in component's attribute and have general format described in Annotate in ZUML:
@AnnotationName(attr-name1=attr-value1, attr-name2=attr-value2)
@AnnotationName(attr-name1={attr-value1-1, attr-value1-2}, attr-name2=attr-value2)
Basically, the syntax consists of an annotation name with comma-separated key-value pairs. The binder treats an annotation's attribute value as an EL expression, and sets an EL expression without a attribute name to default attribute name "value". All annotations must define default attribute's value.
- @[AnnotationName]( [EvaluateOnce EL-expression] )
- [AnnotationName]
- It could be one of [ id | init ]
- [EvaluateOnce EL-expression]
- The EL expression will only be evaluated once when parsing.
- When using with @id, we strongly suggest you to use string literal to give ViewModel's id.
- @[AnnotationName]( [EL-expression] )
- [AnnotationName]
- It could be one of [ bind | template | ref ]
- [EL-expression]
- It could be any ZK allowed EL expression (an internal link to EL) without ${ } enclosed.
- @[AnnotationName]( [EL-expression], [conditionKeyword]=[EvaluateOnce EL-expression] )
- [AnnotationName]
- It could be one of [ load | save ]
- [conditionKeyword]=[EvaluateOnce EL-expression]
- This expression is optional unless you want to save or load upon a command.
- [conditionKeyword]
- It could be one of [ before | after ]
- [EvaluateOnce EL-expression]
- The evaluation result must be one or more command name.
- Command name must correspond to the name specified in Java annotation @Command in a ViewModel.
- @[AnnotationName]( [EL-expression], [arbitraryKey]=[EL-expression] )
- [AnnotationName]
- It could be one of [ command | global-command | validator | converter ]
- [arbitraryKey]=[EL-expression]
- It's key-value pairs basically. You can write multiple key-value pairs with different key names.
- An EL expression without key is set to a default key named "value" implicitly.
- Due to each annotation has different functions, some annotations may ignore key-value pair expression other than default key, e.g.@id.
- [arbitraryKey]
- It could be any name, it's used as a key for parameter related Java annotation in a ViewModel.