com.caucho.jsp.java
Class GenericTag

java.lang.Object
  extended by com.caucho.jsp.java.JspNode
      extended by com.caucho.jsp.java.JspContainerNode
          extended by com.caucho.jsp.java.GenericTag
Direct Known Subclasses:
CustomSimpleTag, CustomTag, TagFileTag

public abstract class GenericTag
extends JspContainerNode

Represents a custom tag.


Field Summary
protected  TagInstance _tag
           
protected  java.lang.Class<?> _tagClass
           
protected  TagInfo _tagInfo
           
protected  VariableInfo[] _varInfo
           
 
Fields inherited from class com.caucho.jsp.java.JspContainerNode
_attributeNames, _attributeValues, _children, _hasJspAttribute
 
Fields inherited from class com.caucho.jsp.java.JspNode
_endAttributeLine, _endLine, _filename, _gen, _name, _ns, _parent, _parseState, _sourcePath, _startLine
 
Constructor Summary
GenericTag()
           
 
Method Summary
 void addChild(JspNode node)
          Adds a child node.
protected  void addTagDepend()
           
 void endElement()
          Completes the element
protected  void fillAttributes(JspJavaWriter out, java.lang.String name)
           
protected  VariableInfo[] fillVariableInfo(TagVariableInfo[] tagVars, TagData tagData)
          Returns the VariableInfo corresponding the to tag vars and the tag data.
abstract  void generate(JspJavaWriter out)
          Generates the code for a custom tag.
 void generateClassEpilogue(JspJavaWriter out)
          Generates the code for the tag
 void generatePrologue(JspJavaWriter out)
          Generates code before the actual JSP.
 void generatePrologueDeclare(JspJavaWriter out)
          generates prologue data.
 java.lang.String getBodyContent()
          Returns the body content.
 java.lang.String getCustomTagName()
          Returns the tag name for the current tag.
 java.lang.String getJsfBodyVar()
          Returns the variable containing the jsf body
 java.lang.String getJsfVar()
          Returns the variable containing the jsf component
 TagInstance getTag()
          Returns the TagInstance of the enclosing parent.
 TagInfo getTagInfo()
           
 VariableInfo[] getVarInfo()
           
 boolean hasScripting()
          True if the node has scripting
protected  boolean hasScriptlet(JspNode node)
          Returns true if the node or one of its children is a scriptlet
protected  boolean hasVarDeclaration(int scope)
          Returns true if there is a tag variable declaration matching the scope.
protected  boolean isDeclared()
          Returns true if the tag instance has been declared
 boolean isDeclaringInstance()
          Returns true if this instance declares the tag.
 boolean isJsfParentRequired()
          True if the jsf-parent setting is required.
 boolean isJsp21()
          True for 2.1 or later taglib
 boolean isJstl()
          True if this is a jstl node.
 boolean isPre21Taglib()
          Return true for pre-21 taglib.
 boolean isSimple()
          Returns true if the tag is a simple tag.
protected  void printVarAssign(JspJavaWriter out, int scope)
          Prints a tag variable declaration.
protected  void printVarAssign(JspJavaWriter out, int scope, VariableInfo var)
          Prints a tag variable declaration.
protected  void printVarDeclaration(JspJavaWriter out, int scope)
          Prints a tag variable declaration.
protected  void printVarDeclare(JspJavaWriter out, int scope)
          Prints a tag variable declaration.
protected  void printVarDeclare(JspJavaWriter out, int scope, VariableInfo var)
          Prints a tag variable declaration.
 void printXml(WriteStream os)
          Generates the XML text representation for the tag validation.
 void setTagClass(java.lang.Class cl)
           
 void setTagInfo(TagInfo tagInfo)
           
protected  void validateClass(java.lang.String className, java.lang.String varName)
          Checks that the given class is a valid variable class.
 
