GWT 2.1.1

com.google.gwt.safehtml.client
Interface SafeHtmlTemplates


public interface SafeHtmlTemplates

A tag interface that facilitates compile-time binding of HTML templates to generate SafeHtml strings.

Example usage:

   public interface MyTemplate extends SafeHtmlTemplates {
     @Template("<span class=\"{3}\">{0}: <a href=\"{1}\">{2}</a></span>")
     SafeHtml messageWithLink(SafeHtml message, String url, String linkText,
       String style);
   }

   private static final MyTemplate TEMPLATE = GWT.create(MyTemplate.class);

   public void useTemplate(...) {
     SafeHtml message;
     String url;
     String linkText;
     String style;
     // ...
     SafeHtml messageWithLink =
       TEMPLATE.messageWithLink(message, url, linkText, style);
   }
 
Instantiating a SafeHtmlTemplates interface with GWT.create() returns an instance of an implementation that is generated at compile time. The code generator parses the value of each template method's @Template annotation as a (X)HTML template, with template variables denoted by curly-brace placeholders that refer by index to the corresponding template method parameter.


Nested Class Summary
static interface SafeHtmlTemplates.Template
          The HTML template.
 


GWT 2.1.1