org.ujac.print
Class DefaultDocumentTagFactory

java.lang.Object
  extended by org.ujac.print.DefaultDocumentTagFactory
All Implemented Interfaces:
DocumentTagFactory

public class DefaultDocumentTagFactory
extends Object
implements DocumentTagFactory

Name: DefaultDocumentTagFactory
Description: Default document tag factory implementation.

Author:
lauerc

Constructor Summary
DefaultDocumentTagFactory()
          Constructs a DefaultDocumentTagFactory instance with no specific attributes.
 
Method Summary
 BaseDocumentTag createTagInstance(DocumentHandler documentHandler, String name)
          Gets a new tag instance for the given tag name.
 List getAllPossibleChilds()
          Gets all possible childs
static DocumentTagFactory getInstance()
          Gets the default tag factory.
 List getSupportedChildTags(BaseDocumentTag tag)
          Finds the supported child tags using the tag informations from the methods getSupportedChilds and getExcludedChilds.
 Map getTagTypes()
          Gets all registered tag types.
 boolean isTagSupported(String name)
          Checks wheter the given tag is supported or not.
protected  void registerDefaultTags()
          Registers the default document tags.
 void registerTag(String name, Class tagClazz)
          Registers the given document tag.
 void registerTag(String name, TagBuilder tagBuilder)
          Registers the given document tag.
 void registerTagAlias(String tagName, String alias)
          Registers an alias for the given document tag.
 void unregisterTag(String tagName)
          Unregisters the given document tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDocumentTagFactory

public DefaultDocumentTagFactory()
Constructs a DefaultDocumentTagFactory instance with no specific attributes.

Method Detail

getInstance

public static final DocumentTagFactory getInstance()
Gets the default tag factory.

Returns:
The default tag factory instance.

createTagInstance

public final BaseDocumentTag createTagInstance(DocumentHandler documentHandler,
                                               String name)
                                        throws TagInstantiationException
Gets a new tag instance for the given tag name.

Specified by:
createTagInstance in interface DocumentTagFactory
Parameters:
documentHandler - The document handler for which the item is created.
name - The tag name.
Returns:
The newly generated tag.
Throws:
TagInstantiationException - If the no tag type with the requested name is defined.

isTagSupported

public final boolean isTagSupported(String name)
Checks wheter the given tag is supported or not.

Specified by:
isTagSupported in interface DocumentTagFactory
Parameters:
name - The tag name to check.
Returns:
true if a build was found for the given tag name, else false.

registerTag

public final void registerTag(String name,
                              Class tagClazz)
Registers the given document tag.

Specified by:
registerTag in interface DocumentTagFactory
Parameters:
name - The name of the tag to register.
tagClazz - The tag class to register.

registerTag

public final void registerTag(String name,
                              TagBuilder tagBuilder)
Registers the given document tag.

Specified by:
registerTag in interface DocumentTagFactory
Parameters:
name - The name of the tag to register.
tagBuilder - The tag builder, which will build the tag handlers for the given name.

unregisterTag

public final void unregisterTag(String tagName)
Unregisters the given document tag.

Specified by:
unregisterTag in interface DocumentTagFactory
Parameters:
tagName - The name of the tag to unregister

registerTagAlias

public void registerTagAlias(String tagName,
                             String alias)
                      throws TagInstantiationException
Registers an alias for the given document tag.

Specified by:
registerTagAlias in interface DocumentTagFactory
Parameters:
tagName - The name of the tag to register the alias for.
alias - The name of the alias to register.
Throws:
TagInstantiationException - In case the original tag does not exist or has not been specified so far.

registerDefaultTags

protected void registerDefaultTags()
Registers the default document tags.


getTagTypes

public Map getTagTypes()
Gets all registered tag types.

Specified by:
getTagTypes in interface DocumentTagFactory
Returns:
A map containing all registered tag types.

getAllPossibleChilds

public List getAllPossibleChilds()
                          throws TagInstantiationException
Gets all possible childs

Specified by:
getAllPossibleChilds in interface DocumentTagFactory
Returns:
all possible childs.
Throws:
TagInstantiationException - In case the instantiation of a tag has been failed.

getSupportedChildTags

public List getSupportedChildTags(BaseDocumentTag tag)
                           throws TagInstantiationException
Finds the supported child tags using the tag informations from the methods getSupportedChilds and getExcludedChilds.

Specified by:
getSupportedChildTags in interface DocumentTagFactory
Parameters:
tag - The tag to find the childs for.
Returns:
The child definitions.
Throws:
TagInstantiationException - In case the method DefaultDocumentTagFactory.getAllPossibleChilds failed.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.