BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.

com.bea.wlw.netui.tags.html
Class Tree

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by com.bea.wlw.netui.tags.AbstractBaseTag
              extended by com.bea.wlw.netui.tags.DataSourceTag
                  extended by com.bea.wlw.netui.tags.html.Tree
All Implemented Interfaces:
HtmlConstants, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class Tree
extends DataSourceTag

Netui tag that renders a tree control represented by a set of TreeNode objects.

Attribute Descriptions
AttributeRequiredRuntime Expression EvaluationData Bindable
actionYesNoNo
Hyperlink to which expand/contract actions should be sent.
imageHandleDownLastNoNoNo
The image name for an open non-leaf node with no line below it.
imageHandleDownMiddleNoNoNo
The image name for an open non-leaf node with a line below it.
imageHandleRightLastNoNoNo
The image name for a closed non-leaf node with no line below it.
imageHandleRightMiddleNoNoNo
The image name for a closed non-leaf node with a line below it.
imageLineLastNoNoNo
The image name for a blank area of the tree.
imageLineMiddleNoNoNo
The image name for an area with a line through it.
imageLineVerticalNoNoNo
The image name for an area with a line through it.
imageRootNoNoNo
The name of the directory containing the images for our icons, relative to the page including this tag.
styleNoNoNo
CSS style class to be applied to be applied to the entire rendered output of the tree control.
styleSelectedNoNoNo
CSS style class to be applied to the text of any element that is currently selected.
styleUnselectedNoNoNo
CSS style class to be applied to the text of any element that is not currently selected.
treeYesNoRead/Write
Attribute name in the session or expression under which the root TreeNode of the tree we are rendering is stored.

See Also:
Node, TreeNode Class, Serialized Form
Example:
The following example shows a <netui:tree> tag with a set of children <netui:node> tags that form the tree's navigational structure. The tree attribute stores the tree in the Session object, under the property "tree". The imageRoot attribute points to fa older of images relative to the Page Flow directory.
  <netui:tree 
    tree="{session.tree}" 
    imageRoot="treeImages" 
    style="tree-control" 
    action="treeState">
      <netui:node label="Root Folder" expanded="true" action="treeState" target="contentFrame">
          <netui:node label="I" expanded="false" action="treeState" target="contentFrame">
              <netui:node label="A" expanded="false" action="treeState" target="contentFrame">
                  <netui:node label="1" action="treeState" target="contentFrame"/>
                  <netui:node label="2" action="treeState" target="contentFrame"/>
              </netui:node>
          </netui:node>            
      </netui:node>
  </netui:tree>

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui/tree/tree.jsp
Beadoc.see:
<netui:tree> Tag Sample
Beadoc.tagdescription:
Renders a navigable tree of Node tags.

This tag can automatically handle display icons for the tree nodes through the imageRoot attribute. If you point the imageRoot attribute at a folder containing appropriately named image files, the correct images will be used for any given state of the tree's nodes. The image names should be:

  • handledownlast.gif
  • handledownmiddle.gif
  • handlerightlast.gif
  • handledownmiddle.gif
  • linelastnode.gif
  • linemiddlenode.gif
  • linevertical.gif

Field Summary
protected  String action
          The hyperlink to be used for submitting requests to expand and contract tree nodes.
protected  String imageHandleDownLast
           
protected  String imageHandleDownMiddle
           
protected  String imageHandleRightLast
           
protected  String imageHandleRightMiddle
           
protected  String imageLineLast
           
protected  String imageLineMiddle
           
protected  String imageLineVertical
           
protected  String imageRoot
          The name of the directory containing the images for our icons, relative to the page including this tag.
