CloseAgent"

From Documentation
(Created page with "{{ZATSEssentialsPageHeader}} Due to ZK component's specifications, only ''' ''panel'', ''tab'', and ''window'' '''supports this operation. Notice that when you close any of th...")
 
Line 2: Line 2:
  
  
 +
__TOC__
 +
 +
= Close =
  
 
Due to ZK component's specifications, only ''' ''panel'', ''tab'', and ''window'' '''supports this operation. Notice that when you close any of these components, the closed component is consequently detached from desktop by default. Of course, you can write event handler to override this behavior, for example to hide a component instead of detaching it.
 
Due to ZK component's specifications, only ''' ''panel'', ''tab'', and ''window'' '''supports this operation. Notice that when you close any of these components, the closed component is consequently detached from desktop by default. Of course, you can write event handler to override this behavior, for example to hide a component instead of detaching it.
Line 33: Line 36:
  
 
* After "tab" is detached,  you cannot retrieve from desktop. (line 15)
 
* After "tab" is detached,  you cannot retrieve from desktop. (line 15)
 +
 +
 +
=Supported Components=
 +
 +
{| border="1" | width="100%"
 +
! <center>Components</center>
 +
! <center>Version</center>
 +
! <center>Note</center>
 +
|-
 +
| Panel
 +
| 5, 6
 +
|
 +
|-
 +
| Tab
 +
| 5, 6
 +
|
 +
|-
 +
| Window
 +
| 5, 6
 +
|
 +
|}
  
  
  
 
{{ZATSEssentialsPageFooter}}
 
{{ZATSEssentialsPageFooter}}

Revision as of 10:07, 15 May 2012



Close

Due to ZK component's specifications, only panel, tab, and window supports this operation. Notice that when you close any of these components, the closed component is consequently detached from desktop by default. Of course, you can write event handler to override this behavior, for example to hide a component instead of detaching it.

Smalltalk-mimic-close.png


The test below is quite simple, close each component and check if they are detached one by one.

	@Test
	public void testAgent() {
		DesktopAgent desktopAgent = Zats.newClient().connect("/close.zul");
		
		ComponentAgent panel = desktopAgent.query("panel[title='closable']");
		panel.as(CloseAgent.class).close();
		Assert.assertNull(((Component)panel.getDelegatee()).getPage());
		
		ComponentAgent window = desktopAgent.query("window[title='closable']");
		window.as(CloseAgent.class).close();
		Assert.assertNull(((Component)window.getDelegatee()).getPage());
		
		ComponentAgent tab = desktopAgent.query("tab[label='closable']");
		tab.as(CloseAgent.class).close();
		Assert.assertNull(desktopAgent.query("tab[label='closable']"));
	}
  • Close a closeable component with CloseAgent.close() When the component is detached, do not reuse the variables that references them. (line 6,10,14)
  • After "tab" is detached, you cannot retrieve from desktop. (line 15)


Supported Components

Components
Version
Note
Panel 5, 6
Tab 5, 6
Window 5, 6




Last Update : 2012/05/15

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