org.zkoss.zk.fn
Class ZkFns

java.lang.Object
  extended by org.zkoss.zk.fn.DspFns
      extended by org.zkoss.zk.fn.ZkFns

public class ZkFns
extends DspFns

Utilities for using EL.

Author:
tomyeh

Constructor Summary
protected ZkFns()
           
 
Method Summary
static java.io.Writer getCurrentOut()
          Returns the current writer to generate the output.
static java.util.List getStyleSheets(Execution exec)
          Returns a list of StyleSheet that shall be generated to the client for the specified execution.
static java.lang.String noCSSAttrs(java.lang.String attrs)
          Removes the class and style attributes from the specified one.
static java.lang.String outContentType(Page page)
          Returns the content type (never null).
static java.lang.String outCSSAttrs(java.lang.String attrs)
          Returns only the class and style attributes of the specified one.
static java.lang.String outDesktopInfo(Desktop desktop)
          Returns the desktop info to render a desktop.
static java.lang.String outDocType(Page page)
          Returns the doc type, or null if not available.
static java.lang.String outFirstLine(Page page)
          Returns the first line to be generated to the output, or null if no special first line.
static java.lang.String outHeaders(Page page)
          Deprecated. As of release 3.6.1, replaced with outHeaders(Page,boolean).
static java.lang.String outHeaders(Page page, boolean before)
          Returns the content of the specified condition that will be placed inside the header element of the specified page.
static java.lang.String outHtmlUnavailable(Page page)
          Generates the unavailable message in HTML tags, if any.
static java.lang.String outLangJavaScripts(java.lang.String dummy)
          Returns HTML tags to include all JavaScript files and codes that are required when loading a ZUML page.
static java.lang.String outLangStyleSheets()
          Returns HTML tags to include all style sheets that are defined in all languages.
static java.lang.String outPageAttrs(Page page)
          Returns the attributes to render a page.
static java.lang.String outResponseJavaScripts(java.util.Collection responses)
          Returns JavaScript for handling the specified response.
static java.lang.String outRootAttributes(Page page)
          Returns the content that will be generated as the attributes of the root element of the specified page.
static java.lang.String outZkHtmlTags()
          Generates and returns the ZK specific HTML tags for a desktop (never null).
static void redraw(Component comp, java.io.Writer out)
          Redraw the specified component into the specified out.
static java.lang.String toAbsoluteURI(java.lang.String uri)
          Converts the specified URI to absolute if not included by another page.
static java.lang.String toAbsoluteURI(java.lang.String uri, boolean skipInclude)
          Converts the specified URI to absolute if necessary.
 
Methods inherited from class org.zkoss.zk.fn.DspFns
outDeviceStyleSheets, outLocaleJavaScript, outZkHtmlTags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZkFns

protected ZkFns()
Method Detail

redraw

public static final void redraw(Component comp,
                                java.io.Writer out)
                         throws java.io.IOException
Redraw the specified component into the specified out.

Parameters:
comp - the component. If null, nothing happens
out - the output. If null, the current output will be used.
Throws:
java.io.IOException

getCurrentOut

public static final java.io.Writer getCurrentOut()
                                          throws java.io.IOException
Returns the current writer to generate the output.

Throws:
java.io.IOException
Since:
3.0.0

outResponseJavaScripts

public static final java.lang.String outResponseJavaScripts(java.util.Collection responses)
Returns JavaScript for handling the specified response.


outLangJavaScripts

public static final java.lang.String outLangJavaScripts(java.lang.String dummy)
Returns HTML tags to include all JavaScript files and codes that are required when loading a ZUML page.

Note: it assumes Executions.getCurrent() is available.

FUTURE CONSIDERATION: we might generate the inclusion on demand instead of all at once.

Parameters:
dummy - ignored since 3.0.6 (reserved for backward compatibility)

outHtmlUnavailable

public static java.lang.String outHtmlUnavailable(Page page)
Generates the unavailable message in HTML tags, if any.

Since:
3.5.2

outLangStyleSheets

public static final java.lang.String outLangStyleSheets()
Returns HTML tags to include all style sheets that are defined in all languages.

