org.objectweb.jonas.webapp.taglib
Class TreeControlTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.objectweb.jonas.webapp.taglib.TreeControlTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
TreeControlRenderTag

public class TreeControlTag
extends javax.servlet.jsp.tagext.TagSupport

JSP custom tag that renders a tree control represented by the TreeControl and TreeControlNode classes. This tag has the following user-settable attributes:

FIXME - Internationalize the exception messages!

Version:
$Revision: 3686 $ $Date: 2003-11-12 17:19:38 +0000 (Wed, 12 Nov 2003) $
Author:
Craig R. McClanahan
See Also:
Serialized Form

Field Summary
protected  java.lang.String action
          The hyperlink to be used for submitting requests to expand and contract tree nodes.
protected  java.lang.String images
          The name of the directory containing the images for our icons, relative to the page including this tag.
protected  java.lang.String scope
          The name of the scope in which to search for the tree attribute.
protected  java.lang.String style
          The CSS style class to be applied to the entire tree.
protected  java.lang.String styleSelected
          The CSS style class to be applied to the text of selected nodes.
protected  java.lang.String styleUnselected
          The CSS style class to be applied to the text of unselected nodes.
protected  java.lang.String tree
          The name of the attribute (in the specified scope) under which our TreeControl instance is stored.
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
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
TreeControlTag()
           
 
Method Summary
 int doEndTag()
          Render this tree control.
 java.lang.String getAction()
           
 java.lang.String getImages()
           
 java.lang.String getScope()
           
 java.lang.String getStyle()
           
 java.lang.String getStyleSelected()
           
 java.lang.String getStyleUnselected()
           
 java.lang.String getTree()
           
protected  TreeControl getTreeControl()
          Return the TreeControl instance for the tree control that we are rendering.
 void release()
          Release all state information set by this tag.
protected  void render(javax.servlet.jsp.JspWriter out, TreeControlNode node, int level, int width, boolean last)
          Render the specified node, as controlled by the specified parameters.
protected  java.lang.String replace(java.lang.String template, java.lang.String placeholder, java.lang.String value)
          Replace any occurrence of the specified placeholder in the specified template string with the specified replacement value.
 void setAction(java.lang.String action)
           
 void setImages(java.lang.String images)
           
 void setScope(java.lang.String scope)
           
 void setStyle(java.lang.String style)
           
 void setStyleSelected(java.lang.String styleSelected)
           
 void setStyleUnselected(java.lang.String styleUnselected)
           
 void setTree(java.lang.String tree)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doStartTag, 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
 

Field Detail

action

protected java.lang.String action
The hyperlink to be used for submitting requests to expand and contract tree nodes. The placeholder "${name}" will be replaced by the name property of the current tree node.


images

protected java.lang.String images
The name of the directory containing the images for our icons, relative to the page including this tag.


scope

protected java.lang.String scope
The name of the scope in which to search for the tree attribute. Must be "page", "request", "session", or "application" (or null for an ascending-visibility search).


style

protected java.lang.String style
The CSS style class to be applied to the entire tree.


styleSelected

protected java.lang.String styleSelected
The CSS style class to be applied to the text of selected nodes.


styleUnselected

protected java.lang.String styleUnselected
The CSS style class to be applied to the text of unselected nodes.


tree

protected java.lang.String tree
The name of the attribute (in the specified scope) under which our TreeControl instance is stored.

Constructor Detail

TreeControlTag

public TreeControlTag()
Method Detail

getAction

public java.lang.String getAction()

setAction

public void setAction(java.lang.String action)

getImages

public java.lang.String getImages()

setImages

public void setImages(java.lang.String images)

getScope

public java.lang.String getScope()

setScope

public void setScope(java.lang.String scope)

getStyle

public java.lang.String getStyle()

setStyle

public void setStyle(java.lang.String style)

getStyleSelected

public java.lang.String getStyleSelected()

setStyleSelected

public void setStyleSelected(java.lang.String styleSelected)

getStyleUnselected

public java.lang.String getStyleUnselected()

setStyleUnselected

public void setStyleUnselected(java.lang.String styleUnselected)

getTree

public java.lang.String getTree()

setTree

public void setTree(java.lang.String tree)

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Render this tree control.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport
Throws:
javax.servlet.jsp.JspException - if a processing error occurs

release

public void release()
Release all state information set by this tag.

Specified by:
release in interface javax.servlet.jsp.tagext.Tag
Overrides:
release in class javax.servlet.jsp.tagext.TagSupport

getTreeControl

protected TreeControl getTreeControl()
                              throws javax.servlet.jsp.JspException
Return the TreeControl instance for the tree control that we are rendering.

Throws:
javax.servlet.jsp.JspException - if no TreeControl instance can be found

render

protected void render(javax.servlet.jsp.JspWriter out,
                      TreeControlNode node,
                      int level,
                      int width,
                      boolean last)
               throws java.io.IOException
Render the specified node, as controlled by the specified parameters.

Parameters:
out - The JspWriter to which we are writing
node - The TreeControlNode we are currently rendering
level - The indentation level of this node in the tree
width - Total displayable width of the tree
last - Is this the last node in a list?
Throws:
java.io.IOException - if an input/output error occurs

replace

protected java.lang.String replace(java.lang.String template,
                                   java.lang.String placeholder,
                                   java.lang.String value)
Replace any occurrence of the specified placeholder in the specified template string with the specified replacement value.

Parameters:
template - Pattern string possibly containing the placeholder
placeholder - Placeholder expression to be replaced
value - Replacement value for the placeholder