org.ow2.jonas.webapp.taglib
Class TreeControlTag

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

public class TreeControlTag
extends 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: 11749 $ $Date: 2007-10-08 11:47:44 +0200 (lun 08 oct 2007) $
Author:
Craig R. McClanahan
See Also:
Serialized Form

Field Summary
protected  String action
          The hyperlink to be used for submitting requests to expand and contract tree nodes.
protected  String images
          The name of the directory containing the images for our icons, relative to the page including this tag.
protected  String scope
          The name of the scope in which to search for the tree attribute.
protected  String style
          The CSS style class to be applied to the entire tree.
protected  String styleSelected
          The CSS style class to be applied to the text of selected nodes.
protected  String styleUnselected
          The CSS style class to be applied to the text of unselected nodes.
protected  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.
 String getAction()
           
 String getImages()
           
 String getScope()
           
 String getStyle()
           
 String getStyleSelected()
           
 String getStyleUnselected()
           
 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(JspWriter out, TreeControlNode node, int level, int width, boolean last)
          Render the specified node, as controlled by the specified parameters.
protected  String replace(String template, String placeholder, String value)
          Replace any occurrence of the specified placeholder in the specified template string with the specified replacement value.
 void setAction(String action)
           
 void setImages(String images)
           
 void setScope(String scope)
           
 void setStyle(String style)
           
 void setStyleSelected(String styleSelected)
           
 void setStyleUnselected(String styleUnselected)
           
 void setTree(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 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 String images
The name of the directory containing the images for our icons, relative to the page including this tag.


scope

protected 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 String style
The CSS style class to be applied to the entire tree.


styleSelected

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


styleUnselected

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


tree

protected 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 String getAction()

setAction

public void setAction(String action)

getImages

public String getImages()

setImages

public void setImages(String images)

getScope

public String getScope()

setScope

public void setScope(String scope)

getStyle

public String getStyle()

setStyle

public void setStyle(String style)

getStyleSelected

public String getStyleSelected()

setStyleSelected

public void setStyleSelected(String styleSelected)

getStyleUnselected

public String getStyleUnselected()

setStyleUnselected

public void setStyleUnselected(String styleUnselected)

getTree

public String getTree()

setTree

public void setTree(String tree)

doEndTag

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

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class TagSupport
Throws:
JspException - if a processing error occurs

release

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

Specified by:
release in interface Tag
Overrides:
release in class TagSupport

getTreeControl

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

Throws:
JspException - if no TreeControl instance can be found

render

protected void render(JspWriter out,
                      TreeControlNode node,
                      int level,
                      int width,
                      boolean last)
               throws 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:
IOException - if an input/output error occurs

replace

protected String replace(String template,
                         String placeholder,
                         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


Copyright © 2010 OW2 Consortium. All Rights Reserved.