Package org.zkoss.zk.ui.sys

## Class JsContentRenderer

- java.lang.Object
- - org.zkoss.zk.ui.sys.JsContentRenderer

- All Implemented Interfaces:
    `ContentRenderer`

      public class JsContentRenderer
      extends java.lang.Object
      implements ContentRenderer

  An implementation of `ContentRenderer` that renders the content as a JavaScript property (i.e., name: 'value').
  Since:
    5.0.0
  Author:
    tomyeh

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.CharSequence` | `getBuffer()` | Returns the content being rendered.
    `void` | `render​(java.lang.String name, boolean value)` | Renders a boolean property.
    `void` | `render​(java.lang.String name, byte value)` | Renders a byte property.
    `void` | `render​(java.lang.String name, char value)` | Renders a char property.
    `void` | `render​(java.lang.String name, double value)` | Renders a double property.
    `void` | `render​(java.lang.String name, float value)` | Renders a double property.
    `void` | `render​(java.lang.String name, int value)` | Renders an integer property.
    `void` | `render​(java.lang.String name, long value)` | Renders a long property.
    `void` | `render​(java.lang.String name, short value)` | Renders a short property.
    `void` | `render​(java.lang.String name, java.lang.Object value)` | Renders an arbitrary object.
    `void` | `render​(java.lang.String name, java.lang.String value)` | Renders a string property.
    `void` | `render​(java.lang.String name, java.util.Date value)` | Renders a Date property.
    `void` | `renderClientAttributes​(java.util.Map<java.lang.String,​java.lang.String> attrs)` | Renders the client's DOM attributes for the peer widgets.
    `void` | `renderDirectly​(java.lang.String name, java.lang.Object value)` | Renders the JavaScript code snippet.
    `void` | `renderWidgetAttributes​(java.util.Map<java.lang.String,​java.lang.String> attrs)` |
    `void` | `renderWidgetListeners​(java.util.Map<java.lang.String,​java.lang.String> listeners)` | Renders the JavaScript code snippet for event listeners registered for the peer widget.
    `void` | `renderWidgetOverrides​(java.util.Map<java.lang.String,​java.lang.String> overrides)` | Renders the JavaScript codes snippet to override the methods and properties of the peer widget.

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

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

- - ### Constructor Detail

    - #### JsContentRenderer

          public JsContentRenderer()

  - ### Method Detail

    - #### getBuffer

          public java.lang.CharSequence getBuffer()

      Returns the content being rendered.

    - #### render

          public void render​(java.lang.String name,
                             java.lang.String value)

      Renders a string property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### render

          public void render​(java.lang.String name,
                             java.util.Date value)

      Renders a Date property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### render

          public void render​(java.lang.String name,
                             java.lang.Object value)

      Renders an arbitrary object.
      Specified by:
        `render` in interface `ContentRenderer`

    - #### render

          public void render​(java.lang.String name,
                             int value)

      Renders an integer property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### render

          public void render​(java.lang.String name,
                             long value)

      Renders a long property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### render

          public void render​(java.lang.String name,
                             short value)

      Renders a short property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### render

          public void render​(java.lang.String name,
                             byte value)

      Renders a byte property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### render

          public void render​(java.lang.String name,
                             boolean value)

      Renders a boolean property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### render

          public void render​(java.lang.String name,
                             double value)

      Renders a double property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### render

          public void render​(java.lang.String name,
                             float value)

      Renders a double property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### render

          public void render​(java.lang.String name,
                             char value)

      Renders a char property.
      Specified by:
        `render` in interface `ContentRenderer`
      Parameters:
        `name` - the property name. Note: it must be a legal JavaScript variable name.

    - #### renderDirectly

          public void renderDirectly​(java.lang.String name,
                                     java.lang.Object value)

      Renders the JavaScript code snippet.
      Specified by:
        `renderDirectly` in interface `ContentRenderer`

    - #### renderWidgetListeners

          public void renderWidgetListeners​(java.util.Map<java.lang.String,​java.lang.String> listeners)

      Renders the JavaScript code snippet for event listeners registered for the peer widget.
      Specified by:
        `renderWidgetListeners` in interface `ContentRenderer`
      Parameters:
        `listeners` - the map of listeners to register at the peer widget. The key is the event name (such as onClick), and the value the code snippet (such as `this.getFellow('inf').setValue('new')`). They are both String instances.

    - #### renderWidgetOverrides

          public void renderWidgetOverrides​(java.util.Map<java.lang.String,​java.lang.String> overrides)

      Renders the JavaScript codes snippet to override the methods and properties of the peer widget. This method uses the widget's setOverrides method (at client), so, if the value is a method, it will preserve the previous method as '$' + method_name
      Specified by:
        `renderWidgetOverrides` in interface `ContentRenderer`
      Parameters:
        `overrides` - a map of methods and properties. Notice that the value must be a valid JavaScript snippet that can be evaluated to a value. In fact, the map will be generated as follows.
        `{name1: value1, name2: value2}`. Examples of values: `function () {}`, `123`, `new Date()`, and `"a literal string"`

    - #### renderWidgetAttributes

          public void renderWidgetAttributes​(java.util.Map<java.lang.String,​java.lang.String> attrs)

    - #### renderClientAttributes

          public void renderClientAttributes​(java.util.Map<java.lang.String,​java.lang.String> attrs)

      Description copied from interface: `ContentRenderer`
      Renders the client's DOM attributes for the peer widgets.
      Specified by:
        `renderClientAttributes` in interface `ContentRenderer`
      Parameters:
        `attrs` - the map of attributes. The key is the attribute's name, while the value is the attribute's value. They are both instances of String.