protected  TreeNode rootNode
           
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 com.bea.wlw.netui.tags.AbstractBaseTag
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT
 
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 com.bea.wlw.netui.tags.html.HtmlConstants
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
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
Tree()
           
 
Method Summary
 int doEndTag()
          Render this Tree control.
 int doStartTag()
          Prepare the Tree for rendering.
 String getAction()
          Gets the action used for expanding and contracting tree nodes.
 String getImageHandleDownLast()
          Gets the image name for an open non-leaf node with no line below it.
 String getImageHandleDownMiddle()
          Gets the image name for an open non-leaf node with a line below it.
 String getImageHandleRightLast()
          Gets the image name for a closed non-leaf node with no line below it.
 String getImageHandleRightMiddle()
          Gets the image name for a closed non-leaf node with a line below it.
 String getImageLineLast()
          Gets the image name for a blank area of the tree.
 String getImageLineMiddle()
          Gets the image name for an area with a line through it.
 String getImageLineVertical()
          Gets the image name for an area with a line through it.
 String getImageRoot()
          Gets the name of the directory containing the images for our icons, relative to the page including this tag.
 TreeNode getRootNode()
          Gets the root TreeNode of this tree.
 String getStyle()
          Gets the CSS style class to be applied to the entire tree.
 String getStyleSelected()
          Gets the CSS style class to be applied to the text of selected nodes.
 String getStyleUnselected()
          Gets the CSS style class to be applied to the text of unselected nodes.
 String getTagName()
          Return the name of the Tag.
 String getTree()
          Gets the name of the attribute (in the session), or expression, under which the root TreeNode instance is stored.
protected  TreeNode getTreeRoot()
          Return the TreeControl instance for the tree control that we are rendering.
protected  void localRelease()
          Release all state information set by this tag.
protected  void render(javax.servlet.jsp.JspWriter out, TreeNode 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)
          Sets the action used for expanding and contracting tree nodes.
 void setImageHandleDownLast(String imageHandleDownLast)
          Sets the image name for an open non-leaf node with no line below it.
 void setImageHandleDownMiddle(String imageHandleDownMiddle)
          Sets the image name for an open non-leaf node with a line below it.
 void setImageHandleRightLast(String imageHandleRightLast)
          Sets the image name for a closed non-leaf node with no line below it.
 void setImageHandleRightMiddle(String imageHandleRightMiddle)
          Sets the image name for a closed non-leaf node with a line below it.
 void setImageLineLast(String imageLineLast)
          Sets the image name for a blank area of the tree.
 void setImageLineMiddle(String imageLineMiddle)
          Sets the image name for an area with a line through it.
 void setImageLineVertical(String imageLineVertical)
          Sets the image name for an area with a line through it.
 void setImageRoot(String imageRoot)
          Sets the name of the directory containing the images for our icons, relative to the page including this tag.
 void setRootNode(TreeNode rootNode)
          Sets the root TreeNode of this tree.
 void setStyle(String style)
          Sets the CSS style class to be applied to the entire tree.
 void setStyleSelected(String styleSelected)
          Sets the CSS style class to be applied to the text of selected nodes.
 void setStyleUnselected(String styleUnselected)
          Sets the CSS style class to be applied to the text of unselected nodes.
 void setTree(String tree)
          Sets the name of the attribute (in the session), or expression, under which the root TreeNode instance is stored.
 
Methods inherited from class com.bea.wlw.netui.tags.DataSourceTag
addNamingInterceptor, doNaming, evaluateDataSource, getDataSource, qualifyAttribute, removeNamingInterceptor, setDataSource
 
Methods inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
addTagIdMapping, containsExpression, evaluateAttributeToString, evaluateExpression, filter, filter, formatErrorString, formatString, getAttribute, getErrorsReport, getExpressionEvaluator, getJavaScriptUtils, getNearestForm, getNextId, getQualifiedBundleName, getScriptReporter, getUserLocale, hasErrors, isExpression, prepForRendering, registerAttribute, registerError, registerTagError, release, removeAttribute, renderAttribute, renderAttributes, reportErrors, rewriteName, setPageContext, updateExpression, write
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, 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, setParent
 

Field Detail

imageHandleDownLast

protected String imageHandleDownLast

imageHandleDownMiddle

protected String imageHandleDownMiddle

imageHandleRightLast

protected String imageHandleRightLast

imageHandleRightMiddle

protected String imageHandleRightMiddle

imageLineLast

protected String imageLineLast

imageLineMiddle

protected String imageLineMiddle

imageLineVertical

protected String imageLineVertical

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.


imageRoot

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


rootNode

