Package org.zkoss.stateless.ui.util
Class StatelessContentRenderer<I extends IComponent>
- java.lang.Object
-
- org.zkoss.stateless.ui.util.StatelessContentRenderer<I>
-
- All Implemented Interfaces:
ContentRenderer
public class StatelessContentRenderer<I extends IComponent> extends java.lang.Object implements ContentRenderer
A renderer context to wrap ZK ContentRenderer with Stateless runtime meta.- Author:
- jumperchen
-
-
Constructor Summary
Constructors Constructor Description StatelessContentRenderer(ContentRenderer delegator, I owner, IStubComponent zkComp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IStubComponent
getBinding()
I
getOwner()
void
render(java.lang.String s, boolean b)
Renders a boolean property.void
render(java.lang.String s, byte b)
Renders a byte property.void
render(java.lang.String s, char c)
Renders a char property.void
render(java.lang.String s, double v)
Renders a double property.void
render(java.lang.String s, float v)
Renders a float property.void
render(java.lang.String s, int i)
Renders an integer property.void
render(java.lang.String s, long l)
Renders a long property.void
render(java.lang.String s, short i)
Renders a short property.void
render(java.lang.String s, java.lang.Object o)
Renders an arbitrary object property.void
render(java.lang.String s, java.lang.String s1)
Renders a string property.void
render(java.lang.String s, java.util.Date date)
Renders a Date property.void
renderClientAttributes(java.util.Map<java.lang.String,java.lang.String> map)
Renders the client's DOM attributes for the peer widgets.void
renderDirectly(java.lang.String s, java.lang.Object o)
Renders the value directly without encapsulation or conversion.void
renderWidgetListeners(java.util.Map<java.lang.String,java.lang.String> map)
Renders the client code snippet for event listeners registered for the peer widget.void
renderWidgetOverrides(java.util.Map<java.lang.String,java.lang.String> map)
Renders the client code snippet to override the methods and properties of the peer widget.
-
-
-
Constructor Detail
-
StatelessContentRenderer
public StatelessContentRenderer(ContentRenderer delegator, I owner, IStubComponent zkComp)
-
-
Method Detail
-
getOwner
public I getOwner()
-
getBinding
public IStubComponent getBinding()
-
render
public void render(java.lang.String s, java.lang.String s1) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders a string property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, java.util.Date date) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders a Date property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, java.lang.Object o) 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 asrenderDirectly(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 interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, int i) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders an integer property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, short i) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders a short property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, long l) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders a long property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, byte b) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders a byte property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, boolean b) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders a boolean property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, double v) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders a double property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, float v) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders a float property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
render
public void render(java.lang.String s, char c) throws java.io.IOException
Description copied from interface:ContentRenderer
Renders a char property.- Specified by:
render
in interfaceContentRenderer
- Throws:
java.io.IOException
-
renderDirectly
public void renderDirectly(java.lang.String s, java.lang.Object o)
Description copied from interface:ContentRenderer
Renders the value directly without encapsulation or conversion. It depends on the implementation. ForJsContentRenderer
, value must be a valid JavaScript snippet.- Specified by:
renderDirectly
in interfaceContentRenderer
-
renderWidgetListeners
public void renderWidgetListeners(java.util.Map<java.lang.String,java.lang.String> map)
Description copied from interface:ContentRenderer
Renders the client code snippet for event listeners registered for the peer widget.- Specified by:
renderWidgetListeners
in interfaceContentRenderer
- Parameters:
map
- 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 asthis.getFellow('inf').setValue('new')
). They are both String instances.
-
renderWidgetOverrides
public void renderWidgetOverrides(java.util.Map<java.lang.String,java.lang.String> map)
Description copied from interface:ContentRenderer
Renders the client code snippet to override the methods and properties of the peer widget.- Specified by:
renderWidgetOverrides
in interfaceContentRenderer
- Parameters:
map
- 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 byJsContentRenderer
:
{name1: value1, name2: value2}
.
-
renderClientAttributes
public void renderClientAttributes(java.util.Map<java.lang.String,java.lang.String> map)
Description copied from interface:ContentRenderer
Renders the client's DOM attributes for the peer widgets.- Specified by:
renderClientAttributes
in interfaceContentRenderer
- Parameters:
map
- 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.
-
-