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 Object implements WebApp, WebAppCtrl
A skeletal implementation of WebApp.
Author:
tomyeh
  • Constructor Details

  • Method Details

    • getAppName

      public String getAppName()
      Description copied from interface: WebApp
      Returns the application name, never null. Developer can set it to any name that describes his application.

      Default: ZK

      Specified by:
      getAppName in interface WebApp
    • setAppName

      public void setAppName(String name)
      Description copied from interface: WebApp
      Sets the application name. Developer can set it to any name that describes his application.
      Specified by:
      setAppName in interface WebApp
    • getVersion

      public final String getVersion()
      Description copied from interface: WebApp
      Returns the ZK version, such as "1.1.0" and "2.0.0".
      Specified by:
      getVersion in interface WebApp
      See Also:
    • getBuild

      public String getBuild()
      Description copied from interface: WebApp
      Returns the build identifier, such as 2007121316.

      Each time ZK is built, a different build identifier is assigned.

      Specified by:
      getBuild in interface WebApp
    • getBuildStamp

      public static final String getBuildStamp()
    • getSubversion

      public int getSubversion(int portion)
      Description copied from interface: WebApp
      Returns 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:
      getSubversion in interface WebApp
      Parameters:
      portion - which portion of the version; starting from 0. If you want to retrieve the major version, specify 0.
      See Also:
    • getConfiguration

      public final Configuration getConfiguration()
      Description copied from interface: WebApp
      Returns the configuration.
      Specified by:
      getConfiguration in interface WebApp
    • getAttribute

      public Object getAttribute(String name, boolean recurse)
      Description copied from interface: Scope
      Returns the custom attribute associated with this object.
      Specified by:
      getAttribute in interface Scope
      recurse - 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(String name, boolean recurse)
      Description copied from interface: Scope
      Returns if a custom attribute is associated with this object.

      Notice that null is a valid value, so you can tell if an attribute is associated by examining the return value of Scope.getAttribute(java.lang.String).

      Specified by:
      hasAttribute in interface Scope
      recurse - 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 Object setAttribute(String name, Object value, boolean recurse)
      Description copied from interface: Scope
      Sets the custom attribute associated with this scope, or the parent scope.
      Specified by:
      setAttribute in interface Scope
      recurse - 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 as Scope.setAttribute(String,Object).
    • removeAttribute

      public Object removeAttribute(String name, boolean recurse)
      Description copied from interface: Scope
      Removes the custom attribute associated with this scope.
      Specified by:
      removeAttribute in interface Scope
      recurse - 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 as Scope.removeAttribute(String).
    • init

      public void init(Object context, Configuration config)
      Description copied from interface: WebAppCtrl
      Initializes this Web application.
      Specified by:
      init in interface WebAppCtrl
      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: WebAppCtrl
      Destroys this Web application.

      Note; once destroyed, this instance cannot be used anymore.

      Specified by:
      destroy in interface WebAppCtrl
    • getUiEngine

      public final UiEngine getUiEngine()
      Description copied from interface: WebAppCtrl
      Returns the UI engine for this Web application (never null).
      Specified by:
      getUiEngine in interface WebAppCtrl
    • setUiEngine

      public void setUiEngine(UiEngine engine)
      Description copied from interface: WebAppCtrl
      Sets 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:
      setUiEngine in interface WebAppCtrl
      Parameters:
      engine - the UI engine
    • getDesktopCache

      public DesktopCache getDesktopCache(Session sess)
      Description copied from interface: WebAppCtrl
      Specified by:
      getDesktopCache in interface WebAppCtrl
    • getDesktopCacheProvider

      public DesktopCacheProvider getDesktopCacheProvider()
      Description copied from interface: WebAppCtrl
      Returns the desktop cache provider.
      Specified by:
      getDesktopCacheProvider in interface WebAppCtrl
    • setDesktopCacheProvider

      public void setDesktopCacheProvider(DesktopCacheProvider provider)
      Description copied from interface: WebAppCtrl
      Sets the desktop provider for this Web application.
      Specified by:
      setDesktopCacheProvider in interface WebAppCtrl
      Parameters:
      provider - the desktop cache provider
    • getUiFactory

      public UiFactory getUiFactory()
      Description copied from interface: WebAppCtrl
      Returns the UI factory for this Web application (never null).
      Specified by:
      getUiFactory in interface WebAppCtrl
    • setUiFactory

      public void setUiFactory(UiFactory factory)
      Description copied from interface: WebAppCtrl
      Sets the UI factory for this Web application.
      Specified by:
      setUiFactory in interface WebAppCtrl
      Parameters:
      factory - the UI factory
    • getFailoverManager

      public FailoverManager getFailoverManager()
      Description copied from interface: WebAppCtrl
      Returns the failover manager, or null if not available.
      Specified by:
      getFailoverManager in interface WebAppCtrl
    • setFailoverManager

      public void setFailoverManager(FailoverManager failover)
      Description copied from interface: WebAppCtrl
      Sets the failover manager for this Web application.
      Specified by:
      setFailoverManager in interface WebAppCtrl
      Parameters:
      failover - the failover manager. If null, it means no failover manager at all.
    • getIdGenerator

      public IdGenerator getIdGenerator()
      Description copied from interface: WebAppCtrl
      Returns the ID generator, or null if not available.
      Specified by:
      getIdGenerator in interface WebAppCtrl
    • setIdGenerator

      public void setIdGenerator(IdGenerator idgen)
      Description copied from interface: WebAppCtrl
      Sets the ID generator for this Web application.
      Specified by:
      setIdGenerator in interface WebAppCtrl
      Parameters:
      idgen - the ID generator. If null, it means no (custom) ID generator at all.
    • getSessionCache

      public SessionCache getSessionCache()
      Description copied from interface: WebAppCtrl
      Returns the session cache (never null). The session cache is used to store ZK sessions.
      Specified by:
      getSessionCache in interface WebAppCtrl
    • setSessionCache

      public void setSessionCache(SessionCache cache)
      Description copied from interface: WebAppCtrl
      Sets the session cache for this Web application.
      Specified by:
      setSessionCache in interface WebAppCtrl
      Parameters:
      cache - the session cache
    • getAuDecoder

      public AuDecoder getAuDecoder()
      Description copied from interface: WebAppCtrl
      Returns the AU decoder for this Web application, or null if not assigned.
      Specified by:
      getAuDecoder in interface WebAppCtrl
    • setAuDecoder

      public void setAuDecoder(AuDecoder audec)
      Description copied from interface: WebAppCtrl
      Sets the AU decoder for this Web application.

      Default: null (using the system default).

      Specified by:
      setAuDecoder in interface WebAppCtrl
    • sessionWillPassivate

      public void sessionWillPassivate(Session sess)
      Specified by:
      sessionWillPassivate in interface WebAppCtrl
    • sessionDidActivate

      public void sessionDidActivate(Session sess)
      Specified by:
      sessionDidActivate in interface WebAppCtrl
    • sessionDestroyed

      public void sessionDestroyed(Session sess)
      Description copied from interface: WebAppCtrl
      Called when the native session of the specified session has been destroyed
      Specified by:
      sessionDestroyed in interface WebAppCtrl
    • loadBuild

      public static String loadBuild()
      Loads the build identifier. This method is used only Internally