protected TreeNode rootNode

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

Tree

public Tree()
Method Detail

getTagName

public String getTagName()
Return the name of the Tag.

Specified by:
getTagName in class AbstractBaseTag

getAction

public String getAction()
Gets the action used for expanding and contracting tree nodes.

Returns:
the action

setAction

public void setAction(String action)
Sets the action used for expanding and contracting tree nodes.

Parameters:
action - - the action
Beadoc.attributedescription:
The action method which handles expansion/contraction of tree nodes.
Beadoc.attributesyntaxvalue:
string_action
Beadoc.databindable:
true

getImageHandleDownLast

public String getImageHandleDownLast()
Gets the image name for an open non-leaf node with no line below it.

Returns:
the image name (including extension)

setImageHandleDownLast

public void setImageHandleDownLast(String imageHandleDownLast)
Sets the image name for an open non-leaf node with no line below it. (Defaults to "handledownlast.gif").

Parameters:
imageHandleDownLast - - the image name (including extension)
Beadoc.attributedescription:
The image name for an open non-leaf node with no line below it. (Defaults to "handledownlast.gif".)
Beadoc.attributesyntaxvalue:
string_imageHandleDownLast
Beadoc.databindable:
false

getImageHandleDownMiddle

public String getImageHandleDownMiddle()
Gets the image name for an open non-leaf node with a line below it.

Returns:
the image name (including extension)

setImageHandleDownMiddle

public void setImageHandleDownMiddle(String imageHandleDownMiddle)
Sets the image name for an open non-leaf node with a line below it. (Defaults to "handledownmiddle.gif").

Parameters:
imageHandleDownMiddle - - the image name (including extension)
Beadoc.attributedescription:
The image name for an open non-leaf node with a line below it. (Defaults to "handledownmiddle.gif".)
Beadoc.attributesyntaxvalue:
string_imageHandleDownMiddle
Beadoc.databindable:
false

getImageHandleRightLast

public String getImageHandleRightLast()
Gets the image name for a closed non-leaf node with no line below it.

Returns:
the image name (including extension)

setImageHandleRightLast

public void setImageHandleRightLast(String imageHandleRightLast)
Sets the image name for a closed non-leaf node with no line below it. (Defaults to "handlerightlast.gif").

Parameters:
imageHandleRightLast - - the image name (including extension)
Beadoc.attributedescription:
The image name for a closed non-leaf node with no line below it. (Defaults to "handlerightlast.gif".)
Beadoc.attributesyntaxvalue:
string_imageHandleRightLast
Beadoc.databindable:
false

getImageHandleRightMiddle

public String getImageHandleRightMiddle()
Gets the image name for a closed non-leaf node with a line below it.

Returns:
the image name (including extension)

setImageHandleRightMiddle

public void setImageHandleRightMiddle(String imageHandleRightMiddle)
Sets the image name for a closed non-leaf node with a line below it. (Defaults to "handlerightmiddle.gif").

Parameters:
imageHandleRightMiddle - - the image name (including extension)
Beadoc.attributedescription:
The image name for a closed non-leaf node with a line below it. (Defaults to "handlerightmiddle.gif".)
Beadoc.attributesyntaxvalue:
string_imageHandleRightMiddle
Beadoc.databindable:
false

getImageLineLast

public String getImageLineLast()
Gets the image name for a blank area of the tree.

Returns:
the image name (including extension)

setImageLineLast

public void setImageLineLast(String imageLineLast)
Sets the image name for a blank area of the tree. (Defaults to "linelastnode.gif").

Parameters:
imageLineLast - - the image name (including extension)
Beadoc.attributedescription:
The image name for a blank area of the tree. (Defaults to "linelastnode.gif")
Beadoc.attributesyntaxvalue:
string_imageLineLast
Beadoc.databindable:
false

getImageLineMiddle

public String getImageLineMiddle()
Gets the image name for an area with a line through it.

Returns:
the image name (including extension)

setImageLineMiddle

public void setImageLineMiddle(String imageLineMiddle)
Sets the image name for an area with a line through it. (Defaults to "linemiddlenode.gif").

