From Documentation

Click, Double-Click, Right-Click

ClickAgent helps us to mimic the clicking of a component for general intention; it is able to trigger onClick, onDoubleClick, or onRightClick events. Most user actions are done by clicking, but they might have different intentions. For example, clicking a listitem would represent selecting it; clicking on a checkbox would represent checking the box and so on. Therefore, to avoid mixing several actions into clicking operations, specific actions have different corresponding operation agents. For example, if you wanted to select a listitem, use SelectAgent ,for checkbox, use CheckAgent . Which operation agent you choose would depend on the intention.

According to ZK Component Referenece, all components that inherit HtmlBasedComponent supports click, double click, and right click.

public class ClickTest {

	//remove other methods for brevity

	public void test() {
		DesktopAgent desktop = Zats.newClient().connect("/click.zul");

		ComponentAgent label = desktop.query("#mylabel");
		ComponentAgent eventName = desktop.query("#eventName");;
  • As mentioned in the previous section, it's a shortcut method for convenience. (line 12)
  • If you want to perform double click or right click, you have to get ClickAgent first from ComponentAgent . (line 15,18)

Supported Components

Sub-class of HtmlBasedComponent 5, 6

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