Interface PageCtrl

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addAfterHeadTags​(java.lang.String tags)
      Adds the tags that will be generated inside the head element and after ZK's default tags.
      void addBeforeHeadTags​(java.lang.String tags)
      Adds the tags that will be generated inside the head element and before ZK's default tags.
      void addDeferredZScript​(Component parent, ZScript zscript)
      Adds a deferred zscript.
      void destroy()
      Called when this page is about to be destroyed.
      java.lang.String getAfterHeadTags()
      Returns the tags that shall be generated inside the head element and after ZK's default tags (never null).
      java.lang.Boolean getAutomaticTimeout()
      Returns whether to automatically redirect to the timeout URI.
      java.lang.String getBeforeHeadTags()
      Returns the tags that shall be generated inside the head element and before ZK's default tags (never null).
      java.lang.Boolean getCacheable()
      Returns if the client can cache the rendered result, or null to use the device default.
      java.lang.String getContentType()
      Returns the content type, or null to use the device default.
      java.lang.String getDocType()
      Returns the doc type (<!
      java.lang.String getFirstLine()
      Returns the first line to be generated to the output, or null if nothing to generate.
      Component getOwner()
      Returns the owner of this page, or null if it is not owned by any component.
      java.util.Collection<java.lang.Object[]> getResponseHeaders()
      Returns a readonly collection of response headers (never null).
      java.lang.String getRootAttributes()
      Returns the attributes of the root element declared in this page (never null).
      java.lang.String getWidgetClass()
      Returns the widget class of this page, or null to use the device default.
      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()).
      void preInit()
      Pre-initializes this page.
      void redraw​(java.io.Writer out)
      Redraws the whole page into the specified output.
      void sessionDidActivate​(Desktop desktop)
      Notification that the session, which owns this page, has just been activated (a.k.a., deserialized).
      void sessionWillPassivate​(Desktop desktop)
      Notification that the session, which owns this page, is about to be passivated (a.k.a., serialized).
      void setAutomaticTimeout​(java.lang.Boolean autoTimeout)
      Sets whether to automatically redirect to the timeout URI.
      void setCacheable​(java.lang.Boolean cacheable)
      Sets if the client can cache the rendered result.
      void setContentType​(java.lang.String contentType)
      Sets the content type.
      void setDocType​(java.lang.String docType)
      Sets the doc type (<!
      void setFirstLine​(java.lang.String firstLine)
      Sets the first line to be generated to the output.
      void setOwner​(Component comp)
      Sets the owner of this page.
      void setRootAttributes​(java.lang.String rootAttributes)
      Set the attributes of the root element declared in this page
      void setWidgetClass​(java.lang.String wgtcls)
      Sets the widget class of this page.
    • Method Detail

      • destroy

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

        java.lang.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()
      • getAfterHeadTags

        java.lang.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:
        getBeforeHeadTags()
      • addBeforeHeadTags

        void addBeforeHeadTags​(java.lang.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​(java.lang.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

        java.util.Collection<java.lang.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

        java.lang.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​(java.lang.String rootAttributes)
        Set the attributes of the root element declared in this page

        Default: "".

      • getDocType

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

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

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

        Since:
        3.0.0
      • getFirstLine

        java.lang.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​(java.lang.String firstLine)
        Sets the first line to be generated to the output.

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

        Since:
        3.0.0
      • getContentType

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

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

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

        void setWidgetClass​(java.lang.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

        java.lang.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​(java.lang.Boolean cacheable)
        Sets if the client can cache the rendered result.

        Default: null (use the device default).

        Since:
        3.0.0
      • setAutomaticTimeout

        void setAutomaticTimeout​(java.lang.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​(java.io.Writer out)
             throws java.io.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:
        java.io.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).