Parameters:
imageLineMiddle - - the image name (including extension)
Beadoc.attributedescription:
The image name for an area with a line through it. (Defaults to "linemiddlenode.gif").
Beadoc.attributesyntaxvalue:
string_imageLineMiddle
Beadoc.databindable:
false

getImageLineVertical

public String getImageLineVertical()
Gets the image name for an area with a line through it.

Returns:
the image name (including extension)

setImageLineVertical

public void setImageLineVertical(String imageLineVertical)
Sets the image name for an area with a line through it. (Defaults to "linevertical.gif").

Parameters:
imageLineVertical - - the image name (including extension)
Beadoc.attributedescription:
The image name for an area with a line through it. (Defaults to "linevertical.gif").
Beadoc.attributesyntaxvalue:
string_imageLIneVertical
Beadoc.databindable:
false

getImageRoot

public String getImageRoot()
Gets the name of the directory containing the images for our icons, relative to the page including this tag.

Returns:
the directory name

setImageRoot

public void setImageRoot(String imageRoot)
Sets the name of the directory containing the images for our icons, relative to the page including this tag.

Parameters:
imageRoot - - the directory name
Beadoc.attributedescription:
The directory containing the images for tree icons, relative to the page that includes the <netui:tree> tag.
Beadoc.attributesyntaxvalue:
string_imageRoot
Beadoc.databindable:
false

getRootNode

public TreeNode getRootNode()
Gets the root TreeNode of this tree.

Returns:
the root TreeNode

setRootNode

public void setRootNode(TreeNode rootNode)
Sets the root TreeNode of this tree.

Parameters:
rootNode - - the root treeNode
Beadoc.attributedescription:
Sets the root TreeNode of this tree.
Beadoc.attributesyntaxvalue:
string_rootNode
Beadoc.databindable:
false

getStyle

public String getStyle()
Gets the CSS style class to be applied to the entire tree.

Returns:
the style

setStyle

public void setStyle(String style)
Sets the CSS style class to be applied to the entire tree.

Parameters:
style - - the style
Beadoc.attributedescription:
The CSS style to be applied to the entire tree.
Beadoc.attributesyntaxvalue:
string_style
Beadoc.databindable:
false

getStyleSelected

public String getStyleSelected()
Gets the CSS style class to be applied to the text of selected nodes.

Returns:
the selected style

setStyleSelected

public void setStyleSelected(String styleSelected)
Sets the CSS style class to be applied to the text of selected nodes.

Parameters:
styleSelected - - the selected style
Beadoc.attributedescription:
The CSS style to be applied to the text of selected nodes.
Beadoc.attributesyntaxvalue:
string_styleSelected
Beadoc.databindable:
false

getStyleUnselected

public String getStyleUnselected()
Gets the CSS style class to be applied to the text of unselected nodes.

Returns:
the unselected style

setStyleUnselected

public void setStyleUnselected(String styleUnselected)
Sets the CSS style class to be applied to the text of unselected nodes.

Parameters:
styleUnselected - - the unselected style
Beadoc.attributedescription:
The CSS style to be applied to unselected nodes.
Beadoc.attributesyntaxvalue:
string_styleUnselected
Beadoc.databindable:
false

getTree

public String getTree()
Gets the name of the attribute (in the session), or expression, under which the root TreeNode instance is stored.

Returns:
the tree attribute name

setTree

public void setTree(String tree)
Sets the name of the attribute (in the session), or expression, under which the root TreeNode instance is stored.

Parameters:
tree - - the tree attribute name
Beadoc.attributedescription:
The name of session attribute under which the root TreeNode is stored. This attribute may take a literal or a data binding expression.
Beadoc.attributesyntaxvalue:
string_or_expression_sessionAttribute
Beadoc.databindable:
Read / Write

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Prepare the Tree for rendering.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

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.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a processing error occurs

localRelease

protected void localRelease()
Release all state information set by this tag.

Overrides:
localRelease in class DataSourceTag

getTreeRoot

protected TreeNode getTreeRoot()
                        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
Exclude:

render

protected void render(javax.servlet.jsp.JspWriter out,
                      TreeNode 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
Exclude:

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
Exclude:

BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.