org.zkoss.zk.ui.sys
Class JSCumulativeContentRenderer

java.lang.Object
  extended by org.zkoss.zk.ui.sys.JSCumulativeContentRenderer
All Implemented Interfaces:
ContentRenderer

public class JSCumulativeContentRenderer
extends java.lang.Object
implements ContentRenderer

An implementation of ContentRenderer that renders the content as a JavaScript property (i.e., name: ['value', 'value1', ..]) cumulatively. It can support to add the same name with different value that the different value will be packed into a list.

Since:
8.0
Author:
jumperchen

Constructor Summary
JSCumulativeContentRenderer()
           
 
Method Summary
 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, java.util.Date value)
          Renders a Date property.
 void render(java.lang.String name, double value)
          Renders a double property.
 void render(java.lang.String name, float value)
          Renders a float 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, java.lang.Object value)
          Renders an arbitrary object property.
 void render(java.lang.String name, short value)
          Renders a short property.
 void render(java.lang.String name, java.lang.String value)
          Renders a string 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 value directly without encapsulation or conversion.
 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 client code snippet for event listeners registered for the peer widget.
 void renderWidgetOverrides(java.util.Map<java.lang.String,java.lang.String> overrides)
          Renders the client code snippet to override the methods and properties of the peer widget.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSCumulativeContentRenderer

public JSCumulativeContentRenderer()
Method Detail

render

public void render(java.lang.String name,
                   java.lang.String value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders a string property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   java.util.Date value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders a Date property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   java.lang.Object value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
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.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   int value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders an integer property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   short value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders a short property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   long value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders a long property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   byte value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders a byte property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   boolean value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders a boolean property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   double value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders a double property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   float value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders a float property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

render

public void render(java.lang.String name,
                   char value)
            throws java.io.IOException
Description copied from interface: ContentRenderer
Renders a char property.

Specified by:
render in interface ContentRenderer
Throws:
java.io.IOException

renderDirectly

public void renderDirectly(java.lang.String name,
                           java.lang.Object value)
Description copied from interface: ContentRenderer
Renders the value directly without encapsulation or conversion. It depends on the implementation. For JsContentRenderer, value must be a valid JavaScript snippet.

Specified by:
renderDirectly in interface ContentRenderer

renderWidgetListeners

public void renderWidgetListeners(java.util.Map<java.lang.String,java.lang.String> listeners)
Description copied from interface: ContentRenderer
Renders the client 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)
Description copied from interface: ContentRenderer
Renders the client code snippet to override the methods and properties of the peer widget.

Specified by:
renderWidgetOverrides in interface ContentRenderer
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}.

renderWidgetAttributes

public void renderWidgetAttributes(java.util.Map<java.lang.String,java.lang.String> attrs)
Specified by:
renderWidgetAttributes in interface ContentRenderer

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.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo