Package org.zkoss.zhtml.impl

## Class PageRenderer

- java.lang.Object
- - org.zkoss.zhtml.impl.PageRenderer

- All Implemented Interfaces:
    `PageRenderer`

      public class PageRenderer
      extends java.lang.Object
      implements PageRenderer

  The page render for ZHTML pages.
  Since:
    5.0.0
  Author:
    tomyeh

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PageRenderer()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `afterRenderHtml​(Execution exec, Page page, java.io.Writer out, java.lang.Object param)` | Ends and cleans up the rendering of a complete ZHTML page.
    `static void` | `afterRenderTag​(Execution exec, java.lang.Object param)` | Ends and cleans up the rendering of a ZHTML tag.
    `static java.lang.Object` | `beforeRenderHtml​(Execution exec, Page page, java.io.Writer out)` | Prepares for rendering a complete ZHTML page.
    `static java.lang.Object` | `beforeRenderTag​(Execution exec)` | Prepares for rendering a ZHTML tag.
    `static java.lang.String` | `childrenToContent​(Component comp)` | Converts the children of the give component into a string-typed content, or null if no children at all.
    `static TagRenderContext` | `getTagRenderContext​(Execution exec)` | Returns the render context, or null if not available.
    `void` | `render​(Page page, java.io.Writer out)` | Renders the page.
    `protected void` | `renderComplete​(Execution exec, Page page, java.io.Writer out)` | Renders the page if `Page.isComplete()` is true.
    `protected void` | `renderPage​(Execution exec, Page page, java.io.Writer out, boolean au)` | Renders the page if `Page.isComplete()` is false.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PageRenderer

          public PageRenderer()

  - ### Method Detail

    - #### getTagRenderContext

          public static TagRenderContext getTagRenderContext​(Execution exec)

      Returns the render context, or null if not available. The render context is available only if the ZHTML page is rendered directly (rather than via inclusion).
      Parameters:
        `exec` - the execution. If null, Executions.getCurrent() is assumed.

    - #### render

          public void render​(Page page,
                             java.io.Writer out)
                      throws java.io.IOException

      Description copied from interface: `PageRenderer`
      Renders the page.
      Specified by:
        `render` in interface `PageRenderer`
        `out` - the output writer to put the content to (never null).
      Throws:
        `java.io.IOException`

    - #### renderPage

          protected void renderPage​(Execution exec,
                                    Page page,
                                    java.io.Writer out,
                                    boolean au)
                             throws java.io.IOException

      Renders the page if `Page.isComplete()` is false.
      Parameters:
        `au` - whether it is caused by an asynchronous update
      Throws:
        `java.io.IOException`

    - #### renderComplete

          protected void renderComplete​(Execution exec,
                                        Page page,
                                        java.io.Writer out)
                                 throws java.io.IOException

      Renders the page if `Page.isComplete()` is true. In other words, the page content contains HTML/BODY tags.
      Throws:
        `java.io.IOException`

    - #### beforeRenderHtml

          public static java.lang.Object beforeRenderHtml​(Execution exec,
                                                          Page page,
                                                          java.io.Writer out)
                                                   throws java.io.IOException

      Prepares for rendering a complete ZHTML page. After rendering, the caller shall also invoke `afterRenderHtml(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Page, java.io.Writer, java.lang.Object)`. Furthermore, the return value of this method shall be passed as the `param` argument of `afterRenderHtml(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Page, java.io.Writer, java.lang.Object)`.
      Throws:
        `java.io.IOException`
      See Also:
        `afterRenderHtml(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Page, java.io.Writer, java.lang.Object)`

    - #### afterRenderHtml

          public static void afterRenderHtml​(Execution exec,
                                             Page page,
                                             java.io.Writer out,
                                             java.lang.Object param)
                                      throws java.io.IOException

      Ends and cleans up the rendering of a complete ZHTML page.
      Parameters:
        `param` - the value returned by `beforeRenderHtml(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Page, java.io.Writer)`.
      Throws:
        `java.io.IOException`
      See Also:
        `beforeRenderHtml(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Page, java.io.Writer)`

    - #### beforeRenderTag

          public static java.lang.Object beforeRenderTag​(Execution exec)

      Prepares for rendering a ZHTML tag. After rendering, the caller shall also invoke `afterRenderTag(org.zkoss.zk.ui.Execution, java.lang.Object)`. Furthermore, the return value of this method shall be passed as the `param` argument of `afterRenderTag(org.zkoss.zk.ui.Execution, java.lang.Object)`.
      Returns:
        the result of this invocation. It shall be passed to the `param` argument of `afterRenderTag(org.zkoss.zk.ui.Execution, java.lang.Object)`.
      See Also:
        `afterRenderTag(org.zkoss.zk.ui.Execution, java.lang.Object)`

    - #### afterRenderTag

          public static void afterRenderTag​(Execution exec,
                                            java.lang.Object param)

      Ends and cleans up the rendering of a ZHTML tag.
      Parameters:
        `param` - the value returned by `beforeRenderHtml(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Page, java.io.Writer)`.

    - #### childrenToContent

          public static java.lang.String childrenToContent​(Component comp)

      Converts the children of the give component into a string-typed content, or null if no children at all.
      Throws:
        `UiException` - if some of the children is not ZHTML tags (i.e., not `AbstractTag`).
      Since:
        5.0.7