org.ajax4jsf.renderkit.compiler
Class HtmlCompiler

java.lang.Object
  extended by org.ajax4jsf.renderkit.compiler.HtmlCompiler

public class HtmlCompiler
extends java.lang.Object

Compiler for XML string or stream for creation of Renderer internal interpretator. Use Apache Digitester for parse .

Version:
$Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:48 $
Author:
asmirnov@exadel.com (latest modification by $Author: alexsmirnov $)

Field Summary
static java.lang.String ANY_PARENT
           
static java.lang.String ATTRIBUTE_TAG
           
static java.lang.String BREAK_TAG
           
static java.lang.String CALL_PARAM_TAG
           
static java.lang.String CALL_TAG
           
static java.lang.String CHILD_METHOD
           
static java.lang.String CHILD_PARAM_METHOD
           
static java.lang.String CHILD_TAG
           
static java.lang.String CHILDREN_TAG
           
static java.lang.String FACET_TAG
           
static java.lang.String IF_TAG
           
static java.lang.String IMPORT_RESOURCE_TAG
           
static java.lang.String NS_PREFIX
           
static java.lang.String NS_UTIL_PREFIX
           
static java.lang.String RESOURCE_TAG
           
static java.lang.String ROOT_TAG
           
static java.lang.String SELECTOR_TAG
           
static java.lang.String STYLE_TAG
           
static java.lang.String VALUE_CALL_TAG
           
static java.lang.String VERBATUM_TAG
           
 
Constructor Summary
HtmlCompiler()
          Constructor with initialisation.
 
Method Summary
 PreparedTemplate compile(java.io.InputStream input, java.lang.String sourcename)
          Compile input InputStream to PreparedTemplate - set of Java classes to encode as JSF output.
 PreparedTemplate compile(java.io.Reader input)
           
 PreparedTemplate compile(java.lang.String xml)
          Compile template for XML from simple string.
static PreparedTemplate compileResource(java.lang.Class base, java.lang.String resource)
          Compile XML from resource in classpath.
static PreparedTemplate compileResource(java.lang.String resource)
          Compile XML from resource in classpath.
 java.util.Map compileResources(java.lang.Class base, java.lang.String[] templates)
          Compile set of templates at time.
protected  void setCustomRules(org.apache.commons.digester.Digester digestr)
          Build custom rules for parse special tags and attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NS_PREFIX

public static final java.lang.String NS_PREFIX
See Also:
Constant Field Values

NS_UTIL_PREFIX

public static final java.lang.String NS_UTIL_PREFIX
See Also:
Constant Field Values

ROOT_TAG

public static final java.lang.String ROOT_TAG
See Also:
Constant Field Values

CALL_TAG

public static final java.lang.String CALL_TAG
See Also:
Constant Field Values

VALUE_CALL_TAG

public static final java.lang.String VALUE_CALL_TAG
See Also:
Constant Field Values

CALL_PARAM_TAG

public static final java.lang.String CALL_PARAM_TAG
See Also:
Constant Field Values

VERBATUM_TAG

public static final java.lang.String VERBATUM_TAG
See Also:
Constant Field Values

BREAK_TAG

public static final java.lang.String BREAK_TAG
See Also:
Constant Field Values

FACET_TAG

public static final java.lang.String FACET_TAG
See Also:
Constant Field Values

CHILDREN_TAG

public static final java.lang.String CHILDREN_TAG
See Also:
Constant Field Values

IF_TAG

public static final java.lang.String IF_TAG
See Also:
Constant Field Values

CHILD_TAG

public static final java.lang.String CHILD_TAG
See Also:
Constant Field Values

STYLE_TAG

public static final java.lang.String STYLE_TAG
See Also:
Constant Field Values

CHILD_METHOD

public static final java.lang.String CHILD_METHOD
See Also:
Constant Field Values

RESOURCE_TAG

public static final java.lang.String RESOURCE_TAG
See Also:
Constant Field Values

ATTRIBUTE_TAG

public static final java.lang.String ATTRIBUTE_TAG
See Also:
Constant Field Values

CHILD_PARAM_METHOD

public static final java.lang.String CHILD_PARAM_METHOD
See Also:
Constant Field Values

ANY_PARENT

public static final java.lang.String ANY_PARENT
See Also:
Constant Field Values

SELECTOR_TAG

public static final java.lang.String SELECTOR_TAG
See Also:
Constant Field Values

IMPORT_RESOURCE_TAG

public static final java.lang.String IMPORT_RESOURCE_TAG
See Also:
Constant Field Values
Constructor Detail

HtmlCompiler

public HtmlCompiler()
Constructor with initialisation.

Method Detail

setCustomRules

protected void setCustomRules(org.apache.commons.digester.Digester digestr)
Build custom rules for parse special tags and attributes. For most tags, value can be in next forms ( for resource, preffixed with f: ): Supported :

Parameters:
digestr -

compile

public PreparedTemplate compile(java.lang.String xml)
Compile template for XML from simple string.

Parameters:
xml - - String with template code
Returns:
compiled template, ready for rendering.

compileResources

public java.util.Map compileResources(java.lang.Class base,
                                      java.lang.String[] templates)
Compile set of templates at time. Templates gets from resources in classpath relative to base class. Used for initialisation set of templates in RendererBase subclasses constructor

Parameters:
base - - base class for resources paths
templates - - array with templates names.
Returns:
Map , with keys - templates name, value - compiled template.

compileResource

public static PreparedTemplate compileResource(java.lang.Class base,
                                               java.lang.String resource)
Compile XML from resource in classpath. Resource always readed as UTF-8 text , to avoid xml declarations.

Parameters:
base - - class of base object.
resource - - path to resource ( if not start with / , relative to base object )
Returns:
compiled XML, or Exception-generated stub, if parsing error occurs.

compileResource

public static PreparedTemplate compileResource(java.lang.String resource)
Compile XML from resource in classpath. Resource always readed as UTF-8 text , to avoid xml declarations.

Parameters:
resource - - absolute path to resource
Returns:
compiled XML, or Exception-generated stub, if parsing error occurs.

compile

public PreparedTemplate compile(java.io.Reader input)

compile

public PreparedTemplate compile(java.io.InputStream input,
                                java.lang.String sourcename)
Compile input InputStream to PreparedTemplate - set of Java classes to encode as JSF output.

Parameters:
input - stream with template XML text.
sourcename - ( optional ) name of resource, for debug purposes.
Returns:
compiled template.


Copyright © 2009. All Rights Reserved.