|
Oracle | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bea.jsptools.tree.TreeNode
public class TreeNode
This class defines an object that JavaScript can render as a single node in a navigation tree.
A TreeNode contains data that you pass to its constructor, such as a unique identifier (ID), a user-visible name, a URL (which JavaScript can use to render a hyperlink for the node), and the ID of its parent node.
By default, a TreeNode's alternative text is the user-visible name and the image that
it displays to indicate its expanded or collapsed state is images/spacer.gif
.
You can use this node's setter methods to change these defaults.
A TreeNode also contains runtime data, such as its state (expanded or collapsed), its sibling nodes, and its child nodes (if any other node has identified it as a parent).
Field Summary | |
---|---|
protected static String |
VAR_NAME_CONSTANT
|
protected static String |
VAR_NAME_INCREMENT
|
Constructor Summary | |
---|---|
TreeNode()
|
|
TreeNode(String nodeId,
String nodeName,
String nodeUrl)
Constructs a TreeNode to be rendered at the top (root) level of the navigation tree. |
|
TreeNode(String nodeId,
String nodeName,
String nodeUrl,
TreeNode parent)
Constructs a TreeNode to be rendered as a child of another node in the navigation tree. |
Method Summary | |
---|---|
void |
addChild(TreeNode node)
Adds a TreeNode as a child of this TreeNode. |
void |
addProperty(String key,
String value)
Adds an arbitrary (custom) property to this TreeNode. |
int |
compareTo(Object o)
|
boolean |
equals(Object obj)
|
boolean |
equals(TreeNode t)
|
static String |
escapeQuotes(String source)
Escapes quotation marks, new line, and tabs in a String. |
String |
getAltText()
Returns the alternative text for this node. |
List |
getChildren()
Returns the collection of child TreeNodes for this TreeNode. |
String |
getIconSrcClosed()
Returns the path and name of the image to display when this node is in a collapsed state. |
String |
getIconSrcOpen()
Returns the path and name of the image to display when this node is in an expanded state. |
String |
getJavascriptDefinition()
Returns the JavaScript representation of the TreeNode. |
TreeNode |
getNextSibling()
|
String |
getNodeId()
Returns the nodeId. |
String |
getNodeName()
Returns the user-visible nodeName. |
String |
getNodeUrl()
Returns the nodeUrl. |
TreeNode |
getParent()
Returns the TreeNode object that represents this TreeNode's parent node. |
String |
getParentId()
Returns the nodeId of this TreeNode's parent node. |
String |
getParentPath()
Returns the path to this TreeNode's parent. |
String |
getPopupId()
Returns the popupId, which is a string that displays in a popup window when a user right-clicks the node. |
int |
getPosition()
|
TreeNode |
getPreviousSibling()
|
Properties |
getProperties()
Returns all of the custom properties that have been set for this TreeNode. |
String |
getPropertyValue(String key)
Returns the value of property that was created using this TreeNode's TreeNode.addProperty(String, String) method. |
static String |
getTaxonomyDelimeter()
Returns the taxonomyDelimeter. |
String |
getVarName()
Returns the variable name that JavaScript uses to refer to this TreeNode object. |
boolean |
hasChildren()
Indicates whether this TreeNode has children. |
static String |
htmlChars(String source)
Encodes special characters as HTML entities. |
boolean |
isExpanded()
Indicates if the node as rendered in the navigation tree is currently expanded. |
void |
removeChild(TreeNode node)
Removes a TreeNode from this TreeNode's collection of child nodes. |
void |
replaceChild(TreeNode replace,
TreeNode node)
Replace a child TreeNode with another TreeNode. |
void |
setAltText(String altText)
Sets the alternative text for this node. |
void |
setExpanded(boolean isExpanded)
Sets the value of the isExpanded property. |
void |
setHasChildren(boolean hasChildren)
Sets the value of the hasChildren property. |
void |
setIconSrcClosed(String iconSrcClosed)
Sets the path and name of the image to display when this node is in a collapsed state. |
void |
setIconSrcOpen(String iconSrcOpen)
Sets the path and name of the image to display when this node is in an expanded state. |
void |
setNextSibling(TreeNode nextSibling)
|
void |
setNodeId(String nodeId)
Sets the nodeId, which must be alphabetic and unique to all other nodeIds in the tree. |
void |
setNodeName(String nodeName)
Sets the user-visible nodeName. |
void |
setNodeUrl(String nodeUrl)
Sets the nodeUrl. |
void |
setParent(TreeNode parent)
Sets the parent of this TreeNode. |
void |
setParentAlone(TreeNode parent)
Sets the parent of this TreeNode but does not add it to the parent's collection of child nodes. |
void |
setParentPath(String parentPath)
Sets the path to this TreeNode's parent. |
void |
setPopupId(String popupId)
Sets the popupId, which is a string that displays in a popup window when a user right-clicks the node. |
void |
setPosition(int position)
|
void |
setPreviousSibling(TreeNode previousSibling)
|
static void |
setTaxonomyDelimeter(String taxonomyDelimeter)
Sets the taxonomyDelimeter. |
void |
setVarName(String varName)
Sets the variable name that JavaScript uses to refer to this TreeNode object. |
static String |
unescapeQuotes(String source)
Replaces the Unicode escape sequence for quotation marks with with actual quotation-mark characters. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static String VAR_NAME_CONSTANT
protected static String VAR_NAME_INCREMENT
Constructor Detail |
---|
public TreeNode()
public TreeNode(String nodeId, String nodeName, String nodeUrl)
Constructs a TreeNode to be rendered at the top (root) level of the navigation tree.
The nodeId
must be alphabetic and unique
to all other nodeIds in the tree. This ID is intended to be
used for programmatic purposes; users do not see it.
If you specify a relative URL for nodeUrl
, it must be
relative to the root of the Web application.
nodeId
- A alphabetic string that uniquely identifies this nodenodeName
- The display name of the nodenodeUrl
- The URL of a resource to which this node linkspublic TreeNode(String nodeId, String nodeName, String nodeUrl, TreeNode parent)
Constructs a TreeNode to be rendered as a child of another node in the navigation tree.
The nodeId
must be alphabetic and unique
to all other nodeIds in the tree. This ID is intended to be
used for programmatic purposes; users do not see it.
If you specify a relative URL for nodeUrl
, it must be
relative to the root of the Web application.
nodeId
- A alphabetic string that uniquely identifies this nodenodeName
- The display name of the nodenodeUrl
- The URL of a resource to which this node linksparent
- The TreeNode object that is the parent of this nodeMethod Detail |
---|
public boolean equals(Object obj)
equals
in class Object
public String getAltText()
Returns the alternative text for this node. Most user agents display this text in a popup when the user hovers a mouse over the node.
public String getIconSrcClosed()
Returns the path and name of the image to display when this node is in a collapsed state. The pathname is relative to the root of the Web application.
public String getIconSrcOpen()
Returns the path and name of the image to display when this node is in an expanded state. The pathname is relative to the root of the Web application.
public String getNodeId()
public String getNodeName()
public String getNodeUrl()
public String getPopupId()
Returns the popupId, which is a string that displays in a popup window when a user right-clicks the node.
public void setAltText(String altText)
Sets the alternative text for this node. Most user agents display this text in a popup when the user hovers a mouse over the node.
By default, this value is set to the value of nodeName
, which
is passed to this object's constructor.
altText
- A String that contains the alternative text for this nodepublic void setIconSrcClosed(String iconSrcClosed)
Sets the path and name of the image to display when this node is in a collapsed state. The pathname must be relative to the root of the Web application.
By default, this value is set to images/spacer.gif
.
iconSrcClosed
- A String that contains the path and name of the iconSrcClosed imagepublic void setIconSrcOpen(String iconSrcOpen)
Sets the path and name of the image to display when this node is in an expanded state. The pathname must be relative to the root of the Web application.
By default, this value is set to images/spacer.gif
.
iconSrcOpen
- A String that contains the path and name of the iconSrcOpen imagepublic void setNodeId(String nodeId)
Sets the nodeId, which must be alphabetic and unique to all other nodeIds in the tree. This ID is intended to be used for programmatic purposes; users do not see it.
nodeId
- A String that contains the nodeIdpublic void setNodeName(String nodeName)
nodeName
- A String that contains the user-visible nodeNamepublic void setNodeUrl(String nodeUrl)
nodeUrl
- The nodeUrl to setpublic void setPopupId(String popupId)
Sets the popupId, which is a string that displays in a popup window when a user right-clicks the node.
popupId
- A String that contains the popupIdpublic void addProperty(String key, String value)
key
- A String that contains the key for this key-value pairvalue
- A String that contains the value for this key-value pairpublic String getPropertyValue(String key)
Returns the value of property that was created using this TreeNode's
TreeNode.addProperty(String, String)
method.
Returns null if key not found.
key
- A String that contains the key for a key-value pair
public Properties getProperties()
public static String getTaxonomyDelimeter()
public static void setTaxonomyDelimeter(String taxonomyDelimeter)
taxonomyDelimeter
- The taxonomyDelimeter to setpublic String getParentId()
nodeId
of this TreeNode's parent node.
nodeId
of this TreeNode's parentpublic TreeNode getParent()
public void setParent(TreeNode parent)
parent
- The parent TreeNode object of this TreeNodepublic void setParentAlone(TreeNode parent)
Sets the parent of this TreeNode but does not add it to the parent's collection of child nodes.
Use this method in cases such as 'replaceChild' where the caller is managing the collection.
parent
- public List getChildren()
public void addChild(TreeNode node)
node
- The TreeNode to add as a childpublic void removeChild(TreeNode node)
node
- The TreeNode to removepublic void replaceChild(TreeNode replace, TreeNode node)
replace
- The old TreeNode, which will be removed as a childnode
- The new TreeNode, which will be added as a childpublic String getVarName()
public void setVarName(String varName)
varName
- A String that contains the name of the variablepublic boolean isExpanded()
public void setExpanded(boolean isExpanded)
isExpanded
- The isExpanded to setpublic boolean hasChildren()
public void setHasChildren(boolean hasChildren)
hasChildren
- The hasChildren to setpublic static String htmlChars(String source)
Encodes special characters as HTML entities.
'<' becomes <
'>' becomes >
'&' becomes &
'"' becomes "
"'" becomes '
source
-
public static String escapeQuotes(String source)
source
- A String with quotation marks, new line or tab characters
public static String unescapeQuotes(String source)
Replaces the Unicode escape sequence for quotation marks with with actual quotation-mark characters.
For example, this method replaces "\\\\u0027" with "'".
source
- A String that contains the Unicode escape sequence
public String getJavascriptDefinition()
parent
- - This is the javascript representation of the parent node. Should be null for the root node
public int compareTo(Object o)
compareTo
in interface Comparable
public boolean equals(TreeNode t)
public String getParentPath()
Returns the path to this TreeNode's parent.
Each component of the path is the nodeName
of an
ancestor TreeNode. A "/" (slash) separates each component.
A path that contains only "/" represents the root of the tree and indicates that this TreeNode is at the top level.
public void setParentPath(String parentPath)
Sets the path to this TreeNode's parent.
Each component of the path is the nodeName
of an
ancestor TreeNode. A "/" (slash) separates each component.
To place this TreeNode at the top level, specify only "/", which represents the root of the tree.
parentPath
- A String that specifies the path to the parent nodepublic int getPosition()
public void setPosition(int position)
public TreeNode getPreviousSibling()
public void setPreviousSibling(TreeNode previousSibling)
public TreeNode getNextSibling()
public void setNextSibling(TreeNode nextSibling)
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs103 Copyright 1996,2008, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |