Class AbstractUiFactory
- java.lang.Object
-
- 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 skeletal implementation ofUiFactory
.Derived class must implement
UiFactory.newSession(org.zkoss.zk.ui.WebApp, java.lang.Object, java.lang.Object)
, which depends on the Web container.- Author:
- tomyeh
-
-
Constructor Summary
Constructors Constructor Description AbstractUiFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, 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.PageDefinition
getPageDefinitionDirectly(RequestInfo ri, Document 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 specifiedComponentDefinition
.Component
newComponent(Page page, Component parent, ComponentInfo compInfo, Component insertBefore)
Creates and initializes a component based on the specifiedComponentInfo
.Component
newComponent(Page page, Component parent, ShadowInfo compInfo, Component insertBefore)
Creates and initializes a shadow based on the specifiedShadowInfo
.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 ofDesktop
.Desktop
newDesktop(RequestInfo ri, java.lang.String updateURI, java.lang.String resourceURI, java.lang.String path)
Creates an instance ofDesktop
.Page
newPage(RequestInfo ri, PageDefinition pagedef, java.lang.String path)
Creates an instance ofPage
for the specified page definition.Page
newPage(RequestInfo ri, Richlet richlet, java.lang.String path)
Creates an instance ofPage
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
-
-
-
-
Method Detail
-
start
public void start(WebApp wapp)
Description copied from interface:UiFactory
Starts this factory.
-
stop
public void stop(WebApp wapp)
Description copied from interface:UiFactory
Stops this factory.
-
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.
-
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 interfaceUiFactory
-
newDesktop
public Desktop newDesktop(RequestInfo ri, java.lang.String updateURI, java.lang.String path)
Description copied from interface:UiFactory
Creates an instance ofDesktop
.Note: the returned instance must also implement
DesktopCtrl
.- Specified by:
newDesktop
in interfaceUiFactory
- 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 implementDesktop.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.
-
newDesktop
public Desktop newDesktop(RequestInfo ri, java.lang.String updateURI, java.lang.String resourceURI, java.lang.String path)
Description copied from interface:UiFactory
Creates an instance ofDesktop
.Note: the returned instance must also implement
DesktopCtrl
.- Specified by:
newDesktop
in interfaceUiFactory
- 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 implementDesktop.getUpdateURI(java.lang.String)
resourceURI
- the URI that is used to get ZK resourcepath
- 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
-
newPage
public Page newPage(RequestInfo ri, Richlet richlet, java.lang.String path)
Description copied from interface:UiFactory
-
newComponent
public Component newComponent(Page page, Component parent, ShadowInfo compInfo, Component insertBefore)
Description copied from interface:UiFactory
Creates and initializes a shadow based on the specifiedShadowInfo
.After called, the new shadow element is added to the host component, if any. In addition, the properties are all applied to the new shadow element.
- Specified by:
newComponent
in interfaceUiFactory
- Parameters:
page
- the page that the host component belongs to (never null).parent
- the parent shadow, or null if the new shadow is root.compInfo
- the shadow information
-
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 specifiedComponentInfo
.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
andComponentInfo
are all applied to the new component.- Specified by:
newComponent
in interfaceUiFactory
- Parameters:
page
- the page that the new component belongs to (never null).parent
- the parent component, 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 specifiedComponentDefinition
.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 interfaceUiFactory
- Parameters:
page
- the page that the new component belongs to (never null).parent
- the parent component, 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 interfaceUiFactory
- 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 invokenewComposer(Page, Class)
to instantiate an instance.- Specified by:
newComposer
in interfaceUiFactory
- 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 interfaceUiFactory
- 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 interfaceUiFactory
- 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 interfaceUiFactory
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 interfaceUiFactory
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 interfaceUiFactory
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)
-
-