UI Factory"

From Documentation
(Created page with '{{ZKDevelopersReferencePageHeader}} =Version History= {{LastUpdated}} {| border='1px' | width="100%" ! Version !! Date !! Content |- |   |   |   |} {{ZKDeveloper…')
 
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
 +
 +
<javadoc type="interface">org.zkoss.zk.ui.sys.UiFactory</javadoc> is used to instantiate all UI objects, such as session, desktop, and components, and to load ZUML documents. You could customize it to provide the functionality you want.
 +
 +
For example, <javadoc>org.zkoss.zk.ui.http.SerializableUiFactory</javadoc> is the factory used to instantiate sessions that are serializable<ref>Then, the application is able to run in a clustering environment. Fore more information, please refer to the [[ZK Developer's Reference/Clustering/ZK Configuration|Clustering section]]</ref>, while <javadoc>org.zkoss.zk.ui.http.SimpleUiFactory</javadoc>, the default factory, instantiates non-serializable sessions.
 +
 +
Here are a list of customization you could do with UI Factory:
 +
 +
* Load a ZUML document from, say, a database
 +
** It can be done by overriding <javadoc method="getPageDefinition(org.zkoss.zk.ui.sys.RequestInfo, java.lang.String)" type="interface">org.zkoss.zk.ui.sys.UiFactory</javadoc>
 +
* Instantiate a component by using a different implementation
 +
** It can be done by overriding <javadoc method="newComponent(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.metainfo.ComponentInfo)" type="interface">org.zkoss.zk.ui.sys.UiFactory</javadoc> and <javadoc method="newComponent(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.metainfo.ComponentInfo, java.lang.String)" type="interface">org.zkoss.zk.ui.sys.UiFactory</javadoc>.
 +
** Instantiate a desktop by using a different implementation
 +
** It can be done by overriding <javadoc method="newDesktop(org.zkoss.zk.ui.sys.RequestInfo, java.lang.String, java.lang.String)" type="interface">org.zkoss.zk.ui.sys.UiFactory</javadoc>
 +
** Instantiate a page by using a different implementation
 +
** It can be done by overriding <javadoc method="newPage(org.zkoss.zk.ui.sys.RequestInfo, org.zkoss.zk.ui.metainfo.PageDefinition, java.lang.String)" type="interface">org.zkoss.zk.ui.sys.UiFactory</javadoc> and/or <javadoc method="newPage(org.zkoss.zk.ui.sys.RequestInfo, org.zkoss.zk.ui.Richlet, java.lang.String)" type="interface">org.zkoss.zk.ui.sys.UiFactory</javadoc>
 +
 +
Notice that it is suggested to extend from either <javadoc>org.zkoss.zk.ui.http.SerializableUiFactory</javadoc> or <javadoc>org.zkoss.zk.ui.http.SimpleUiFactory</javadoc>, rather than to implement <javadoc type="interface">org.zkoss.zk.ui.sys.UiFactory</javadoc> from scratch.
 +
<blockquote>
 +
----
 +
<references/>
 +
</blockquote>
 +
 +
=Load ZUML from Database=
  
 
=Version History=
 
=Version History=

Revision as of 09:24, 30 November 2010

UiFactory is used to instantiate all UI objects, such as session, desktop, and components, and to load ZUML documents. You could customize it to provide the functionality you want.

For example, SerializableUiFactory is the factory used to instantiate sessions that are serializable[1], while SimpleUiFactory, the default factory, instantiates non-serializable sessions.

Here are a list of customization you could do with UI Factory:

Notice that it is suggested to extend from either SerializableUiFactory or SimpleUiFactory, rather than to implement UiFactory from scratch.


  1. Then, the application is able to run in a clustering environment. Fore more information, please refer to the Clustering section

Load ZUML from Database

Version History

Last Update : 2010/11/30


Version Date Content
     



Last Update : 2010/11/30

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