org.apache.shindig.gadgets.templates.tags
Class AbstractTagHandler

java.lang.Object
  extended by org.apache.shindig.gadgets.templates.tags.AbstractTagHandler
All Implemented Interfaces:
TagHandler
Direct Known Subclasses:
FlashTagHandler, HtmlTagHandler, IfTagHandler, RenderTagHandler, RepeatTagHandler, TemplateBasedTagHandler, VariableTagHandler

public abstract class AbstractTagHandler
extends Object
implements TagHandler

Abstract implementation of TagHandler, provides convenience methods for resolving values in context.


Field Summary
 
Fields inherited from interface org.apache.shindig.gadgets.templates.tags.TagHandler
OPENSOCIAL_NAMESPACE
 
Constructor Summary
AbstractTagHandler(String namespaceUri, String tagName)
          Create the tag handler instance.
 
Method Summary
protected  void appendTextNode(Node parent, String text)
          Create a text node with proper escaping.
 String getNamespaceUri()
           
 String getTagName()
           
protected
<T> T
getValueFromTag(Element tag, String name, TemplateProcessor processor, Class<T> type)
          Returns the value of a tag attribute, evaluating any contained EL expressions if necessary.
protected  DocumentFragment processChildren(Element tag, TemplateProcessor processor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.shindig.gadgets.templates.tags.TagHandler
process
 

Constructor Detail

AbstractTagHandler

public AbstractTagHandler(String namespaceUri,
                          String tagName)
Create the tag handler instance.

Parameters:
namespaceUri - the namespace of element this tag parses.
tagName - the local name of the element this tag parses.
Method Detail

getTagName

public String getTagName()
Specified by:
getTagName in interface TagHandler
Returns:
the local name of the element this tag parses.

getNamespaceUri

public String getNamespaceUri()
Specified by:
getNamespaceUri in interface TagHandler
Returns:
the namespace of the element this tag parses.

getValueFromTag

protected final <T> T getValueFromTag(Element tag,
                                      String name,
                                      TemplateProcessor processor,
                                      Class<T> type)
Returns the value of a tag attribute, evaluating any contained EL expressions if necessary.

Type Parameters:
T - the type of the value
Parameters:
tag - the element
name - the attribute name
processor - the template processor
type - the type of the value
Returns:
the value of the attribute, or null if the attribute is not present.

processChildren

protected final DocumentFragment processChildren(Element tag,
                                                 TemplateProcessor processor)

appendTextNode

protected final void appendTextNode(Node parent,
                                    String text)
Create a text node with proper escaping.



Copyright © 2007-2012. All Rights Reserved.