EchoPoint
1.0

echopoint.ui.template.taghandlers
Class AbstractTagHandler

java.lang.Object
  extended byechopoint.ui.template.taghandlers.AbstractTagHandler
All Implemented Interfaces:
java.io.Serializable, TagHandler
Direct Known Subclasses:
LabelTagHandler, RangeTagHandler, SelectTagHandler, SimpleTagHandler, TextSubstitutionTagHandler

public abstract class AbstractTagHandler
extends java.lang.Object
implements TagHandler, java.io.Serializable

A TemplateTagHandler that acts a base for more specialised tag handlers related to the the HtmlTemplatePanel

See Also:
Serialized Form

Constructor Summary
AbstractTagHandler()
           
 
Method Summary
 void executeTag(ParseContext context, PositionReader input, boolean parseTime)
          Looks for a Component associated with the name attribute, finds its Component Peer and then renders it into the template output.
 long getEndPos()
          Returns the end position of the tag in the markup source
 long getLineNumber()
          Returns the line number at which this tag handler was invoked.
 java.lang.String getNameProperty()
          Returns the name of the tag in question
 java.util.Map getProperties()
          Called to get a Map of tag attribute properties and their values.
 long getStartPos()
          Returns the start position of the tag in the markup source
 long getTagLength()
          Get the length of the area in the sourcefile.
 long getTagStart()
          Get start position of the area in the sourcefile this handler processes.
 boolean isTagClosedProperly()
          Returns true if the tag is closed properly
 void postParsePostProperties(CompilationContext context)
          This method is called after the tag has been compiled and AFTER any tag properties have been processed.
 void postParsePreProperties(CompilationContext context)
          This method is called after the tag has been compiled but BEFORE any tag properties have been processed.
protected  void reportClosingTagError(ParseContext context)
          Outputs a consistent error message at execution time when a closing tag is not found during parse time
protected  void reportError(ParseContext context, java.lang.String message, java.lang.Exception exception)
           
protected  void reportNoComponentPeerError(ParseContext context)
          Outputs a consistent error message at execution time when a Component Peer is not found .
 void setEndPos(long l)
          Sets the end position of the tag in the markup source
 void setLineNumber(long lineNumber)
          Sets the line number the tag was encountered at
protected  void setName(java.lang.String name)
          Called as a last resort for setting the name of a tagHandler, rather than from the NAME tag attribute.
 java.lang.String setNameProperty(SGMLTag tag)
          Sets the Name property of the TagHandler based on first the "NAME" tag attribute or the "ID" tag attribute.
 void setProperties(java.util.Map map)
          Sets a Map of properties into the handler
 void setStartPos(long l)
          Sets the start position of the tag in the markup source
 void setTagClosedProperly(boolean tagClosedProperly)
          Sets whether the tag was closed properly
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface echopoint.ui.template.taghandlers.TagHandler
parseTag
 

Constructor Detail

AbstractTagHandler

public AbstractTagHandler()
Method Detail

executeTag

public void executeTag(ParseContext context,
                       PositionReader input,
                       boolean parseTime)
                throws java.lang.Exception
Looks for a Component associated with the name attribute, finds its Component Peer and then renders it into the template output.

Specified by:
executeTag in interface TagHandler
Throws:
java.lang.Exception - anything can happen .. and throw an Exception which is caught in PageParser

reportClosingTagError

protected void reportClosingTagError(ParseContext context)
Outputs a consistent error message at execution time when a closing tag is not found during parse time

Parameters:
context - - the parse context

reportNoComponentPeerError

protected void reportNoComponentPeerError(ParseContext context)
Outputs a consistent error message at execution time when a Component Peer is not found .

Parameters:
context - - the parse context

reportError

protected void reportError(ParseContext context,
                           java.lang.String message,
                           java.lang.Exception exception)

postParsePreProperties

public void postParsePreProperties(CompilationContext context)
Description copied from interface: TagHandler
This method is called after the tag has been compiled but BEFORE any tag properties have been processed. This allows the tag handler to do some things before actual (and potentially repeated) execution.

Specified by:
postParsePreProperties in interface TagHandler
Parameters:
context - The CompilationContext involved
See Also:
TagHandler.postParsePreProperties(echopoint.template.CompilationContext)

postParsePostProperties

public void postParsePostProperties(CompilationContext context)
Description copied from interface: TagHandler
This method is called after the tag has been compiled and AFTER any tag properties have been processed. This allows the tag handler to do some things before actual (and potentially repeated) execution.

Specified by:
postParsePostProperties in interface TagHandler
Parameters:
context - The CompilationContext involved
See Also:
TagHandler.postParsePostProperties(echopoint.template.CompilationContext)

getNameProperty

public java.lang.String getNameProperty()
Returns the name of the tag in question

Specified by:
getNameProperty in interface TagHandler

getTagLength

public long getTagLength()
Get the length of the area in the sourcefile. The area this handler processes is skipped in the inputfile.

Specified by:
getTagLength in interface TagHandler

getTagStart

public long getTagStart()
Get start position of the area in the sourcefile this handler processes.

Specified by:
getTagStart in interface TagHandler

getProperties

public java.util.Map getProperties()
Description copied from interface: TagHandler
Called to get a Map of tag attribute properties and their values. The keys of the of the map are expected to be the tag attribute property names and the values are expected top be the tag attribute property values.

Specified by:
getProperties in interface TagHandler
Returns:
Map
See Also:
TagHandler.getProperties()

setProperties

public void setProperties(java.util.Map map)
Sets a Map of properties into the handler

Parameters:
map - - the map of property names and values

getEndPos

public long getEndPos()
Returns the end position of the tag in the markup source

Returns:
long - the end position of the tag in the markup source

getStartPos

public long getStartPos()
Returns the start position of the tag in the markup source

Returns:
long - the start position of the tag in the markup source

setEndPos

public void setEndPos(long l)
Sets the end position of the tag in the markup source

Parameters:
l - long - the end position of the tag in the markup source

setNameProperty

public java.lang.String setNameProperty(SGMLTag tag)
Sets the Name property of the TagHandler based on first the "NAME" tag attribute or the "ID" tag attribute. This returns NULL if its neither is present.

Parameters:
tag - - the tag containing the name or id tag attribute
Returns:
String - the name or null

setName

protected void setName(java.lang.String name)
Called as a last resort for setting the name of a tagHandler, rather than from the NAME tag attribute.


setStartPos

public void setStartPos(long l)
Sets the start position of the tag in the markup source

Parameters:
l - long - the start position of the tag in the markup source

isTagClosedProperly

public boolean isTagClosedProperly()
Returns true if the tag is closed properly

Returns:
true if the tag is closed properly

setTagClosedProperly

public void setTagClosedProperly(boolean tagClosedProperly)
Sets whether the tag was closed properly

Parameters:
tagClosedProperly - whether the tagb was closed proerly

getLineNumber

public long getLineNumber()
Description copied from interface: TagHandler
Returns the line number at which this tag handler was invoked. This can be obtained from the PositionReader at parse time.

Specified by:
getLineNumber in interface TagHandler
Returns:
the line number at which this tag handler was invoked
See Also:
TagHandler.getLineNumber()

setLineNumber

public void setLineNumber(long lineNumber)
Sets the line number the tag was encountered at

Parameters:
lineNumber - the line number the tag was encountered at

toString

public java.lang.String toString()
See Also:
Object.toString()

EchoPoint
1.0