Interface PageCtrl

All Known Implementing Classes:
AbstractPage, PageImpl, VolatilePage

public interface PageCtrl
Addition interface to Page for implementation purpose.

Application developers shall never access any of this methods.

Author:
tomyeh
  • Method Details

    • preInit

      void preInit()
      Pre-initializes this page. It initializes Page.getDesktop(), but it doesn't add this page to the desktop yet (which is done by init(org.zkoss.zk.ui.sys.PageConfig)).

      Note: it is called before Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map<java.lang.String, java.lang.Object>) and init(org.zkoss.zk.ui.sys.PageConfig). Since Page.getDesktop() is initialized in this method, it is OK to create components in Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map<java.lang.String, java.lang.Object>).

      Since:
      3.5.2
    • init

      void init(PageConfig config)
      Initializes this page by assigning the info provided by the specified PageConfig, and then adds it to a desktop (by use of Execution.getDesktop()).

      Note: this method is called after preInit() and Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map<java.lang.String, java.lang.Object>).

      This method shall be called only after the current execution is activated.

      Parameters:
      config - the info about how to initialize this page
      Since:
      3.0.0
    • destroy

      void destroy()
      Called when this page is about to be destroyed. It is called by desktop, after removing it from the desktop.
    • getBeforeHeadTags

      String getBeforeHeadTags()
      Returns the tags that shall be generated inside the head element and before ZK's default tags (never null). For example, it might consist of <meta> and <link>.

      Since it is generated before ZK's default tags (such as CSS and JS), it cannot override ZK's default behaviors.

      Since:
      5.0.5
      See Also:
    • getAfterHeadTags

      String getAfterHeadTags()
      Returns the tags that shall be generated inside the head element and after ZK's default tags (never null). For example, it might consist of <meta> and <link>.

      Since it is generated after ZK's default tags (such as CSS and JS), it could override ZK's default behaviors.

      Since:
      5.0.5
      See Also:
    • addBeforeHeadTags

      void addBeforeHeadTags(String tags)
      Adds the tags that will be generated inside the head element and before ZK's default tags. For example,
      ((PageCtrl)page).addBeforeHeadTags("<meta name=\"robots\" content=\"index,follow\"/>");

      You could specify the link, meta and script directive to have the similar result.

      Since:
      5.0.5
    • addAfterHeadTags

      void addAfterHeadTags(String tags)
      Adds the tags that will be generated inside the head element and after ZK's default tags. For example,
      ((PageCtrl)page).addBeforeHeadTags("<meta name=\"robots\" content=\"index,follow\"/>");

      You could specify the link, meta and script directive to have the similar result.

      Since:
      5.0.5
    • getResponseHeaders

      Collection<Object[]> getResponseHeaders()
      Returns a readonly collection of response headers (never null). The entry is a three-element object array. The first element is the header name. The second element of the array is the value which is an instance of Date or String (and never null). The third element indicates whether to add (rather than set) theader. It is an instance of Boolean (and never null).
      Since:
      5.0.2
    • getRootAttributes

      String getRootAttributes()
      Returns the attributes of the root element declared in this page (never null). An empty string is returned if no special attribute is declared.

      For HTML, the root element is the HTML element.

      Since:
      3.0.0
    • setRootAttributes

      void setRootAttributes(String rootAttributes)
      Set the attributes of the root element declared in this page

      Default: "".

    • getDocType

      String getDocType()
      Returns the doc type (<!DOCTYPE>), or null to use the device default.
      Since:
      3.0.0
    • setDocType

      void setDocType(String docType)
      Sets the doc type (<!DOCTYPE>).

      Default: null (i.e., the device default)

      Since:
      3.0.0
    • getFirstLine

      String getFirstLine()
      Returns the first line to be generated to the output, or null if nothing to generate.

      For XML devices, it is usually the xml processing instruction:
      <?xml version="1.0" encoding="UTF-8"?>

      Since:
      3.0.0
    • setFirstLine

      void setFirstLine(String firstLine)
      Sets the first line to be generated to the output.

      Default: null (i.e., nothing generated)

      Since:
      3.0.0
    • getContentType

      String getContentType()
      Returns the content type, or null to use the device default.
      Since:
      3.0.0
    • setContentType

      void setContentType(String contentType)
      Sets the content type.
      Since:
      3.0.0
    • getWidgetClass

      String getWidgetClass()
      Returns the widget class of this page, or null to use the device default.
      Since:
      5.0.5
    • setWidgetClass

      void setWidgetClass(String wgtcls)
      Sets the widget class of this page.
      Parameters:
      wgtcls - the widget class. The device default is assumed if wgtcls is null or empty.
      Since:
      5.0.5
    • getCacheable

      Boolean getCacheable()
      Returns if the client can cache the rendered result, or null to use the device default.
      Since:
      3.0.0
    • setCacheable

      void setCacheable(Boolean cacheable)
      Sets if the client can cache the rendered result.

      Default: null (use the device default).

      Since:
      3.0.0
    • getAutomaticTimeout

      Boolean getAutomaticTimeout()
      Returns whether to automatically redirect to the timeout URI.
      Since:
      3.6.3
      See Also:
    • setAutomaticTimeout

      void setAutomaticTimeout(Boolean autoTimeout)
      Sets whether to automatically redirect to the timeout URI.

      Default: null (use the device default).

      If it is set to false, it means this page is redirected to the timeout URI when the use takes some action after timeout. In other words, nothing happens if the user does nothing. If it is set to true, it is redirected as soon as timeout, no matter the user takes any action.

      Refer to Configuration.setAutomaticTimeout(java.lang.String, boolean) for how to configure the device default (default: false).

      Since:
      3.6.3
    • getOwner

      Component getOwner()
      Returns the owner of this page, or null if it is not owned by any component. A page is included by a component. We say it is owned by the component.

      Note: the owner, if not null, must implement Includer.

    • setOwner

      void setOwner(Component comp)
      Sets the owner of this page.

      Called only internally

      Since 5.0.6, the owner must implement Includer.

    • redraw

      void redraw(Writer out) throws IOException
      Redraws the whole page into the specified output.

      You could use Attributes.PAGE_REDRAW_CONTROL and/or Attributes.PAGE_RENDERER to control how to render manually.

      Throws:
      IOException
      Since:
      5.0.0
    • addDeferredZScript

      void addDeferredZScript(Component parent, ZScript zscript)
      Adds a deferred zscript.
      Parameters:
      parent - the component that is the parent of zscript (in the ZUML page), or null if it belongs to the page.
      zscript - the zscript that shall be evaluated as late as when the interpreter of the same language is being loaded.
    • sessionWillPassivate

      void sessionWillPassivate(Desktop desktop)
      Notification that the session, which owns this page, is about to be passivated (a.k.a., serialized).
    • sessionDidActivate

      void sessionDidActivate(Desktop desktop)
      Notification that the session, which owns this page, has just been activated (a.k.a., deserialized).