@Command"
From Documentation
m ((via JWB)) |
|||
(4 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/viewmodelcommand.html zk-mvvm-book/8.0/syntax/viewmodel/command]|}} | ||
+ | |||
=Syntax= | =Syntax= | ||
Line 15: | Line 17: | ||
'''Purpose:''' To identify a Command method. | '''Purpose:''' To identify a Command method. | ||
− | The optional annotation's element is a String for command's name and that name is referenced in a ZUL with event-command binding. If it's not provided, method name is set as the command name by default. | + | The optional annotation's element is a String for command's name and that name is referenced in a ZUL with event-command binding. If it's not provided, the method name is set as the command name by default. |
− | We also can use parameter related annotation on initial method's parameters, please refer to subsections of [[ZK Developer's Reference/MVVM/Syntax/ViewModel/Parameters]]. | + | We also can use parameter related annotation on initial method's parameters, please refer to subsections of [[ZK Developer's Reference/MVVM/Syntax/ViewModel/Parameters | Parameters]] for more information. |
= Example = | = Example = | ||
Line 43: | Line 45: | ||
} | } | ||
</source> | </source> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | =Version History= | ||
+ | |||
+ | {| class='wikitable' | width="100%" | ||
+ | ! Version !! Date !! Content | ||
+ | |- | ||
+ | | 6.0.0 | ||
+ | | February 2012 | ||
+ | | The MVVM was introduced. | ||
+ | |} | ||
+ | |||
+ | |||
{{ZKDevelopersReferencePageFooter}} | {{ZKDevelopersReferencePageFooter}} |
Latest revision as of 07:35, 8 July 2022
This article is out of date, please refer to zk-mvvm-book/8.0/syntax/viewmodel/command for more up to date information.
Syntax
@Command()
@Command("commanName")
@Command({"commanName1", "commandName2"})
Description
Target: method
Purpose: To identify a Command method.
The optional annotation's element is a String for command's name and that name is referenced in a ZUL with event-command binding. If it's not provided, the method name is set as the command name by default.
We also can use parameter related annotation on initial method's parameters, please refer to subsections of Parameters for more information.
Example
Method name as command name
@Command
public void search(){
items = new ListModelList<Item>();
items.addAll(getSearchService().search(filter));
selected = null;
}
Specify command name
@Command("delete")
public void deleteOrder(){
getService().delete(selected); //delete selected
getOrders().remove(selected);
selected = null; //clean the selected
}
Version History
Version | Date | Content |
---|---|---|
6.0.0 | February 2012 | The MVVM was introduced. |