com.plumtree.portaluiinfrastructure.tags.displaytree
Class TagDisplayElement

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.tags.displaytree.TagDisplayElement
All Implemented Interfaces:
IDisplayElement

public class TagDisplayElement
extends java.lang.Object
implements IDisplayElement

This class displays a Tag. On construction, it merely stores the Tag data, and waits until execution time to create the tag. This is a framework only class and should not be used by external developers.

Author:
donh

Field Summary
static java.lang.String DEFAULT_TAG_LIB_NAME
          This is the default tag library name used when a tag does not specify a library name.
static char LIBRARY_SEPARATOR
          This is the separator used between library and tag names.
protected  CompositeDisplayElement m_ChildElements
           
protected  java.lang.Object[][] m_ObjXML
           
protected  CompositeDisplayElement m_ParentContainer
           
protected  java.lang.String m_strErrorMessage
           
protected  java.lang.String m_strLibraryName
           
protected  java.lang.String m_strTagName
           
protected  ATag m_Tag
           
 
Constructor Summary
TagDisplayElement(java.lang.Object[][] _objXML, CompositeDisplayElement _parentContainer)
          Construct the Display Element, but do not construct the Tag until it is actually required.
 
Method Summary
protected  void CalculateTagName()
          This calculates the tag and library name, if they have not already been calculated.
protected  void CleanupTag(TagVisitor _tagVisitor)
          This cleans up the tag to make sure it is in the proper state.
 HTMLElement Display(TagVisitor _tagVisitor)
          Displays this element and it's child elements and returns the result.
protected  HTMLElement DisplayAsHTML(TagVisitor _tagVisitor)
          Output the current tag as HTML.
 CompositeDisplayElement GetChildElements(CompositeDisplayElement _parent)
          This returns a CompositeDisplayElement to be used to contain the children of this tag.
protected  HTMLElement GetEndComment()
          Generate the end comment for debug mode.
protected  HTMLElement GetStartComment()
          Generate the start comment for debug mode.
 java.lang.String GetTagLibraryName()
          This method gets the name of the library for this tag.
 java.lang.String GetTagName()
          This method gets the name of this tag.
 boolean HasChildElements(ITagMetaData[] _childTags, java.lang.Object[] _results, TagLibraryMetaData _library, int _nCurrentDepth)
          This method searches for child tags of the current tag and fills in the results array with an Object if the tag has been found.
 boolean HasChildTags(ITagMetaData[] _childTags, java.lang.Object[] _results, TagLibraryMetaData _library, int _nCurrentDepth)
          This method checks if the current tag has the requested tags as child tags.
 int HasParentElement(ITagMetaData _parentTag, TagLibraryMetaData _library)
          This method searches for a parent tag of the current tag.
 int HasParentTag(ITagMetaData _parentTag, TagLibraryMetaData _library)
          This method checks if the current tag has the requested tag as a parent tag.
protected  void InitializeTag(TagVisitor _tagVisitor)
          This initializes the Tag with the data it needs to execute.
 void Release()
          This method is called to release any data that needs special handling before being allowed to go out of scope.
 void SetErrorMessage(java.lang.String _strError)
          This method sets an error to be displayed in an HTML Comment before the tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TAG_LIB_NAME

public static final java.lang.String DEFAULT_TAG_LIB_NAME
This is the default tag library name used when a tag does not specify a library name. This library is used for the legacy 5.0 Transformer Tags.

See Also:
Constant Field Values

LIBRARY_SEPARATOR

public static final char LIBRARY_SEPARATOR
This is the separator used between library and tag names.

See Also:
Constant Field Values

m_ObjXML

protected java.lang.Object[][] m_ObjXML

m_Tag

protected ATag m_Tag

m_strTagName

protected java.lang.String m_strTagName

m_strLibraryName

protected java.lang.String m_strLibraryName

m_ParentContainer

protected CompositeDisplayElement m_ParentContainer

m_ChildElements

protected CompositeDisplayElement m_ChildElements

m_strErrorMessage

protected java.lang.String m_strErrorMessage
Constructor Detail

TagDisplayElement

public TagDisplayElement(java.lang.Object[][] _objXML,
                         CompositeDisplayElement _parentContainer)
Construct the Display Element, but do not construct the Tag until it is actually required.

Parameters:
Object[][] - _ObjXML The tag data.
CompositeDisplayElement - The parent container element that this tag element is stored in.
Method Detail

Display

public HTMLElement Display(TagVisitor _tagVisitor)
Description copied from interface: IDisplayElement
Displays this element and it's child elements and returns the result.

Specified by:
Display in interface IDisplayElement
Returns:
HTMLElement The result of displaying this element
See Also:
IDisplayElement.Display(TagVisitor)

Release

public void Release()
Description copied from interface: IDisplayElement
This method is called to release any data that needs special handling before being allowed to go out of scope.