Methods inherited from class com.caucho.jsp.java.JspContainerNode
addAttribute, addAttribute, addAttributeChild, addChildEnd, addText, findScriptingNode, generateChildren, generateChildrenEmpty, generateClassEpilogueChildren, generateDeclarationChildren, generatePrologueChildren, generateStatic, generateTagReleaseChildren, generateTagStateChildren, getAttribute, getChildren, getStaticText, hasChildren, hasCustomTag, hasScriptingElement, hasTag, isChildrenStatic, isEmpty, isSingleExpression, isWhitespace, printXmlChildren
 
Methods inherited from class com.caucho.jsp.java.JspNode
addNamespace, addNamespaceRec, attributeToBoolean, classToString, convertParameterValue, endAttributes, error, error, error, escapeJavaString, generateDeclaration, generateELValue, generateEmpty, generateEndLocation, generateFragment, generateIncludeUrl, generateObject, generateParentTag, generateStartLocation, generateTagRelease, generateTagState, getEndAttributeLine, getEndLine, getFilename, getGenerator, getNamespaceContext, getNamespacePrefix, getParent, getParentTagName, getParentTagNode, getQName, getRuntimeAttribute, getSegment, getStartLine, getStaticText, getTagName, hasDeferredAttribute, hasDeferredAttribute, hasELAttribute, hasELAttribute, hasNamespace, hasNamespace, hasRuntimeAttribute, hasScripting, hasScripting, invokeFragment, isInFragment, isSimpleTag, isStatic, loadClass, printJspId, printXmlAttribute, printXmlOpen, printXmlText, setEndAttributeLocation, setEndLocation, setGenerator, setNamespace, setParent, setParseState, setQName, setStartLocation, toELObject, toString, xmlAttrText, xmlText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_tag

protected TagInstance _tag

_tagInfo

protected TagInfo _tagInfo

_tagClass

protected java.lang.Class<?> _tagClass

_varInfo

protected VariableInfo[] _varInfo
Constructor Detail

GenericTag

public GenericTag()
Method Detail

setTagInfo

public void setTagInfo(TagInfo tagInfo)

getTagInfo

public TagInfo getTagInfo()

isJsp21

public boolean isJsp21()
Description copied from class: JspNode
True for 2.1 or later taglib

Overrides:
isJsp21 in class JspNode

isPre21Taglib

public boolean isPre21Taglib()
Description copied from class: JspNode
Return true for pre-21 taglib.

Overrides:
isPre21Taglib in class JspNode

getTag

public TagInstance getTag()
Description copied from class: JspNode
Returns the TagInstance of the enclosing parent.

Overrides:
getTag in class JspNode

getCustomTagName

public java.lang.String getCustomTagName()
Returns the tag name for the current tag.

Overrides:
getCustomTagName in class JspNode

isSimple

public boolean isSimple()
Returns true if the tag is a simple tag.


isJstl

public boolean isJstl()
True if this is a jstl node.

Overrides:
isJstl in class JspNode

setTagClass

public void setTagClass(java.lang.Class cl)

getVarInfo

public VariableInfo[] getVarInfo()

getBodyContent

public java.lang.String getBodyContent()
Returns the body content.

Overrides:
getBodyContent in class JspNode

addChild

public void addChild(JspNode node)
              throws JspParseException
Adds a child node.

Overrides:
addChild in class JspContainerNode
Throws:
JspParseException

endElement

public void endElement()
                throws java.lang.Exception
Completes the element

Overrides:
endElement in class JspNode
Throws:
java.lang.Exception

addTagDepend

protected void addTagDepend()

hasScripting

public boolean hasScripting()
True if the node has scripting

Overrides:
hasScripting in class JspContainerNode

isJsfParentRequired

public boolean isJsfParentRequired()
True if the jsf-parent setting is required.

Overrides:
isJsfParentRequired in class JspContainerNode

isDeclaringInstance

public boolean isDeclaringInstance()
Returns true if this instance declares the tag.


getJsfVar

public java.lang.String getJsfVar()
Returns the variable containing the jsf component

Overrides:
getJsfVar in class JspNode

getJsfBodyVar

public java.lang.String getJsfBodyVar()
Returns the variable containing the jsf body

Overrides:
getJsfBodyVar in class JspNode

