ZATS Richlet"

From Documentation
Line 2: Line 2:
 
{{ZATSEssentialsPageHeader}}
 
{{ZATSEssentialsPageHeader}}
  
ZATS Mimic also support Richlet<ref>for more detail, please refer to [[ZK_Developer%27s_Reference/UI_Composing/Richlet]]</ref>.
+
ZATS Mimic also supports <javadoc>org.zkoss.zk.ui.Richlet</javadoc><ref>for more detail, please refer to [[ZK_Developer%27s_Reference/UI_Composing/Richlet]]</ref>. It just needs a few custom configuration for [http://www.zkoss.org/javadoc/latest/zats/org/zkoss/zats/mimic/DefaultZatsEnvironment.html DefaultZatsEnvironment] and the test code is no different with testing a ZUML file. The following is a simple Richlet example:
  
 
'''web.xml'''
 
'''web.xml'''
Line 25: Line 25:
  
 
'''MyRichlet.java'''
 
'''MyRichlet.java'''
<source lang="java" start="10" high="14,16,19,20">
+
<source lang="java" start="10" high="12,14,16,19,20">
 
public class MyRichlet extends GenericRichlet {
 
public class MyRichlet extends GenericRichlet {
 
public void service(Page page) throws Exception {
 
public void service(Page page) throws Exception {
Line 42: Line 42:
 
}
 
}
 
</source>
 
</source>
* '''Line 14, 16''': After clicking the button, the text of label will be changed.
+
* '''Line 12, 14, 16''': After clicking the button, the text of label will be changed.
  
 
'''Notes'''
 
'''Notes'''
 
<references/>
 
<references/>
 +
  
  
  
 
{{ZATSEssentialsPageFooter}}
 
{{ZATSEssentialsPageFooter}}

Revision as of 04:05, 12 June 2012

WarningTriangle-32x32.png This page is under construction, so we cannot guarantee the accuracy of the content!

aowang



ZATS Mimic also supports Richlet[1]. It just needs a few custom configuration for DefaultZatsEnvironment and the test code is no different with testing a ZUML file. The following is a simple Richlet example:

web.xml

<servlet-mapping>
	<servlet-name>zkLoader</servlet-name>
	<url-pattern>/zk/*</url-pattern>
</servlet-mapping>

zk.xml

<richlet>
	<richlet-name>MyRichlet</richlet-name>
	<richlet-class>foo.MyRichlet</richlet-class>
</richlet>
<richlet-mapping>
	<richlet-name>MyRichlet</richlet-name>
	<url-pattern>/foo</url-pattern>
</richlet-mapping>

MyRichlet.java

public class MyRichlet extends GenericRichlet {
	public void service(Page page) throws Exception {
		final Label message = new Label("foo");
		Button button = new Button("go");
		button.addEventListener(Events.ON_CLICK, new EventListener() {
			public void onEvent(Event event) throws Exception {
				message.setValue("bar");
			}
		});
		button.setId("btn");
		message.setId("msg");
		button.setPage(page);
		message.setPage(page);
	}
}
  • Line 12, 14, 16: After clicking the button, the text of label will be changed.

Notes

  1. for more detail, please refer to ZK_Developer's_Reference/UI_Composing/Richlet




Last Update : 2012/06/12

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