cookxml.core.taglibrary
Class InheritableTagLibrary

java.lang.Object
  extended bycookxml.core.taglibrary.SingleNSTagLibrary
      extended bycookxml.core.taglibrary.InheritableTagLibrary
All Implemented Interfaces:
TagLibrary

public class InheritableTagLibrary
extends SingleNSTagLibrary

This tag library class avoids the hassele of setting up all the things (adders and setters) for a tag. It suited perfectly for Swing in which most components inherit JComponent.

Since:
CookXml 1.0

Constructor Summary
InheritableTagLibrary()
          Construct a tag library that doesn't have a parent.
InheritableTagLibrary(TagLibrary parentTagLibrary)
          Construct a tag library with a parent.
 
Method Summary
 void addAdder(String tag, Adder adder)
          Instead of creating an adder that does it all, this function internally creates a compound adder that combine the functionalities of individual specialized adders.
 Adder getAdder(String ns, String tag)
          Get the Adder delegate associated with the namespace and tag.
 LinkedList getParentTags(String tag)
          Retrieve the direct parent tags.
 Setter getSetter(String ns, String tag, String attrNS, String attr)
          Get the Setter delegate associated with the namespace and tag.
 void inheritTag(String parentTag, String thisTag)
          create a tag inheritance.
 void inheritTag(String ns, String parentTag, String thisTag)
          Create a tag inheritance.
 
Methods inherited from class cookxml.core.taglibrary.SingleNSTagLibrary
getConverter, getCreator, getNameSpace, getSpecialCreator, setAdder, setConverter, setCreator, setNameSpace, setSetter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InheritableTagLibrary

public InheritableTagLibrary()
Construct a tag library that doesn't have a parent.


InheritableTagLibrary

public InheritableTagLibrary(TagLibrary parentTagLibrary)
Construct a tag library with a parent.

Method Detail

inheritTag

public void inheritTag(String ns,
                       String parentTag,
                       String thisTag)
Create a tag inheritance. Adder and setters are inherited.

Cycles must not exist!

Parameters:
ns - the optional namespace of the parent tag.
parentTag - the parent tag name
thisTag - the child tag name

inheritTag

public void inheritTag(String parentTag,
                       String thisTag)
create a tag inheritance. Adder and setters are inherited. Cycles must not exist!

Parameters:
parentTag - the parent tag name
thisTag - the child tag name

getSetter

public Setter getSetter(String ns,
                        String tag,
                        String attrNS,
                        String attr)
Description copied from interface: TagLibrary
Get the Setter delegate associated with the namespace and tag.

Specified by:
getSetter in interface TagLibrary
Overrides:
getSetter in class SingleNSTagLibrary

getAdder

public Adder getAdder(String ns,
                      String tag)
Description copied from interface: TagLibrary
Get the Adder delegate associated with the namespace and tag.

Specified by:
getAdder in interface TagLibrary
Overrides:
getAdder in class SingleNSTagLibrary

addAdder

public void addAdder(String tag,
                     Adder adder)
Instead of creating an adder that does it all, this function internally creates a compound adder that combine the functionalities of individual specialized adders. The adder added later has precedence over adders added earlier.

Parameters:
tag - the tag name.
adder - the individual Adder.

getParentTags

public LinkedList getParentTags(String tag)
Retrieve the direct parent tags. If the parent tag is in a different namespace, the entry will be in tag:ns format.

Parameters:
tag - the tag name
Returns:
direct parent tags