com.extjs.gxt.ui.client.core
Class XTemplate

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.extjs.gxt.ui.client.core.XTemplate

public final class XTemplate
extends com.google.gwt.core.client.JavaScriptObject

A template class that supports advanced functionality like:

Usage


Constructor Summary
protected XTemplate()
           
 
Method Summary
 com.google.gwt.user.client.Element append(com.google.gwt.user.client.Element elem, com.google.gwt.core.client.JavaScriptObject values)
           
 java.lang.String applyTemplate(com.google.gwt.core.client.JavaScriptObject values)
          Returns an HTML fragment of this template with the specified values applied.
 void compile()
          Compiles the template into an internal function, eliminating the regex overhead.
static XTemplate create(java.lang.String html)
          Returns a new template instance using the given html.
 int getMaxDepth()
          Returns the maximum number of nested children to process when preparing the template's data.
 void insertAfter(com.google.gwt.user.client.Element elem, com.google.gwt.core.client.JavaScriptObject values)
          Applies the supplied values to the template and inserts the new node(s) after elem.
 void insertBefore(com.google.gwt.user.client.Element elem, com.google.gwt.core.client.JavaScriptObject values)
          Applies the supplied values to the template and inserts the new node(s) before elem.
 void overwrite(com.google.gwt.user.client.Element elem, com.google.gwt.core.client.JavaScriptObject values)
          Applies the supplied values to the template and overwrites the content of elem with the new node(s).
 void setMaxDepth(int maxDepth)
          Specifies the maximum number of nested models to search when preparing the templates data (defaults to 4).
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XTemplate

protected XTemplate()
Method Detail

setMaxDepth

public final void setMaxDepth(int maxDepth)
Specifies the maximum number of nested models to search when preparing the templates data (defaults to 4).

Parameters:
maxDepth - the maximum number of nested children

getMaxDepth

public final int getMaxDepth()
Returns the maximum number of nested children to process when preparing the template's data.

Returns:
the max depth

create

public static XTemplate create(java.lang.String html)
Returns a new template instance using the given html.

Parameters:
html - the template
Returns:
a new template instance

append

public final com.google.gwt.user.client.Element append(com.google.gwt.user.client.Element elem,
                                                       com.google.gwt.core.client.JavaScriptObject values)

applyTemplate

public final java.lang.String applyTemplate(com.google.gwt.core.client.JavaScriptObject values)
Returns an HTML fragment of this template with the specified values applied.

Parameters:
values - the substitution values
Returns:
the html fragment

compile

public final void compile()
Compiles the template into an internal function, eliminating the regex overhead.


insertAfter

public final void insertAfter(com.google.gwt.user.client.Element elem,
                              com.google.gwt.core.client.JavaScriptObject values)
Applies the supplied values to the template and inserts the new node(s) after elem.

Parameters:
elem - the context element
values - the substitution values

insertBefore

public final void insertBefore(com.google.gwt.user.client.Element elem,
                               com.google.gwt.core.client.JavaScriptObject values)
Applies the supplied values to the template and inserts the new node(s) before elem.

Parameters:
elem - the context element
values - the substitution values

overwrite

public final void overwrite(com.google.gwt.user.client.Element elem,
                            com.google.gwt.core.client.JavaScriptObject values)
Applies the supplied values to the template and overwrites the content of elem with the new node(s).

Parameters:
elem - the context element
values - the substitution values