EchoPoint
1.0

echopoint.ui.template.taghandlers
Interface TagHandler

All Known Implementing Classes:
AbstractTagHandler, HtmlBodyCssStripper

public interface TagHandler

The TagHandler interface controls what happens when a tag is encountered with a specific name. The tag handler is responsible for both parsing and then executing a given tag, as well as retaining tag attribute properties and their values so they can also be used after parsing.


Method Summary
 void executeTag(ParseContext context, PositionReader input, boolean parseTime)
          actually perform the action associated with this tag.
 long getLineNumber()
          Returns the line number at which this tag handler was invoked.
 java.lang.String getNameProperty()
          Called to get the identification tag attribute property called "name".
 java.util.Map getProperties()
          Called to get a Map of tag attribute properties and their values.
 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.
 SGMLTag parseTag(CompilationContext context, PositionReader input, long startPos, SGMLTag startTag)
          Parse tag.
 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.
 

Method Detail

executeTag

public void executeTag(ParseContext context,
                       PositionReader input,
                       boolean parseTime)
                throws java.lang.Exception
actually perform the action associated with this tag. The parseTime flag will bet ste to TRUE if the page is being parsed.

Throws:
java.lang.Exception - anything can happen .. and throw an Exception which is caught in PageParser

getTagLength

public long getTagLength()
Get the length of the area in the sourcefile. The area this handler processes is skipped in the inputfile. Usually this represents the length of the single <SpecialTag> or the area <SpecialTag>...</SpecialTag>


getTagStart

public long getTagStart()
Get start position of the area in the sourcefile this handler processes. This is usually the position of the "<"PositionReaderPositionReader of the <SpecialTag> within the inputfile.


getProperties

public java.util.Map getProperties()
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.


getNameProperty

public java.lang.String getNameProperty()
Called to get the identification tag attribute property called "name". This may not be present and hence this method could return null.


getLineNumber

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

Returns:
the line number at which this tag handler was invoked

parseTag

public SGMLTag parseTag(CompilationContext context,
                        PositionReader input,
                        long startPos,
                        SGMLTag startTag)
                 throws java.io.IOException
Parse tag. This method is invoked if a tag with a name this class is registered for is found. The parseTag() method is called before any processing is done. Its purpose is to parse the area this tag spans and probably read in parameters used at execution time.

This method returns the last tag belonging to the area handled by this handler

. For simple one-tag Handlers this is simply the tag passed to this method. If the Handler decides not to handle this tag, this method should return null.

Parameters:
context - The CompilationContext involved
input - The PositionReader, located after the Name token of the Tag
startPos - The Position parsing of this token began
startTag - the SGMLTag found in the file.
Throws:
java.io.IOException

postParsePreProperties

public void postParsePreProperties(CompilationContext context)
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.

Parameters:
context - The CompilationContext involved

postParsePostProperties

public void postParsePostProperties(CompilationContext context)
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.

Parameters:
context - The CompilationContext involved

EchoPoint
1.0