@Command"
From Documentation
(Created page with "{{ZKDevelopersReferencePageHeader}} =Syntax= <source lang="java"> @Command() @Command("commanName") @Command({"commanName1", "commandName2"}) </source> = Description = '''...") |
|||
Line 17: | Line 17: | ||
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, 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]]. |
= Example = | = Example = |
Revision as of 07:11, 8 February 2012
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, 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.
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
}