@ExecutionParam"
From Documentation
(Created page with "{{ZKDevelopersReferencePageHeader}} =Syntax= <source lang="java"> @ExecutionParam("keyString") </source> = Description = '''Target:''' A method's parameter (initial method and...") |
m ((via JWB)) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{ZKDevelopersReferencePageHeader}} | {{ZKDevelopersReferencePageHeader}} | ||
+ | {{Deprecated | url=[http://books.zkoss.org/zk-mvvm-book/8.0/syntax/executionparam.html zk-mvvm-book/8.0/syntax/viewmodel/parameters/executionparam]|}} | ||
+ | |||
=Syntax= | =Syntax= | ||
Line 10: | Line 12: | ||
'''Target:''' A method's parameter (initial method and command method) | '''Target:''' A method's parameter (initial method and command method) | ||
− | '''Purpose:''' Tell binder to retrieve this parameter with specified key from current execution's attribute. | + | '''Purpose:''' Tell binder to retrieve this parameter with specified key from the current execution's attribute. |
− | The annotation is applied to initial | + | The annotation is applied to initial (or command) method's parameter. It declare the applied parameter should come from the current execution's attribute with specified key. |
= Example = | = Example = | ||
− | Assume we want to pass an object by execution's attribute to an included ZUL that uses a ViewModel: < | + | Assume we want to pass an object by execution's attribute to an included ZUL that uses a ViewModel: <code>ExecutionParamVM</code>. |
'''outer ZUL''' | '''outer ZUL''' | ||
Line 63: | Line 65: | ||
* The label will display "abc". | * The label will display "abc". | ||
+ | |||
+ | |||
+ | |||
+ | =Version History= | ||
+ | |||
+ | {| class='wikitable' | width="100%" | ||
+ | ! Version !! Date !! Content | ||
+ | |- | ||
+ | | 6.0.0 | ||
+ | | February 2012 | ||
+ | | The MVVM was introduced. | ||
+ | |} | ||
Latest revision as of 07:36, 8 July 2022
This article is out of date, please refer to zk-mvvm-book/8.0/syntax/viewmodel/parameters/executionparam for more up to date information.
Syntax
@ExecutionParam("keyString")
Description
Target: A method's parameter (initial method and command method)
Purpose: Tell binder to retrieve this parameter with specified key from the current execution's attribute.
The annotation is applied to initial (or command) method's parameter. It declare the applied parameter should come from the current execution's attribute with specified key.
Example
Assume we want to pass an object by execution's attribute to an included ZUL that uses a ViewModel: ExecutionParamVM
.
outer ZUL
<window id="w2">
<zscript>
void doClick(){
org.zkoss.zk.ui.Execution ex = org.zkoss.zk.ui.Executions.getCurrent();
ex.setAttribute("param1","abc");
inc.src = "executionparam-inner.zul";
}
</zscript>
<button label="do include" onClick="doClick()"/>
<include id="inc" />
</window>
We use annotation to retrieve execution's attribute with key "param1".
public class ExecutionParamVM {
private String param1;
@Init
public void init(@ExecutionParam("param1") String param1){
this.param1 = param1;
}
//setter, getter, and others
}
executionparam-inner.zul
<vbox apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('foo.ExecutionParamVM')">
<label value="@load(vm.param1)"/>
</vbox>
- The label will display "abc".
Version History
Version | Date | Content |
---|---|---|
6.0.0 | February 2012 | The MVVM was introduced. |