org.apache.shindig.gadgets.templates
Class XmlTemplateLibrary

java.lang.Object
  extended by org.apache.shindig.gadgets.templates.XmlTemplateLibrary
All Implemented Interfaces:
TemplateLibrary

public class XmlTemplateLibrary
extends Object
implements TemplateLibrary

An Object representing a Library of Template-based custom OSML tags.


Field Summary
static String JAVASCRIPT_TAG
           
static String NAMESPACE_TAG
           
static String STYLE_TAG
           
static String TAG_ATTRIBUTE
           
static String TEMPLATE_TAG
           
static String TEMPLATEDEF_TAG
           
 
Constructor Summary
XmlTemplateLibrary(Uri uri, Element root, String source)
           
XmlTemplateLibrary(Uri uri, Element root, String source, boolean safe)
           
 
Method Summary
protected  TagHandler createTagHandler(Element template, String namespaceUri, String localName)
          Creates a tag handler wrapping an element.
 Uri getLibraryUri()
           
 TagRegistry getTagRegistry()
           
 boolean isSafe()
           
 String serialize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_ATTRIBUTE

public static final String TAG_ATTRIBUTE
See Also:
Constant Field Values

NAMESPACE_TAG

public static final String NAMESPACE_TAG
See Also:
Constant Field Values

TEMPLATE_TAG

public static final String TEMPLATE_TAG
See Also:
Constant Field Values

STYLE_TAG

public static final String STYLE_TAG
See Also:
Constant Field Values

JAVASCRIPT_TAG

public static final String JAVASCRIPT_TAG
See Also:
Constant Field Values

TEMPLATEDEF_TAG

public static final String TEMPLATEDEF_TAG
See Also:
Constant Field Values
Constructor Detail

XmlTemplateLibrary

public XmlTemplateLibrary(Uri uri,
                          Element root,
                          String source)
                   throws GadgetException
Parameters:
uri - URI of the template library
root - Element representing the Templates tag of this library
Throws:
GadgetException

XmlTemplateLibrary

public XmlTemplateLibrary(Uri uri,
                          Element root,
                          String source,
                          boolean safe)
                   throws GadgetException
Parameters:
uri - URI of the template library
root - Element representing the Templates tag of this library
safe - Is this library exempt from being sanitized?
Throws:
GadgetException
Method Detail

getTagRegistry

public TagRegistry getTagRegistry()
Specified by:
getTagRegistry in interface TemplateLibrary
Returns:
a registry of tags in this library.

getLibraryUri

public Uri getLibraryUri()
Specified by:
getLibraryUri in interface TemplateLibrary
Returns:
the URI from which the library was loaded. (This is not the namespace of tags in the library.)

isSafe

public boolean isSafe()
Specified by:
isSafe in interface TemplateLibrary
Returns:
this library is safe and its content doesn't need to be sanitized.

serialize

public String serialize()
Specified by:
serialize in interface TemplateLibrary
Returns:
This library as XML source.

createTagHandler

protected TagHandler createTagHandler(Element template,
                                      String namespaceUri,
                                      String localName)
Creates a tag handler wrapping an element. By default, creates a TemplateBasedTagHandler. Override this to create custom tag handlers.



Copyright © 2007-2012. All Rights Reserved.