SilverStream
Application Server 3.5

com.sssw.rt.form
Class AgoTreeControlNode

java.lang.Object
 |
 +--com.sssw.rt.form.AgoTreeControlNode

public class AgoTreeControlNode
extends Object

A node of an AgcTreeControl. This object is returned after a new item is added to a tree control, enabling the code to add new items after or under it, or to delete it later. AgcTreeControl is also returned when a tree item is selected, the item's text or argument can be retrieved. Associated with each node are a text string and a user data item, the latter being any object, defined by the programmer for any purpose (often to identify the particular node or to store data related to the node).

See Also:
AgcTreeControl

Constructor Summary
AgoTreeControlNode()
           
 
Method Summary
 AgoTreeControlNode getChildNode()
          Gets the first child of this node.
 int getFontStyle()
          Returns the integer (AgoFontIdentifier constant) value specifying the font style of this node, (e.g.
 Image getImage()
          Gets the image which is displayed for this node.
 AgoTreeControlNode getNextNode()
          Gets the next tree node - that is, the sibling after this one.
 AgoTreeControlNode getParentNode()
          Gets the parent of this node.
 AgoTreeControlNode getPreviousNode()
          Gets the previous tree node - that is, the sibling before this one.
 String getText()
          Gets the text associated with this node
 Object getUserData()
          Gets the user data associated with this node.
 void setFontStyle(int style)
          Sets the font style of this node.
 void setImage(Image image)
          Sets the image to be displayed for this node.
 void setText(String text)
          Sets the text associated with this node
 void setUserData(Object userData)
          Sets the user data associated with this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgoTreeControlNode

public AgoTreeControlNode()
Method Detail

getText

public String getText()
Gets the text associated with this node
Example:
 	// extract the text associated with the currently selected node
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	String text = nodeSelected.getText();
 

setText

public void setText(String text)
Sets the text associated with this node
Parameters:
text - a String that will be used to set the text for this node
Example:
 	// set the text for the currently selected node to a different value
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	nodeSelected.setText("New Value");
 

getUserData

public Object getUserData()
Gets the user data associated with this node. The user data can be any object, defined by the programmer for any purpose (often to identify the particular node or to store data related to the node).
Example:
 	// extract the user data associated with the currently selected node
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	Object stuff = nodeSelected.getUserData();
 	if (stuff instanceof String)
 		System.out.println((String)stuff);
 

setUserData

public void setUserData(Object userData)
Sets the user data associated with this node. The user data can be any object, defined by the programmer for any purpose (often to identify the particular node or to store data related to the node).
Parameters:
userData - any programmer-defined Object
Example:
 	// set the user data for the currently selected node to a new value,
 	// a Vector containing an Integer and a Boolean
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	Vector v = {new Integer(3), new Boolean(true)};
 	nodeSelected.setUserData(v);
 

getImage

public Image getImage()
Gets the image which is displayed for this node.
Example:
 	// extract the image associated with the currently selected node
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	Image img = nodeSelected.getImage();
 

setImage

public void setImage(Image image)
Sets the image to be displayed for this node.
Parameters:
image - an Image object to be associated with this node
Example:
 	// set the image to be displayed for the currently selected node
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	Image myImage = getImage("employee.gif");
 	nodeSelected.setImage(myImage);
 

getFontStyle

public int getFontStyle()
Returns the integer (AgoFontIdentifier constant) value specifying the font style of this node, (e.g. BOLD, ITALIC, PLAIN).
Example:
 	// get the font style for the currently selected node, and apply it to the node below
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	int fontStyle = nodeSelected.getFontStyle();
 	AgoTreeControlNode nextNode = nodeSelected.getNextNode();
 	if (nextNode != null)
 		nextNode.setFontStyle(fontStyle);
 

setFontStyle

public void setFontStyle(int style)
Sets the font style of this node.
Parameters:
style - integer font identifier. Values can be BOLD, ITALIC, BOLDITALICBAND, BOLDBAND, ITALICBAND, DEFALUTBAND.
Example:
 	// get the font style for the currently selected node, and apply it to the node below
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	int fontStyle = nodeSelected.getFontStyle();
 	AgoTreeControlNode nextNode = nodeSelected.getNextNode();
 	if (nextNode != null)
 		nextNode.setFontStyle(fontStyle);
 

getNextNode

public AgoTreeControlNode getNextNode()
Gets the next tree node - that is, the sibling after this one. Returns null if there is no sibling after this one.
Example:
 	// get the font style for the currently selected node, and apply it to the node below
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	int fontStyle = nodeSelected.getFontStyle();
 	AgoTreeControlNode nextNode = nodeSelected.getNextNode();
 	if (nextNode != null)
 		nextNode.setFontStyle(fontStyle);
 

getPreviousNode

public AgoTreeControlNode getPreviousNode()
Gets the previous tree node - that is, the sibling before this one. Returns null if there is no sibling before this one.
Example:
 	// see if the currently selected node has a sibling node preceding it,
 	// and if so, delete the selected node
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	AgoTreeControlNode nodePrevious = nodeSelected.getPreviousNode();
 
 	if (nodePrevious != null) tableTree.remove(nodeSelected);
 

getChildNode

public AgoTreeControlNode getChildNode()
Gets the first child of this node. Returns null if there is none.
Example:
 	// see if the currently selected node has a child, and if so, delete the child node
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	AgoTreeControlNode nodeChild = nodeSelected.getChildNode();
 
 	if (nodeChild != null) tableTree.remove(nodeChild);
 

getParentNode

public AgoTreeControlNode getParentNode()
Gets the parent of this node. Returns null if there is none.
Example:
 	// find the topmost parent of the currently selected node
 	AgoTreeControlNode nodeSelected = tableTree.getSelectedNode();
 	AgoTreeControlNode nodeTop = nodeSelected;
 	AgoTreeControlNode nodeParent;
 	while ((nodeParent = nodeTop.getParentNode()) != null)
 	{
 		nodeTop = nodeParent;
 	}
 	System.out.println("Topmost parent is "+nodeTop.getText());
 

SilverStream
Application Server 3.5