generateClassEpilogue

public void generateClassEpilogue(JspJavaWriter out)
                           throws java.io.IOException
Description copied from class: JspNode
Generates the code for the tag

Overrides:
generateClassEpilogue in class JspNode
Parameters:
out - the output writer for the generated java.
Throws:
java.io.IOException

generatePrologue

public void generatePrologue(JspJavaWriter out)
                      throws java.lang.Exception
Generates code before the actual JSP.

Overrides:
generatePrologue in class JspNode
Throws:
java.lang.Exception

generatePrologueDeclare

public void generatePrologueDeclare(JspJavaWriter out)
                             throws java.lang.Exception
Description copied from class: JspNode
generates prologue data.

Overrides:
generatePrologueDeclare in class JspNode
Throws:
java.lang.Exception

printXml

public void printXml(WriteStream os)
              throws java.io.IOException
Generates the XML text representation for the tag validation.

Specified by:
printXml in class JspNode
Parameters:
os - write stream to the generated XML.
Throws:
java.io.IOException

generate

public abstract void generate(JspJavaWriter out)
                       throws java.lang.Exception
Generates the code for a custom tag.

Specified by:
generate in class JspNode
Parameters:
out - the output writer for the generated java.
Throws:
java.lang.Exception

fillAttributes

protected void fillAttributes(JspJavaWriter out,
                              java.lang.String name)
                       throws java.lang.Exception
Throws:
java.lang.Exception

hasVarDeclaration

protected boolean hasVarDeclaration(int scope)
                             throws java.lang.Exception
Returns true if there is a tag variable declaration matching the scope.

Throws:
java.lang.Exception

printVarDeclaration

protected void printVarDeclaration(JspJavaWriter out,
                                   int scope)
                            throws java.lang.Exception
Prints a tag variable declaration. Only the variables matching the scope will be printed.

Parameters:
out - the stream to the java code.
scope - the variable scope to print
Throws:
java.lang.Exception

printVarDeclare

protected void printVarDeclare(JspJavaWriter out,
                               int scope)
                        throws java.lang.Exception
Prints a tag variable declaration. Only the variables matching the scope will be printed.

Parameters:
out - the stream to the java code.
scope - the variable scope to print
Throws:
java.lang.Exception

printVarAssign

protected void printVarAssign(JspJavaWriter out,
                              int scope)
                       throws java.lang.Exception
Prints a tag variable declaration. Only the variables matching the scope will be printed.

Parameters:
out - the stream to the java code.
scope - the variable scope to print
Throws:
java.lang.Exception

fillVariableInfo

protected VariableInfo[] fillVariableInfo(TagVariableInfo[] tagVars,
                                          TagData tagData)
                                   throws JspParseException
Returns the VariableInfo corresponding the to tag vars and the tag data. Mainly, this means looking up the variable names from the attributes for the name-from-attribute.

Parameters:
tagVars - the implicit tag variables for the tag
tagData - the parsed tag attributes
Returns:
an array of filled VariableInfo
Throws:
JspParseException

printVarDeclare

protected void printVarDeclare(JspJavaWriter out,
                               int scope,
                               VariableInfo var)
                        throws java.lang.Exception
Prints a tag variable declaration. Only the variables matching the scope will be printed.

Parameters:
out - the stream to the java code.
scope - the variable scope to print
Throws:
java.lang.Exception

printVarAssign

protected void printVarAssign(JspJavaWriter out,
                              int scope,
                              VariableInfo var)
                       throws java.lang.Exception
Prints a tag variable declaration. Only the variables matching the scope will be printed.

Parameters:
out - the stream to the java code.
scope - the variable scope to print
Throws:
java.lang.Exception

isDeclared

protected boolean isDeclared()
Returns true if the tag instance has been declared


hasScriptlet

protected boolean hasScriptlet(JspNode node)
Returns true if the node or one of its children is a scriptlet


validateClass

protected void validateClass(java.lang.String className,
                             java.lang.String varName)
                      throws JspParseException
Checks that the given class is a valid variable class.

Throws:
JspParseException