Implement Custom Java Class"

From Documentation
m
Line 2: Line 2:
  
 
As described in the earlier sections, a macro component is instantiated to represent a regular macro. By default, <javadoc>org.zkoss.zk.ui.HtmlMacroComponent</javadoc> is assumed (and instantiated). However, you provide a custom Java class to provide a better API to simplify the access and to encapsulate the implementation.
 
As described in the earlier sections, a macro component is instantiated to represent a regular macro. By default, <javadoc>org.zkoss.zk.ui.HtmlMacroComponent</javadoc> is assumed (and instantiated). However, you provide a custom Java class to provide a better API to simplify the access and to encapsulate the implementation.
 +
 +
=Implement Custom Java Class for Macro=
 +
 +
=Declare Macro with Custom Java Class=
 +
 +
=Use Macro with Custom Java Class=
 +
 +
==In ZUML==
 +
The use of the macro component with a custom Java class in a ZUML page is the same as other macro components.
 +
 +
==In Java==
 +
 +
The main purpose of introducing a custom Java class is to simplify the use of a macro component in Java. For example, you could invoke a more meaningful setter directly rather than <javadoc method="setDynamicProperty(java.lang.String, java.lang.Object)">org.zkoss.zk.ui.ext.DynamicPropertied</javadoc>. In additions, the instantiation could be as simple as follows:
 +
 +
<source lang="Java">
 +
Username ua = new Username();
 +
ua.setParent(wnd);
 +
ua.setWho("Joe");
 +
</source>
  
 
=Version History=
 
=Version History=

Revision as of 10:18, 8 November 2010


Implement Custom Java Class


As described in the earlier sections, a macro component is instantiated to represent a regular macro. By default, HtmlMacroComponent is assumed (and instantiated). However, you provide a custom Java class to provide a better API to simplify the access and to encapsulate the implementation.

Implement Custom Java Class for Macro

Declare Macro with Custom Java Class

Use Macro with Custom Java Class

In ZUML

The use of the macro component with a custom Java class in a ZUML page is the same as other macro components.

In Java

The main purpose of introducing a custom Java class is to simplify the use of a macro component in Java. For example, you could invoke a more meaningful setter directly rather than DynamicPropertied.setDynamicProperty(String, Object). In additions, the instantiation could be as simple as follows:

Username ua = new Username();
ua.setParent(wnd);
ua.setWho("Joe");

Version History

Last Update : 2010/11/8

Version Date Content
5.0.5 October, 2010 HtmlMacroComponent.compose() was introduced.



Last Update : 2010/11/08

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