org.zkoss.zk.ui.impl
Class AbstractUiFactory

java.lang.Object
  extended by org.zkoss.zk.ui.impl.AbstractUiFactory
All Implemented Interfaces:
UiFactory
Direct Known Subclasses:
SerializableUiFactory, SimpleUiFactory

public abstract class AbstractUiFactory
extends java.lang.Object
implements UiFactory

The sketetal implementation of UiFactory.

Derived class must immplement UiFactory.newSession(org.zkoss.zk.ui.WebApp, java.lang.Object, java.lang.Object), which depends on the Web container.

Author:
tomyeh

Constructor Summary
AbstractUiFactory()
           
 
Method Summary
 PageDefinition getPageDefinition(RequestInfo ri, java.lang.String path)
          Returns the page definition of the specified path, or null if not found.
 PageDefinition getPageDefinitionDirectly(RequestInfo ri, Document content, java.lang.String extension)
          Returns the page definition of the specified content; never null.
 PageDefinition getPageDefinitionDirectly(RequestInfo ri, java.io.Reader reader, java.lang.String extension)
          Returns the page definition of the specified reader; never null.
 PageDefinition getPageDefinitionDirectly(RequestInfo ri, java.lang.String content, java.lang.String extension)
          Returns the page definition of the specified content; never null.
 Richlet getRichlet(RequestInfo ri, java.lang.String path)
          Returns a richlet for specified request, or null if the richlet is not found..
 boolean isRichlet(RequestInfo ri, boolean bRichlet)
          Tests whether the specified request is a richlet.
 Component newComponent(Page page, Component parent, ComponentDefinition compdef, java.lang.String clsnm)
          Creates and initializes a component based on the specified ComponentDefinition.
 Component newComponent(Page page, Component parent, ComponentInfo compInfo, Component insertBefore)
          Creates and initializes a component based on the specified ComponentInfo.
 Composer newComposer(Page page, java.lang.Class klass)
          Instantiates a composer of the given class.
 Composer newComposer(Page page, java.lang.String className)
          Instantiates a composer of the given class name.
 Desktop newDesktop(RequestInfo ri, java.lang.String updateURI, java.lang.String path)
          Creates an instance of Desktop.
 Page newPage(RequestInfo ri, PageDefinition pagedef, java.lang.String path)
          Creates an instance of Page for the specified page definition.
 Page newPage(RequestInfo ri, Richlet richlet, java.lang.String path)
          Creates an instance of Page for the specified richlet.
 ServerPush newServerPush(Desktop desktop, java.lang.Class klass)
          Instantiates a server push of the given class.
 void start(WebApp wapp)
          Starts this factory.
 void stop(WebApp wapp)
          Stops this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zkoss.zk.ui.sys.UiFactory
newSession
 

Constructor Detail

AbstractUiFactory

public AbstractUiFactory()
Method Detail

start

public void start(WebApp wapp)
Description copied from interface: UiFactory
Starts this factory.

Specified by:
start in interface UiFactory

stop

public void stop(WebApp wapp)
Description copied from interface: UiFactory
Stops this factory.

Specified by:
stop in interface UiFactory

isRichlet

public boolean isRichlet(RequestInfo ri,
                         boolean bRichlet)
Description copied from interface: UiFactory
Tests whether the specified request is a richlet.

If this method returns true, UiFactory.getRichlet(org.zkoss.zk.ui.sys.RequestInfo, java.lang.String) is called to create the richlet. Otherwise, UiFactory.getPageDefinition(org.zkoss.zk.ui.sys.RequestInfo, java.lang.String) is called to retrieve the page definition from a ZUML page.

Specified by:
isRichlet in interface UiFactory
bRichlet - the default value that this method shall return. It is a suggetion. If you don't know what to do, just return bRichlet.
Returns:
true if it is a richlet, or false if it is a ZUML page.

getRichlet

public Richlet getRichlet(RequestInfo ri,
                          java.lang.String path)
Description copied from interface: UiFactory
Returns a richlet for specified request, or null if the richlet is not found..

Specified by:
getRichlet in interface UiFactory

newDesktop

public Desktop newDesktop(RequestInfo ri,
                          java.lang.String updateURI,
                          java.lang.String path)
Description copied from interface: UiFactory
Creates an instance of Desktop.

Note: the returned instance must also implement DesktopCtrl.

Specified by:
newDesktop in interface UiFactory
Parameters:
ri - the additional request information.
updateURI - the URI that is used as the base to generate URI for asynchronous updates. In other words, it is used to implement Desktop.getUpdateURI(java.lang.String)
path - the path to request this desktop, such as "/test/test.zul", or null if it is caused by a filter.

newPage

public Page newPage(RequestInfo ri,
                    PageDefinition pagedef,
                    java.lang.String path)
Description copied from interface: UiFactory
Creates an instance of Page for the specified page definition.

Note: the returned instance must also implement PageCtrl.

Specified by:
newPage in interface UiFactory
Parameters:
ri - the additional request information.
pagedef - the page definition. If null, it means the page is served by a Richlet instance.
path - the path to request this page, or null if it is caused by a filter.

newPage

public Page newPage(RequestInfo ri,
                    Richlet richlet,
                    java.lang.String path)
Description copied from interface: UiFactory
Creates an instance of Page for the specified richlet.

Note: the returned instance must also implement PageCtrl.

Specified by:
newPage in interface UiFactory

newComponent

public Component newComponent(Page page,
                              Component parent,
                              ComponentInfo compInfo,
                              Component insertBefore)
