Interface ContentRenderer

All Known Implementing Classes:
JsContentRenderer, JSCumulativeContentRenderer, XmlContentRenderer

public interface ContentRenderer
Used with AbstractComponent.renderProperties(org.zkoss.zk.ui.sys.ContentRenderer) to generate the component content that will be sent to the client.
Since:
5.0.0
Author:
tomyeh
  • Method Details

    • render

      void render(String name, String value) throws IOException
      Renders a string property.
      Throws:
      IOException
    • render

      void render(String name, Date value) throws IOException
      Renders a Date property.
      Throws:
      IOException
    • render

      void render(String name, Object value) throws IOException
      Renders an arbitrary object property. What type of supported objects depends on the implementation. However, the following types are always supported: null, String, Date, the wrapper of primitives, an array of the above types, and a map of the above types.

      If the object is an instance of JSONAware, JSONAware.toJSONString() will be called, and the return will be generated directly. In other word, it is the same as renderDirectly(name, value.toJSONString()).

      If the value is not recognized, it will be converted to a string by use of Object.toString(). It the client's job to convert the string back to the correct object.

      Throws:
      IOException
    • render

      void render(String name, int value) throws IOException
      Renders an integer property.
      Throws:
      IOException
    • render

      void render(String name, short value) throws IOException
      Renders a short property.
      Throws:
      IOException
    • render

      void render(String name, long value) throws IOException
      Renders a long property.
      Throws:
      IOException
    • render

      void render(String name, byte value) throws IOException
      Renders a byte property.
      Throws:
      IOException
    • render

      void render(String name, boolean value) throws IOException
      Renders a boolean property.
      Throws:
      IOException
    • render

      void render(String name, double value) throws IOException
      Renders a double property.
      Throws:
      IOException
    • render

      void render(String name, float value) throws IOException
      Renders a float property.
      Throws:
      IOException
    • render

      void render(String name, char value) throws IOException
      Renders a char property.
      Throws:
      IOException
    • renderDirectly

      void renderDirectly(String name, Object value)
      Renders the value directly without encapsulation or conversion. It depends on the implementation. For JsContentRenderer, value must be a valid JavaScript snippet.
    • renderWidgetListeners

      void renderWidgetListeners(Map<String,String> listeners)
      Renders the client code snippet for event listeners registered for the peer widget.
      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

      void renderWidgetOverrides(Map<String,String> overrides)
      Renders the client code snippet to override the methods and properties of the peer widget.
      Parameters:
      overrides - the map of methods or properties to override the peer widget. The key is the method name (such as setValue), and the value must be a valid JavaScript snippet that can be evaluated to a value. They are both instances of String. For example, the map will be generated as follows by JsContentRenderer:
      {name1: value1, name2: value2}.
    • renderClientAttributes

      void renderClientAttributes(Map<String,String> attrs)
      Renders the client's DOM attributes for the peer widgets.
      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.
      Since:
      8.0.0