Devsphere.com


com.devsphere.xml.taglib.process.tag
Class PI

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--javax.servlet.jsp.tagext.BodyTagSupport
              |
              +--com.devsphere.xml.taglib.support.tag.CommonSupport
                    |
                    +--com.devsphere.xml.taglib.process.tag.ProcessSupport
                          |
                          +--com.devsphere.xml.taglib.process.tag.PI
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally

public class PI
extends ProcessSupport

Handler for the <p:pi> tag, whose body can process a processingInstruction() SAX event. It exports two variables that hold the target and data of the processing instruction.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.devsphere.xml.taglib.process.tag.ProcessSupport
ancestor, event, handler, indentLevel
 
Fields inherited from class com.devsphere.xml.taglib.support.tag.CommonSupport
cachedDebug, cachedLogger, DEBUG_ATTR, DEFAULT_DEBUG, DEFAULT_RESTORE_VALUE, DEFAULT_SCOPE, LOGGER_ATTR, originalValues
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
PI()
           
 
Method Summary
protected  boolean continueLoop()
          Returns false since the tag's body needs to be evaluated only once in order to process the event.
protected  boolean evalTests()
          Evaluates the test conditions and exports the variables.
protected  void exportVariables()
          Exports the target and data variables.
protected  java.util.List getAllowedAncestors()
          Returns the list of names of the tags that may contain the tag that is handled by this class.
 java.lang.String getTagName()
          Returns the name of the handled tag
protected  void init()
          Initializes the fields of this tag handler.
protected  void initLoop()
          Initializes the loop to process parsing instruction events.
 void setScope(java.lang.String scope)
          Sets the default scope for the variables exported by this tag handler.
 void setScopeData(java.lang.String scopeData)
          Sets the scope of the data variable exported by this tag handler.
 void setScopeTarget(java.lang.String scopeTarget)
          Sets the scope of the target variable exported by this tag handler.
 void setTest(java.lang.String testExpr)
          If this expression is present and it evaluates to false (the test is negative), the body of the tag won't be evaluated.
 void setTestTarget(java.lang.String testTargetExpr)
          Sets the expression whose value will be compared with the processing instruction's target.
 void setVarData(java.lang.String varData)
          Sets the name of the data variable exported by this tag handler.
 void setVarTarget(java.lang.String varTarget)
          Sets the name of the target variable exported by this tag handler.
protected  boolean startLoop()
          Returns true if the current event is a Processing instance and all tests are passed.
 
Methods inherited from class com.devsphere.xml.taglib.process.tag.ProcessSupport
doAfterBody, doEndTag, doFinally, doStartTag, finalizeLoop, getEvent, logEvent, logEvent, removeEvent, validate
 
Methods inherited from class com.devsphere.xml.taglib.support.tag.CommonSupport
checkVarName, checkVarScope, doCatch, eval, evalBoolean, evalDouble, evalInt, evalString, export, export, getDebug, getLogger, log, log, log, restore
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Constructor Detail

PI

public PI()
Method Detail

init

protected void init()
Initializes the fields of this tag handler.

Overrides:
init in class ProcessSupport

getTagName

public java.lang.String getTagName()
Returns the name of the handled tag

Specified by:
getTagName in class CommonSupport
Returns:
the name of the handled tag

getAllowedAncestors

protected java.util.List getAllowedAncestors()
Returns the list of names of the tags that may contain the tag that is handled by this class.

Specified by:
getAllowedAncestors in class CommonSupport
Returns:
the list of names of the allowed ancestor tags or null if the tag context doesn't matter.

setVarTarget

public void setVarTarget(java.lang.String varTarget)
                  throws javax.servlet.jsp.JspException
Sets the name of the target variable exported by this tag handler. The processing instruction's target will be the value of the target variable. The default name of this variable is target.

Parameters:
varTarget - the name of the target variable
Throws:
javax.servlet.jsp.JspException - to signal any error that might occur

setScopeTarget

public void setScopeTarget(java.lang.String scopeTarget)
                    throws javax.servlet.jsp.JspException
Sets the scope of the target variable exported by this tag handler.

Parameters:
scopeTarget - the scope of the target variable
Throws:
javax.servlet.jsp.JspException - to signal any error that might occur

setTestTarget

public void setTestTarget(java.lang.String testTargetExpr)
                   throws javax.servlet.jsp.JspException
Sets the expression whose value will be compared with the processing instruction's target. If this expression is present and the target test is negative, the body of the tag won't be evaluated.

Parameters:
testTargetExpr - the expression for testing the target
Throws:
javax.servlet.jsp.JspException - to signal any error that might occur

setVarData

public void setVarData(java.lang.String varData)
                throws javax.servlet.jsp.JspException
Sets the name of the data variable exported by this tag handler. The value of the data variable will be the processing instruction's data. The default name of this variable is data.

Parameters:
varData - the name of the data variable
Throws:
javax.servlet.jsp.JspException - to signal any error that might occur

setScopeData

public void setScopeData(java.lang.String scopeData)
                  throws javax.servlet.jsp.JspException
Sets the scope of the data variable exported by this tag handler.

Parameters:
scopeData - the scope of the data variable
Throws:
javax.servlet.jsp.JspException - to signal any error that might occur

setTest

public void setTest(java.lang.String testExpr)
             throws javax.servlet.jsp.JspException
If this expression is present and it evaluates to false (the test is negative), the body of the tag won't be evaluated.

Parameters:
testExpr - the expression that will be evaluated
Throws:
javax.servlet.jsp.JspException - to signal any error that might occur

setScope

public void setScope(java.lang.String scope)
              throws javax.servlet.jsp.JspException
Sets the default scope for the variables exported by this tag handler.

Parameters:
scope - the default scope of the exported variables
Throws:
javax.servlet.jsp.JspException - to signal any error that might occur

initLoop

protected void initLoop()
                 throws javax.servlet.jsp.JspException
Initializes the loop to process parsing instruction events.

Overrides:
initLoop in class ProcessSupport
Throws:
javax.servlet.jsp.JspException - to signal any tag validation error

exportVariables

protected void exportVariables()
Exports the target and data variables.


evalTests

protected boolean evalTests()
                     throws javax.servlet.jsp.JspException
Evaluates the test conditions and exports the variables.

Returns:
true is all tests are passed
Throws:
javax.servlet.jsp.JspException - to signal any error that might occur

startLoop

protected boolean startLoop()
                     throws javax.servlet.jsp.JspException
Returns true if the current event is a Processing instance and all tests are passed.

Specified by:
startLoop in class ProcessSupport
Returns:
true if the event loop should be started
Throws:
javax.servlet.jsp.JspException - to signal an error

continueLoop

protected boolean continueLoop()
                        throws javax.servlet.jsp.JspException
Returns false since the tag's body needs to be evaluated only once in order to process the event.

Specified by:
continueLoop in class ProcessSupport
Returns:
false
Throws:
javax.servlet.jsp.JspException - to signal an error

 Devsphere.com