Package org.zkoss.zkplus.liferay
Class JQueryRenderPatch
- java.lang.Object
-
- org.zkoss.zkplus.liferay.JQueryRenderPatch
-
- All Implemented Interfaces:
PageRenderPatch
- Direct Known Subclasses:
JQueryRenderCachedPatch,NonRootContextJQueryRenderPatch
public class JQueryRenderPatch extends java.lang.Object implements PageRenderPatch
Used to patch the rendering result of a ZK portlet for Liferay. When using ZK portlets with Liferay under Internet Explorer, we have to delay the processing at the client a bit.To use it, you have to specify a library property called ""org.zkoss.zk.portlet.PageRenderPatch.class" with this class's name ("org.zkoss.zkplus.liferay.JQueryRenderPatch").
You can further control the behavior of this patch by use of a library property called "org.zkoss.zkplus.liferary.jQueryPatch" (refer to
JQUERY_PATCHfor details).- Since:
- 5.0.0
- Author:
- tomyeh, sam
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringJQUERY_PATCHA library property to indicate how to apply the so-called jQuery patch.
-
Constructor Summary
Constructors Constructor Description JQueryRenderPatch()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.WriterbeforeRender(RequestInfo reqInfo)It returns an instance of StringWriter ifgetDelay()is non-negative, or null if negative (means no patch).protected java.lang.StringgetBrowserDelay()intgetDelay()Returns the number of milliseconds to wait before replacing with the correct content.voidpatchRender(RequestInfo reqInfo, Page page, java.io.Writer result, java.io.Writer out)Called after rendering to patch the result.protected java.lang.String[]processHtml(java.lang.String html)voidsetDelay(int delay)Sets the number of milliseconds to wait before replacing with the correct content.
-
-
-
Field Detail
-
JQUERY_PATCH
public static final java.lang.String JQUERY_PATCH
A library property to indicate how to apply the so-called jQuery patch.Default: "500" (it means 500 milliseconds)
You can specify a number to indicate how many milliseconds to wait before replacing with the correct content. If negative, the patch is ignored.
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDelay
public int getDelay()
Returns the number of milliseconds to wait before replacing with the correct content.Default: depends on the value defined in the
JQUERY_PATCHlibrary property.
-
setDelay
public void setDelay(int delay)
Sets the number of milliseconds to wait before replacing with the correct content.- See Also:
JQUERY_PATCH
-
beforeRender
public java.io.Writer beforeRender(RequestInfo reqInfo)
It returns an instance of StringWriter ifgetDelay()is non-negative, or null if negative (means no patch).- Specified by:
beforeRenderin interfacePageRenderPatch- Parameters:
reqInfo- the request information- Returns:
- null if no need of patch, or a writer if the patch is required.
The writer will be used to hold the rendering result of the portlet.
Thus, you can process it later in
PageRenderPatch.patchRender(org.zkoss.zk.ui.sys.RequestInfo, org.zkoss.zk.ui.Page, java.io.Writer, java.io.Writer)(so the writer is usually an instance of StringWriter).
-
patchRender
public void patchRender(RequestInfo reqInfo, Page page, java.io.Writer result, java.io.Writer out) throws java.io.IOException
Description copied from interface:PageRenderPatchCalled after rendering to patch the result. IfPageRenderPatch.beforeRender(org.zkoss.zk.ui.sys.RequestInfo)returns null, this method won't be called since nothing to patch.If
PageRenderPatch.beforeRender(org.zkoss.zk.ui.sys.RequestInfo)returns a writer, the writer will become the result argument.- Specified by:
patchRenderin interfacePageRenderPatch- Parameters:
reqInfo- the request informationresult- the result returned byPageRenderPatch.beforeRender(org.zkoss.zk.ui.sys.RequestInfo), and the rendering result of a page will be written to it.out- the real output sent to the client. It is the writer to write the patched result to.- Throws:
java.io.IOException
-
getBrowserDelay
protected java.lang.String getBrowserDelay()
-
processHtml
protected java.lang.String[] processHtml(java.lang.String html)
-
-