Note: it assumes Executions.getCurrent() is available.

In addition to style sheets defined in lang.xml and lang-addon.xml, it also include:

  1. The style sheet specified in the theme-uri parameter.

FUTURE CONSIDERATION: we might generate the inclusion on demand instead of all at once.


getStyleSheets

public static final java.util.List getStyleSheets(Execution exec)
Returns a list of StyleSheet that shall be generated to the client for the specified execution.


toAbsoluteURI

public static java.lang.String toAbsoluteURI(java.lang.String uri,
                                             boolean skipInclude)
Converts the specified URI to absolute if necessary. Refer to Execution.toAbsoluteURI(java.lang.String, boolean).

Parameters:
skipInclude - whether not to convert to an absolute URI if the current page is included by another page. When use the include directive, skipInclude shall be true.

toAbsoluteURI

public static java.lang.String toAbsoluteURI(java.lang.String uri)
Converts the specified URI to absolute if not included by another page. It is a shortcut of toAbsoluteURI(String, boolean) with skipInclude is true.


outHeaders

public static final java.lang.String outHeaders(Page page,
                                                boolean before)
Returns the content of the specified condition that will be placed inside the header element of the specified page. For HTML, the header element is the HEAD element.

Parameters:
before - whether to return the headers that shall be shown before ZK's CSS/JS headers. If true, only the headers that shall be shown before (such as meta) are returned. If true, only the headers that shall be shown after (such as link) are returned.
Since:
3.6.1

outHeaders

public static final java.lang.String outHeaders(Page page)
Deprecated. As of release 3.6.1, replaced with outHeaders(Page,boolean).


outRootAttributes

public static final java.lang.String outRootAttributes(Page page)
Returns the content that will be generated as the attributes of the root element of the specified page. For HTML, the root element is the HTML element.


outContentType

public static final java.lang.String outContentType(Page page)
Returns the content type (never null).

Since:
3.0.0

outDocType

public static final java.lang.String outDocType(Page page)
Returns the doc type, or null if not available. It is null or <!DOCTYPE ...>.

Since:
3.0.0

outFirstLine

public static final java.lang.String outFirstLine(Page page)
Returns the first line to be generated to the output, or null if no special first line.


outPageAttrs

public static final java.lang.String outPageAttrs(Page page)
Returns the attributes to render a page. Used only in HTML devices.

Since:
3.0.6

outDesktopInfo

public static final java.lang.String outDesktopInfo(Desktop desktop)
Returns the desktop info to render a desktop. It must be called if outPageAttrs(org.zkoss.zk.ui.Page) might not be called. On the other hand, outDesktopInfo(org.zkoss.zk.ui.Desktop) does nothing if outPageAttrs(org.zkoss.zk.ui.Page) was called.

It is OK to call both outPageAttrs(org.zkoss.zk.ui.Page) and outDesktopInfo(org.zkoss.zk.ui.Desktop).

Since:
3.5.0.

outZkHtmlTags

public static java.lang.String outZkHtmlTags()
Generates and returns the ZK specific HTML tags for a desktop (never null).

For each desktop, we have to generate a set of HTML tags to load ZK Client engine, style sheets and so on. For ZUL pages, it is generated automatically by page.dsp. However, for ZHTML pages, we have to generate these tags with special component such as org.zkoss.zhtml.Head, such that the result HTML page is legal.

Returns:
the string holding the HTML tags, or an empty string if already generated.
Since:
3.5.0

noCSSAttrs

public static final java.lang.String noCSSAttrs(java.lang.String attrs)
Removes the class and style attributes from the specified one.

For example, if attrs is href="a" class="c", then the output will be href="a"

Parameters:
attrs - the attributes to filter
Since:
3.5.0

outCSSAttrs

public static final java.lang.String outCSSAttrs(java.lang.String attrs)
Returns only the class and style attributes of the specified one.

For example, if attrs is href="a" class="c", then the output will be class="c"

Parameters:
attrs - the attributes to filter
Since:
3.5.0


Copyright &copy; 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo