From Documentation
Revision as of 02:55, 18 January 2022 by Hawk (talk | contribs) (correct highlight (via JWB))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


OpenAgent is used to expand a treeitem, listgroup, detail, bandbox, groupbox or combobutton etc.

Here we use a tree with binary structure to demonstrate this agent's usage. Each treeitem has two children.


In the test case below, we expand the first treeitem (node1) and its first child treeitem (node3), the first treeitem's visible item count should be 5. Before expanding, its visible item count is 1(only itself).

	public void testAgent() {
		DesktopAgent desktop = Zats.newClient().connect("/open-tree.zul");

		ComponentAgent firstItem = desktop.query("#tree").query("treeitem");
		//open first item;
		//collapse first item;
  • Although there are two treeitems, query() only returns the first one. (line 3)
  • Before expanding, its visible item count is one(only itself). (line 6)
  • After we expand the first treeitem and its first child item, its visible item count should now be five as shown in the image above. (line 8-9)
  • Call open(false) to collapse first treeitem, and its visible item count comes back to one. (line 12)

Supported Components

Combobutton, Popup, Bandbox, Combobox, Groupbox,

Panel, Window, Detail, Group, Listgroup, Treeitem,

Center, North, East, West, South, Splitter

5, 6

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