Description copied from interface: UiFactory
Creates and initializes a component based on the specified ComponentInfo.

After called, the new component is added to the page, and becomes a child of the specified parent, if any. In addition, the properties and custom attributes defined in ComponentDefinition and ComponentInfo are all applied to the new component.

Specified by:
newComponent in interface UiFactory
Parameters:
page - the page that the new component belongs to (never null).
parent - the parent compoent, or null if the new component is root.
compInfo - the component information

newComponent

public Component newComponent(Page page,
                              Component parent,
                              ComponentDefinition compdef,
                              java.lang.String clsnm)
Description copied from interface: UiFactory
Creates and initializes a component based on the specified ComponentDefinition.

After called, the new component is added to the page, and becomes a child of the specified parent, if any. In addition, the properties and custom attributes defined in ComponentDefinition are all applied to the new component.

Specified by:
newComponent in interface UiFactory
Parameters:
page - the page that the new component belongs to (never null).
parent - the parent compoent, or null if the new component is root.
clsnm - the implementation class of the component. If null, ComponentDefinition.getImplementationClass() will be used.

newComposer

public Composer newComposer(Page page,
                            java.lang.Class klass)
Instantiates a composer of the given class.

Default: creates an instance of klass by use of its no-arg constructor.

Specified by:
newComposer in interface UiFactory
Parameters:
page - the page that the composer will be created for.
Since:
6.0.0

newComposer

public Composer newComposer(Page page,
                            java.lang.String className)
                     throws java.lang.ClassNotFoundException
Instantiates a composer of the given class name.

Default: use Page.resolveClass(java.lang.String) to resolve the class and then invoke newComposer(Page, Class) to instantiate an instance.

Specified by:
newComposer in interface UiFactory
Parameters:
page - the page that the composer will be created for.
Throws:
java.lang.ClassNotFoundException
Since:
6.0.0

newServerPush

public ServerPush newServerPush(Desktop desktop,
                                java.lang.Class klass)
Instantiates a server push of the given class.

Default: creates an instance of klass by use of its no-arg constructor.

Specified by:
newServerPush in interface UiFactory
Parameters:
desktop - the desktop that the server push will be created for.
Since:
6.0.0

getPageDefinition

public PageDefinition getPageDefinition(RequestInfo ri,
                                        java.lang.String path)
Returns the page definition of the specified path, or null if not found.

Dependency: Execution.createComponents -& Execution.getPageDefinition -& UiFactory.getPageDefiition -& PageDefinitions.getPageDefinition

Specified by:
getPageDefinition in interface UiFactory
Parameters:
ri - the additional request information.
path - the path to request this page.
See Also:
UiFactory.getPageDefinitionDirectly(org.zkoss.zk.ui.sys.RequestInfo, java.lang.String, java.lang.String)

getPageDefinitionDirectly

public PageDefinition getPageDefinitionDirectly(RequestInfo ri,
                                                java.lang.String content,
                                                java.lang.String extension)
Returns the page definition of the specified content; never null.

Dependency: Execution.createComponentsDirectly -& Execution.getPageDefinitionDirectly -& UiFactory.getPageDefiitionDirectly -& PageDefintions.getPageDefinitionDirectly

Specified by:
getPageDefinitionDirectly in interface UiFactory
content - the raw content of the page. It must be in ZUML.
extension - the default extension if doc doesn't specify an language. Ignored if null. If extension is null and the content doesn't specify a language, the language called "xul/html" is assumed.
See Also:
UiFactory.getPageDefinition(org.zkoss.zk.ui.sys.RequestInfo, java.lang.String)

getPageDefinitionDirectly

public PageDefinition getPageDefinitionDirectly(RequestInfo ri,
                                                Document content,
                                                java.lang.String extension)
Description copied from interface: UiFactory
Returns the page definition of the specified content; never null.

It is called when Execution.getPageDefinitionDirectly(Document, String) is going to generate a page definition for the content it intercepts.

Implementation NOTE: DO NOT invoke Execution.getPageDefinitionDirectly(Document, String). Otherwise, an endless loop occurs.

Specified by:
getPageDefinitionDirectly in interface UiFactory
content - the raw content of the page in DOM.
extension - the default extension if doc doesn't specify an language. Ignored if null. If extension is null and the content doesn't specify a language, the language called "xul/html" is assumed.
See Also:
UiFactory.getPageDefinition(org.zkoss.zk.ui.sys.RequestInfo, java.lang.String)

getPageDefinitionDirectly

public PageDefinition getPageDefinitionDirectly(RequestInfo ri,
                                                java.io.Reader reader,
                                                java.lang.String extension)
                                         throws java.io.IOException
Description copied from interface: UiFactory
Returns the page definition of the specified reader; never null.

It is called when Execution.getPageDefinitionDirectly(Reader, String) is going to generate a page definition for the content it intercepts.

Implementation NOTE: DO NOT invoke Execution.getPageDefinitionDirectly(Reader, String). Otherwise, an endless loop occurs.

Specified by:
getPageDefinitionDirectly in interface UiFactory
reader - the reader to retrieve the raw content in ZUML.
extension - the default extension if doc doesn't specify an language. Ignored if null. If extension is null and the content doesn't specify a language, the language called "xul/html" is assumed.
Throws:
java.io.IOException
See Also:
UiFactory.getPageDefinition(org.zkoss.zk.ui.sys.RequestInfo, java.lang.String)


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo