@GlobalCommand"

From Documentation
(Created page with "{{ZKDevelopersReferencePageHeader}} =Syntax= <source lang="java"> @Command() @Command("commanName") @Command({"commanName1", "commandName2"}) </source> = Description = '''...")
 
Line 3: Line 3:
 
=Syntax=
 
=Syntax=
 
<source lang="java">
 
<source lang="java">
@Command()
+
@GlobalCommand
  
@Command("commanName")  
+
@GlobalCommand("commanName")  
  
@Command({"commanName1", "commandName2"})  
+
@GlobalCommand({"commanName1", "commandName2"})  
 
</source>
 
</source>
  
Line 13: Line 13:
 
'''Target:''' method
 
'''Target:''' method
  
'''Purpose:''' To identify a Command method.
+
'''Purpose:''' To identify a global 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 global 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 can use parameter related annotation on command method's parameters, please refer to subsections of [[ZK Developer's Reference/MVVM/Syntax/ViewModel/Parameters]].
  
 
= Example =
 
= Example =
Line 24: Line 24:
 
<source lang="java">
 
<source lang="java">
  
@Command
+
@GlobalCommand
public void search(){
+
public void show(){
items = new ListModelList<Item>();
+
//...
items.addAll(getSearchService().search(filter));
 
selected = null;
 
 
}
 
}
  
Line 36: Line 34:
 
<source lang="java">
 
<source lang="java">
  
@Command("delete")
+
@Command("delete") @GlobalCommand("delete")
 
public void deleteOrder(){
 
public void deleteOrder(){
getService().delete(selected); //delete selected
+
//...
getOrders().remove(selected);
 
selected = null; //clean the selected
 
 
}
 
}
 
</source>
 
</source>
 +
 +
  
 
{{ZKDevelopersReferencePageFooter}}
 
{{ZKDevelopersReferencePageFooter}}

Revision as of 07:11, 8 February 2012

Syntax

@GlobalCommand

@GlobalCommand("commanName") 

@GlobalCommand({"commanName1", "commandName2"})

Description

Target: method

Purpose: To identify a global command method.

The optional annotation's element is a String for command's name and that name is referenced in a ZUL with global command binding. If it's not provided, method name is set as the command name by default.

We can use parameter related annotation on command method's parameters, please refer to subsections of ZK Developer's Reference/MVVM/Syntax/ViewModel/Parameters.

Example

Method name as command name

	@GlobalCommand
	public void show(){
		//...
	}

Specify command name

	@Command("delete") @GlobalCommand("delete")
	public void deleteOrder(){
		//...
	}




Last Update : 2012/02/08

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.