Data Binding"
From Documentation
Tmillsclare (talk | contribs) m |
|||
Line 6: | Line 6: | ||
Basically, the syntax consists of an annotation with comma-separated key-value pairs. The binder treats value of a key as an EL expression, and sets an EL expression without a key to default key's value. All annotations requires at least default key's value. | Basically, the syntax consists of an annotation with comma-separated key-value pairs. The binder treats value of a key as an EL expression, and sets an EL expression without a key to default key's value. All annotations requires at least default key's value. | ||
− | * '''<tt>@</tt>''[ | + | * '''<tt>@</tt>''[AnnotationName]''<tt>( </tt> ''[EvaluateOnce EL-expression]'' <tt>) </tt> ''' |
− | ;''[ | + | ;''[AnnotationName]'' |
: It could be one of [ '''id | init ''' ] | : It could be one of [ '''id | init ''' ] | ||
Line 18: | Line 18: | ||
− | * '''<tt>@</tt>''[ | + | * '''<tt>@</tt>''[AnnotationName]''<tt>( </tt> ''[EL-expression]'' <tt>) </tt> ''' |
− | ;''[ | + | ;''[AnnotationName]'' |
− | : It could be one of [ ''' bind | template''' ] | + | : It could be one of [ ''' bind | template | ref''' ] |
;''[EL-expression]'' | ;''[EL-expression]'' | ||
Line 29: | Line 29: | ||
− | * '''<tt>@</tt>''[ | + | * '''<tt>@</tt>''[AnnotationName]''<tt>( </tt> ''[EL-expression], [conditionKeyword]=[EvaluateOnce EL-expression]'' <tt>) </tt> ''' |
− | ;''[ | + | ;''[AnnotationName]'' |
: It could be one of [ '''load | save ''' ] | : It could be one of [ '''load | save ''' ] | ||
Line 47: | Line 47: | ||
− | * '''<tt>@</tt>''[ | + | * '''<tt>@</tt>''[AnnotationName]''<tt>( </tt> ''[EL-expression], [arbitraryKey]=[EL-expression]'' <tt>) </tt> ''' |
− | ;''[ | + | ;''[AnnotationName]'' |
: It could be one of [ '''command | global-command | validator | converter ''' ] | : It could be one of [ '''command | global-command | validator | converter ''' ] | ||
Revision as of 03:42, 26 December 2012
In the following sections, we'll cover syntax of all ZK Bind's annotations used on a ZUL. They are all used in component's attribute and have similar format:
Basically, the syntax consists of an annotation with comma-separated key-value pairs. The binder treats value of a key as an EL expression, and sets an EL expression without a key to default key's value. All annotations requires at least default key'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.