Specified by:
Release in interface IDisplayElement
See Also:
IDisplayElement.Release()

CalculateTagName

protected void CalculateTagName()
This calculates the tag and library name, if they have not already been calculated.


InitializeTag

protected void InitializeTag(TagVisitor _tagVisitor)
This initializes the Tag with the data it needs to execute.

Parameters:
_tagVisitor - The Tag Visitor object

CleanupTag

protected void CleanupTag(TagVisitor _tagVisitor)
This cleans up the tag to make sure it is in the proper state.


GetChildElements

public CompositeDisplayElement GetChildElements(CompositeDisplayElement _parent)
This returns a CompositeDisplayElement to be used to contain the children of this tag.

Parameters:
_parent - The parent of the current tag
Returns:
CompositeDisplayElement Container for the child elements of this Tag.

GetStartComment

protected HTMLElement GetStartComment()
Generate the start comment for debug mode.

Returns:
HTMLElement The start comment for debug mode

GetEndComment

protected HTMLElement GetEndComment()
Generate the end comment for debug mode.

Returns:
HTMLElement The end comment for debug mode

HasChildElements

public boolean HasChildElements(ITagMetaData[] _childTags,
                                java.lang.Object[] _results,
                                TagLibraryMetaData _library,
                                int _nCurrentDepth)
Description copied from interface: IDisplayElement
This method searches for child tags of the current tag and fills in the results array with an Object if the tag has been found. This method will not work if _results is not an array of null objects of the same length as _childTags.

Specified by:
HasChildElements in interface IDisplayElement
Parameters:
_childTags - An array of ITagMetaData objects for each child tag to search for.
_results - An array of null Objects. On execution, when a child tag is found, the location in the _results array that corresponds to the location of the tag in the _ChildTags array will be filled in with an Integer containing the positive depth of the child tag.
_library - The Tag Library of the tags to look for.
_nCurrentDepth - The depth of the current tag.
Returns:
boolean implies that all of the Child Tags have been found.
See Also:
IDisplayElement.HasChildElements(ITagMetaData[], Object[], TagLibraryMetaData, int)

HasChildTags

public boolean HasChildTags(ITagMetaData[] _childTags,
                            java.lang.Object[] _results,
                            TagLibraryMetaData _library,
                            int _nCurrentDepth)
This method checks if the current tag has the requested tags as child tags. This does not check if they match the current tag, unlike HasChildElements.

Parameters:
_childTags - An array of ITagMetaData objects for each child tag to search for.
_results - An array of null Objects. After execution, child tags that have been found that will be replaced with Integer objects containing the positive depth of the child tag in the same location the tag is in the _ChildTags array.
_library - The Tag Library of the tags to look for.
_nCurrentDepth - The depth of the current tag.
Returns:
boolean implies that all of the Child Tags have been found.

HasParentElement

public int HasParentElement(ITagMetaData _parentTag,
                            TagLibraryMetaData _library)
Description copied from interface: IDisplayElement
This method searches for a parent tag of the current tag.

Specified by:
HasParentElement in interface IDisplayElement
_library - The Tag Library of the tag to look for.
Returns:
int 0 implies the parent tag was not found and a positive integer implies that the parent tag was found n levels above the current tag.
See Also:
IDisplayElement.HasParentElement(ITagMetaData, TagLibraryMetaData)

HasParentTag

public int HasParentTag(ITagMetaData _parentTag,
                        TagLibraryMetaData _library)
This method checks if the current tag has the requested tag as a parent tag. This does not check if it matches the current tag, unlike HasParentElement.

Parameters:
_ParentTag - The ITagMetaData of the tag to look for.
_library - The Tag Library of the tag to look for.
Returns:
int 0 implies the parent tag was not found and a positive integer implies that the parent tag was found n levels above the current tag.

GetTagName

public java.lang.String GetTagName()
This method gets the name of this tag. Note that this initializes the tag holder and may cause unnecessary work if this tag is never displayed.

Returns:
String The name of this tag.

GetTagLibraryName

public java.lang.String GetTagLibraryName()
This method gets the name of the library for this tag. Note that this initializes the tag holder and may cause unnecessary work if this tag is never displayed.

Returns:
String The name of the library for this tag.

SetErrorMessage

public void SetErrorMessage(java.lang.String _strError)
This method sets an error to be displayed in an HTML Comment before the tag. This is used in case there is a problem parsing the tag HTML (i.e. an unclosed tag).

Parameters:
_strError - The error message to be displayed. This does not need to have the HTML comment marks (i.e. ).

DisplayAsHTML

protected HTMLElement DisplayAsHTML(TagVisitor _tagVisitor)
Output the current tag as HTML. This allows it to be handled by another processing engine if necessary.

Parameters:
_tagVisitor - The tag visitor.
Returns:
HTML for the current tag, plus the processed results of any child tags.



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.