Package org.zkoss.zk.ui.impl
Class AbstractWebApp
- java.lang.Object
-
- org.zkoss.zk.ui.impl.AbstractWebApp
-
- All Implemented Interfaces:
org.zkoss.util.resource.Locator,Scope,WebAppCtrl,WebApp
- Direct Known Subclasses:
SimpleWebApp
public abstract class AbstractWebApp extends java.lang.Object implements WebApp, WebAppCtrl
A skeletal implementation ofWebApp.- Author:
- tomyeh
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractWebApp()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroys this Web application.java.lang.StringgetAppName()Returns the application name, never null.java.lang.ObjectgetAttribute(java.lang.String name, boolean recurse)Returns the custom attribute associated with this object.AuDecodergetAuDecoder()Returns the AU decoder for this Web application, or null if not assigned.java.lang.StringgetBuild()Returns the build identifier, such as 2007121316.static java.lang.StringgetBuildStamp()ConfigurationgetConfiguration()Returns the configuration.DesktopCachegetDesktopCache(Session sess)Returns the desktop cache.DesktopCacheProvidergetDesktopCacheProvider()Returns the desktop cache provider.FailoverManagergetFailoverManager()Returns the failover manager, or null if not available.IdGeneratorgetIdGenerator()Returns the ID generator, or null if not available.SessionCachegetSessionCache()Returns the session cache (never null).intgetSubversion(int portion)Returns a portion of the version in an integer by specifying its index.UiEnginegetUiEngine()Returns the UI engine for this Web application (never null).UiFactorygetUiFactory()Returns the UI factory for this Web application (never null).java.lang.StringgetVersion()Returns the ZK version, such as "1.1.0" and "2.0.0".booleanhasAttribute(java.lang.String name, boolean recurse)Returns if a custom attribute is associated with this object.voidinit(java.lang.Object context, Configuration config)Initializes this Web application.static java.lang.StringloadBuild()Loads the build identifier.java.lang.ObjectremoveAttribute(java.lang.String name, boolean recurse)Removes the custom attribute associated with this scope.voidsessionDestroyed(Session sess)Called when the native session of the specified session has been destroyedvoidsessionDidActivate(Session sess)voidsessionWillPassivate(Session sess)voidsetAppName(java.lang.String name)Sets the application name.java.lang.ObjectsetAttribute(java.lang.String name, java.lang.Object value, boolean recurse)Sets the custom attribute associated with this scope, or the parent scope.voidsetAuDecoder(AuDecoder audec)Sets the AU decoder for this Web application.voidsetDesktopCacheProvider(DesktopCacheProvider provider)Sets the desktop provider for this Web application.voidsetFailoverManager(FailoverManager failover)Sets the failover manager for this Web application.voidsetIdGenerator(IdGenerator idgen)Sets the ID generator for this Web application.voidsetSessionCache(SessionCache cache)Sets the session cache for this Web application.voidsetUiEngine(UiEngine engine)Sets the UI engine for this Web application.voidsetUiFactory(UiFactory factory)Sets the UI factory for this Web application.-
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.ext.Scope
addScopeListener, hasAttribute, removeScopeListener
-
Methods inherited from interface org.zkoss.zk.ui.WebApp
getAttribute, getAttributes, getInitParameter, getInitParameterNames, getMimeType, getRealPath, getResource, getResourceAsStream, getResourcePaths, getResourceURI, getResourceURI, getServletContext, getUpdateURI, getUpdateURI, getWebApp, log, log, removeAttribute, setAttribute
-
-
-
-
Constructor Detail
-
AbstractWebApp
protected AbstractWebApp()
Constructor.Note: after constructed, it is not initialized completely. For example,
getConfiguration()returns null.WebManager will initialize it later such as initializing a
Configurationinstance by loading zk.xml, and then callinginit(java.lang.Object, org.zkoss.zk.ui.util.Configuration).
-
-
Method Detail
-
getAppName
public java.lang.String getAppName()
Description copied from interface:WebAppReturns the application name, never null. Developer can set it to any name that describes his application.Default: ZK
- Specified by:
getAppNamein interfaceWebApp
-
setAppName
public void setAppName(java.lang.String name)
Description copied from interface:WebAppSets the application name. Developer can set it to any name that describes his application.- Specified by:
setAppNamein interfaceWebApp
-
getVersion
public final java.lang.String getVersion()
Description copied from interface:WebAppReturns the ZK version, such as "1.1.0" and "2.0.0".- Specified by:
getVersionin interfaceWebApp- See Also:
WebApp.getSubversion(int),Utils.parseVersion(java.lang.String),Utils.compareVersion(int[], int[])
-
getBuild
public java.lang.String getBuild()
Description copied from interface:WebAppReturns the build identifier, such as 2007121316.Each time ZK is built, a different build identifier is assigned.
-
getBuildStamp
public static final java.lang.String getBuildStamp()
-
getSubversion
public int getSubversion(int portion)
Description copied from interface:WebAppReturns a portion of the version in an integer by specifying its index. For example, getSubversion(0) returns the so-called major version (2 in "2.4.0"), getSubversion(1) returns the so-called minor version (4 in "2.4.0"), and both getSubversion(2) and getSubversion(3) return 0.- Specified by:
getSubversionin interfaceWebApp- Parameters:
portion- which portion of the version; starting from 0. If you want to retrieve the major version, specify 0.- See Also:
WebApp.getVersion()
-
getConfiguration
public final Configuration getConfiguration()
Description copied from interface:WebAppReturns the configuration.- Specified by:
getConfigurationin interfaceWebApp
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name, boolean recurse)Description copied from interface:ScopeReturns the custom attribute associated with this object.- Specified by:
getAttributein interfaceScoperecurse- whether to search its ancestor scope. If true and the current scope doen't define the attribute, it searches up its ancestor to see any of them has defined the specified attribute.
-
hasAttribute
public boolean hasAttribute(java.lang.String name, boolean recurse)Description copied from interface:ScopeReturns if a custom attribute is associated with this object.Notice that
nullis a valid value, so you can tell if an attribute is associated by examining the return value ofScope.getAttribute(java.lang.String).- Specified by:
hasAttributein interfaceScoperecurse- whether to search its ancestor scope. If true and the current scope doen't define the attribute, it searches up its ancestor to see any of them has defined the specified attribute.
-
setAttribute
public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value, boolean recurse)Description copied from interface:ScopeSets the custom attribute associated with this scope, or the parent scope.- Specified by:
setAttributein interfaceScoperecurse- whether to look up the parent scope for the existence of the attribute.
If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is replaced. Otherwise, it is the same asScope.setAttribute(String,Object).
-
removeAttribute
public java.lang.Object removeAttribute(java.lang.String name, boolean recurse)Description copied from interface:ScopeRemoves the custom attribute associated with this scope.- Specified by:
removeAttributein interfaceScoperecurse- whether to look up the parent scope for the existence of the attribute.
If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is removed. Otherwise, it is the same asScope.removeAttribute(String).
-
init
public void init(java.lang.Object context, Configuration config)Description copied from interface:WebAppCtrlInitializes this Web application.- Specified by:
initin interfaceWebAppCtrl- Parameters:
context- the servlet context, if servlets are used. Currently, ZK supports only servlets. In the future there might be more to support.config- the configuration (never null)
-
destroy
public void destroy()
Description copied from interface:WebAppCtrlDestroys this Web application.Note; once destroyed, this instance cannot be used anymore.
- Specified by:
destroyin interfaceWebAppCtrl
-
getUiEngine
public final UiEngine getUiEngine()
Description copied from interface:WebAppCtrlReturns the UI engine for this Web application (never null).- Specified by:
getUiEnginein interfaceWebAppCtrl
-
setUiEngine
public void setUiEngine(UiEngine engine)
Description copied from interface:WebAppCtrlSets the UI engine for this Web application. The UI engine is stateful so it is not safe to change it if there are active sessions.- Specified by:
setUiEnginein interfaceWebAppCtrl- Parameters:
engine- the UI engine
-
getDesktopCache
public DesktopCache getDesktopCache(Session sess)
Description copied from interface:WebAppCtrlReturns the desktop cache. A shortcut ofWebAppCtrl.getDesktopCacheProvider()'sDesktopCacheProvider.getDesktopCache(org.zkoss.zk.ui.Session).- Specified by:
getDesktopCachein interfaceWebAppCtrl
-
getDesktopCacheProvider
public DesktopCacheProvider getDesktopCacheProvider()
Description copied from interface:WebAppCtrlReturns the desktop cache provider.- Specified by:
getDesktopCacheProviderin interfaceWebAppCtrl
-
setDesktopCacheProvider
public void setDesktopCacheProvider(DesktopCacheProvider provider)
Description copied from interface:WebAppCtrlSets the desktop provider for this Web application.- Specified by:
setDesktopCacheProviderin interfaceWebAppCtrl- Parameters:
provider- the desktop cache provider
-
getUiFactory
public UiFactory getUiFactory()
Description copied from interface:WebAppCtrlReturns the UI factory for this Web application (never null).- Specified by:
getUiFactoryin interfaceWebAppCtrl
-
setUiFactory
public void setUiFactory(UiFactory factory)
Description copied from interface:WebAppCtrlSets the UI factory for this Web application.- Specified by:
setUiFactoryin interfaceWebAppCtrl- Parameters:
factory- the UI factory
-
getFailoverManager
public FailoverManager getFailoverManager()
Description copied from interface:WebAppCtrlReturns the failover manager, or null if not available.- Specified by:
getFailoverManagerin interfaceWebAppCtrl
-
setFailoverManager
public void setFailoverManager(FailoverManager failover)
Description copied from interface:WebAppCtrlSets the failover manager for this Web application.- Specified by:
setFailoverManagerin interfaceWebAppCtrl- Parameters:
failover- the failover manager. If null, it means no failover manager at all.
-
getIdGenerator
public IdGenerator getIdGenerator()
Description copied from interface:WebAppCtrlReturns the ID generator, or null if not available.- Specified by:
getIdGeneratorin interfaceWebAppCtrl
-
setIdGenerator
public void setIdGenerator(IdGenerator idgen)
Description copied from interface:WebAppCtrlSets the ID generator for this Web application.- Specified by:
setIdGeneratorin interfaceWebAppCtrl- Parameters:
idgen- the ID generator. If null, it means no (custom) ID generator at all.
-
getSessionCache
public SessionCache getSessionCache()
Description copied from interface:WebAppCtrlReturns the session cache (never null). The session cache is used to store ZK sessions.- Specified by:
getSessionCachein interfaceWebAppCtrl
-
setSessionCache
public void setSessionCache(SessionCache cache)
Description copied from interface:WebAppCtrlSets the session cache for this Web application.- Specified by:
setSessionCachein interfaceWebAppCtrl- Parameters:
cache- the session cache
-
getAuDecoder
public AuDecoder getAuDecoder()
Description copied from interface:WebAppCtrlReturns the AU decoder for this Web application, or null if not assigned.- Specified by:
getAuDecoderin interfaceWebAppCtrl
-
setAuDecoder
public void setAuDecoder(AuDecoder audec)
Description copied from interface:WebAppCtrlSets the AU decoder for this Web application.Default: null (using the system default).
- Specified by:
setAuDecoderin interfaceWebAppCtrl
-
sessionWillPassivate
public void sessionWillPassivate(Session sess)
InvokesgetDesktopCacheProvider()'sDesktopCacheProvider.sessionWillPassivate(org.zkoss.zk.ui.Session).- Specified by:
sessionWillPassivatein interfaceWebAppCtrl
-
sessionDidActivate
public void sessionDidActivate(Session sess)
InvokesgetDesktopCacheProvider()'sDesktopCacheProvider.sessionDidActivate(org.zkoss.zk.ui.Session).- Specified by:
sessionDidActivatein interfaceWebAppCtrl
-
sessionDestroyed
public void sessionDestroyed(Session sess)
Description copied from interface:WebAppCtrlCalled when the native session of the specified session has been destroyed- Specified by:
sessionDestroyedin interfaceWebAppCtrl
-
loadBuild
public static java.lang.String loadBuild()
Loads the build identifier. This method is used only Internally
-
-