com.gwtext.client.core
Class Template

java.lang.Object
  extended by com.gwtext.client.core.JsObject
      extended by com.gwtext.client.core.Template

public class Template
extends JsObject

Represents an HTML fragment template. Templates can be precompiled for greater performance.

The list of available inbuild functions for use within templates are : 'capitalize', 'date', 'ellipsis', 'htmlDecode', 'htmlEncode', 'lowecase', 'stripTags', 'substr', 'trim', 'undef', 'uppercase', 'usMoney'.


Field Summary
 
Fields inherited from class com.gwtext.client.core.JsObject
jsObj
 
Constructor Summary
Template(com.google.gwt.core.client.JavaScriptObject jsObj)
           
Template(java.lang.String html)
          Create a new Template.
Template(java.lang.String[] htmlfrags)
          Create a new Template.
 
Method Summary
 java.lang.String applyTemplate(com.google.gwt.core.client.JavaScriptObject values)
           
 java.lang.String applyTemplate(NameValuePair[] values)
          Returns an HTML fragment of this template with the specified values applied.
 java.lang.String applyTemplate(java.lang.String[] 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.
 com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject htmlfrags)
           
 java.lang.String getHtml()
           
 void setDisableFormats(boolean disable)
          True to disable format functions (defaults to false).
 
Methods inherited from class com.gwtext.client.core.JsObject
getJsObj, getProperties, isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Template

public Template(java.lang.String html)
Create a new Template.

Parameters:
html - the HTML fragment

Template

public Template(com.google.gwt.core.client.JavaScriptObject jsObj)

Template

public Template(java.lang.String[] htmlfrags)
Create a new Template.

Parameters:
htmlfrags - the HTML fragments
Method Detail

getHtml

public java.lang.String getHtml()

create

public com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject htmlfrags)

setDisableFormats

public void setDisableFormats(boolean disable)
True to disable format functions (defaults to false).

Parameters:
disable - true to disable format functions

applyTemplate

public java.lang.String applyTemplate(java.lang.String[] values)
Returns an HTML fragment of this template with the specified values applied. Use this method when the params are numeric (i.e. {0})

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

applyTemplate

public java.lang.String applyTemplate(NameValuePair[] values)
Returns an HTML fragment of this template with the specified values applied. Use this method when the params are named (i.e. {foo})

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

applyTemplate

public java.lang.String applyTemplate(com.google.gwt.core.client.JavaScriptObject values)

compile

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