PAJES 3.0.21

org.pajes.html.tree
Class TreePaje

java.lang.Object
  extended by org.pajes.html.Tag
      extended by org.pajes.html.TraversableElement
          extended by org.pajes.html.Container
              extended by org.pajes.html.Paje
                  extended by org.pajes.html.tree.TreePaje
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HTML, Traversable

public class TreePaje
extends Paje

Creates a frame set containing a client-side tree control.

This class also contains static methods to return an appropriate line of JavaScript that will call the various tree modification functions. Use TreeFactory.create(java.text.MessageFormat, java.util.Enumeration, org.pajes.html.PajeFactory.Document) to create new instances of TreePaje.

See Also:
Serialized Form

Nested Class Summary
 class TreePaje.Node
          Inner class representing a node of the tree.
 
Field Summary
static java.lang.String DEFAULT_NODE_NAME_PREFIX
          The prefix for the default node name.
static java.lang.String DOCUMENT_FRAME
          The name of the frame that will contain the result when the user selects a node in the tree.
static java.lang.String ROOT_NODE_NAME
          The name of the root node ("root").
static java.lang.String TREE_FRAME
          The name of the frame that will contain the tree display.
 
Fields inherited from class org.pajes.html.Tag
ON_CLICK_ATTRIBUTE, TAG_CLOSE, TAG_LEFT, TAG_RIGHT
 
Constructor Summary
TreePaje()
          Creates an HTML document containing a Tree frame set.
 
Method Summary
 java.lang.Object clone()
          Allows a tag to be cloned.
static java.lang.String jsChangeNodeDescription(java.lang.String name, java.lang.String description)
          Returns a line of JavaScript that will alter the text of the specified node in the tree.
static java.lang.String jsChangeNodeURL(java.lang.String name, java.lang.String url)
          Returns a line of JavaScript that will alter the URL of the specified node in the tree.
static java.lang.String jsCloseNode(java.lang.String name)
          Returns a line of JavaScript that will close the specified node in the tree.
static java.lang.String jsCreateNode(java.lang.String name, java.lang.String description, java.lang.String url)
          Returns a line of JavaScript that will create a new node.
static java.lang.String jsHighlightNode(java.lang.String name, boolean on)
          Returns a line of JavaScript that will alter the highlighting of a specified node in the tree.
static java.lang.String jsInsertNode(java.lang.String name, java.lang.String parent, java.lang.String sibling, boolean insertAsPreviousSibling)
          Returns a line of JavaScript that will insert the specified node in the tree.
static java.lang.String jsMoveNode(java.lang.String name, java.lang.String parent, java.lang.String sibling, boolean insertAsPreviousSibling)
          Returns a line of JavaScript that will move the specified node from its current parent to a new parent.
static java.lang.String jsOpenNode(java.lang.String name)
          Returns a line of JavaScript that will open the specified node in the tree.
static java.lang.String jsOpenParentNode(java.lang.String name)
          Returns a line of JavaScript that will open the parent of the specified node in the tree.
static java.lang.String jsRedrawTree()
          Returns a line of JavaScript that will redraw the tree.
static java.lang.String jsRemoveNode(java.lang.String name)
          Returns a line of JavaScript that will remove the specified node from the tree.
 TreePaje.Node makeNode(java.lang.String description, java.lang.String url, boolean isOpen)
          Creates a new Node with a default name of DEFAULT_NODE_NAME_PREFIX suffixed with a sequential number starting at 0.
 TreePaje.Node makeNode(java.lang.String name, java.lang.String description, java.lang.String url, boolean isOpen)
          Creates a new Node.
 TreePaje setBaseHREF(java.lang.String url)
          Sets the base HREF of documents that will appear in the DOCUMENT_FRAME.
 TreePaje.Node setRootNode(java.lang.String description, java.lang.String url, boolean isOpen)
          Sets the top-most (root) tree node.
 TreePaje setTreeTitle(java.lang.String treeTitle)
          Sets the title of the tree, which will appear above the root node.
 
Methods inherited from class org.pajes.html.Paje
add, add, destroy, getBody, getDocType, getDocTypeHeader, getHead, getXMLEncoding, getXMLVersion, isFirstClone, replace, setCached, setDestroyAfterWrite, setDocType, setDocType, setOnLoadAlert, setXHTMLCompliance, setXMLEncoding, setXMLVersion, toString, useCompression, usePersistentConnection, write, write
 
Methods inherited from class org.pajes.html.Container
add, add, addContent, clear, delete, delete, get, getContent, getContents, getPosition, insert, set, setContent, setContent, size, writeContent
 
Methods inherited from class org.pajes.html.TraversableElement
dump, dump, getAll, getFieldByName, getFirstFieldByName, getFirstTagByAttribute, getFirstTagByClass, getFirstTagByID, getFirstTagByName, getTagByAttribute, getTagByClass, getTagByID, getTagByName, setWritable
 
Methods inherited from class org.pajes.html.Tag
addAttribute, addAttributes, addAttributes, clearAttribute, clearAttributes, getAttribute, getAttributes, getAttributeSet, getContainer, getDocument, getId, getOnClickHandler, getOnDBLClickHandler, getOnKeyDownHandler, getOnKeyPressHandler, getOnKeyUpHandler, getOnMouseDownHandler, getOnMouseOutHandler, getOnMouseOverHandler, getOnMouseUpHandler, getParent, getStyle, getStyleSheetClass, getTagName, getTitle, getWritePermission, hasAttribute, init, initAttributes, isChildOf, isChildOf, isWritable, isWritable, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setContainer, setId, setOnClickHandler, setOnDBLClickHandler, setOnKeyDownHandler, setOnKeyPressHandler, setOnKeyUpHandler, setOnMouseDownHandler, setOnMouseOutHandler, setOnMouseOverHandler, setOnMouseUpHandler, setParent, setStyle, setStyleSheetClass, setTagName, setTitle, setWritable, setWriteAttributes, setWriteEndTag, setWritelnAfter, setWritelnAfterContent, setWritelnBefore, setWritelnBeforeContent, setWritePermission
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pajes.html.Traversable
isWritable
 
Methods inherited from interface org.pajes.html.HTML
getContainer, getDocument, getId, getParent, getWritePermission, isChildOf, isChildOf, setContainer, setParent, setWritePermission
 

Field Detail

ROOT_NODE_NAME

public static final java.lang.String ROOT_NODE_NAME
The name of the root node ("root").

See Also:
Constant Field Values

DEFAULT_NODE_NAME_PREFIX

public static final java.lang.String DEFAULT_NODE_NAME_PREFIX
The prefix for the default node name.

See Also:
makeNode(String, String, boolean), Constant Field Values

DOCUMENT_FRAME

public static final java.lang.String DOCUMENT_FRAME
The name of the frame that will contain the result when the user selects a node in the tree.

See Also:
Constant Field Values

TREE_FRAME

public static final java.lang.String TREE_FRAME
The name of the frame that will contain the tree display.

See Also:
Constant Field Values
Constructor Detail

TreePaje

public TreePaje()
Creates an HTML document containing a Tree frame set. Instances should only be created by TreeFactory.create(java.text.MessageFormat, java.util.Enumeration, org.pajes.html.PajeFactory.Document).

Method Detail

jsChangeNodeDescription

public static java.lang.String jsChangeNodeDescription(java.lang.String name,
                                                       java.lang.String description)
Returns a line of JavaScript that will alter the text of the specified node in the tree.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript variable name of the node.
description - the description to appear on the tree.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsChangeNodeURL

public static java.lang.String jsChangeNodeURL(java.lang.String name,
                                               java.lang.String url)
Returns a line of JavaScript that will alter the URL of the specified node in the tree.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript variable name of the node.
url - the destination URL when this node is selected. If null, selecting the node will have no effect.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsCloseNode

public static java.lang.String jsCloseNode(java.lang.String name)
Returns a line of JavaScript that will close the specified node in the tree.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript variable name of the node.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsCreateNode

public static java.lang.String jsCreateNode(java.lang.String name,
                                            java.lang.String description,
                                            java.lang.String url)
Returns a line of JavaScript that will create a new node.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript name of this node. This must be unique within the tree.
description - the description to appear on the tree.
url - the destination URL when this node is selected. If null, selecting the node will have no effect.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsHighlightNode

public static java.lang.String jsHighlightNode(java.lang.String name,
                                               boolean on)
Returns a line of JavaScript that will alter the highlighting of a specified node in the tree.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript variable name of the node.
on - if true, highlights the node.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsInsertNode

public static java.lang.String jsInsertNode(java.lang.String name,
                                            java.lang.String parent,
                                            java.lang.String sibling,
                                            boolean insertAsPreviousSibling)
Returns a line of JavaScript that will insert the specified node in the tree. This method will not create a node - use jsCreateNode(java.lang.String, java.lang.String, java.lang.String) to return the JavaScript statement that will create a new node.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript variable name of the node.
parent - the JavaScript variable name of the parent node to which this node is to be added. If null, the node is inserted at the root of the tree, after any existing root nodes.
sibling - the JavaScript variable name of the sibling node. Use null to add as the last child of the specified parent.
insertAsPreviousSibling - if true, the specified node is inserted before the specified sibling; if false, it is inserted after.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsMoveNode

public static java.lang.String jsMoveNode(java.lang.String name,
                                          java.lang.String parent,
                                          java.lang.String sibling,
                                          boolean insertAsPreviousSibling)
Returns a line of JavaScript that will move the specified node from its current parent to a new parent.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript variable name of the node.
parent - the JavaScript variable name of the new parent node to which this node is to be added. If null, the node is inserted at the root of the tree, after any existing root nodes.
sibling - the JavaScript variable name of the sibling node. Use null to add as the last child of the specified parent.
insertAsPreviousSibling - if true, the specified node is inserted before the specified sibling; if false, it is inserted after.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsOpenNode

public static java.lang.String jsOpenNode(java.lang.String name)
Returns a line of JavaScript that will open the specified node in the tree.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript variable name of the node.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsOpenParentNode

public static java.lang.String jsOpenParentNode(java.lang.String name)
Returns a line of JavaScript that will open the parent of the specified node in the tree.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript variable name of the node.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsRedrawTree

public static java.lang.String jsRedrawTree()
Returns a line of JavaScript that will redraw the tree.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

jsRemoveNode

public static java.lang.String jsRemoveNode(java.lang.String name)
Returns a line of JavaScript that will remove the specified node from the tree.

Note that this JavaScript function is for use after the tree has been displayed, and should be called only from an HTML page returned to the DOCUMENT_FRAME.

Parameters:
name - the JavaScript variable name of the node.
Returns:
a line of JavaScript to be included in an appropriate <SCRIPT>: tag or JavaScript event handler.

clone

public java.lang.Object clone()
Description copied from class: Container
Allows a tag to be cloned. Over-rides the clone() method in Tag to do a deep clone: all the objects contained in this object will be cloned individually.

Specified by:
clone in interface HTML
Overrides:
clone in class Paje
Returns:
a clone of this Container.
See Also:
Object.clone()

makeNode

public TreePaje.Node makeNode(java.lang.String description,
                              java.lang.String url,
                              boolean isOpen)
Creates a new Node with a default name of DEFAULT_NODE_NAME_PREFIX suffixed with a sequential number starting at 0.

Parameters:
description - the description to appear on the tree.
url - the destination URL when this node is selected. If null, selecting the node will have no effect.
isOpen - true if the initial state of this node is open (i.e. any child elements are automatically displayed).
Returns:
a new Node object.

makeNode

public TreePaje.Node makeNode(java.lang.String name,
                              java.lang.String description,
                              java.lang.String url,
                              boolean isOpen)
Creates a new Node.

Parameters:
name - the JavaScript name of this node. This must be unique within the tree.
description - the description to appear on the tree.
url - the destination URL when this node is selected. If null, selecting the node will have no effect.
isOpen - true if the initial state of this node is open (i.e. any child elements are automatically displayed).
Returns:
a new Node object.

setBaseHREF

public TreePaje setBaseHREF(java.lang.String url)
Sets the base HREF of documents that will appear in the DOCUMENT_FRAME.

Parameters:
url - the base HREF.
Returns:
the modified TreePaje object.

setRootNode

public TreePaje.Node setRootNode(java.lang.String description,
                                 java.lang.String url,
                                 boolean isOpen)
Sets the top-most (root) tree node. All subsequent nodes are defined by their relationship to the root node.

The root node is always named ROOT_NODE_NAME.

Parameters:
description - the description to appear on the tree.
url - the destination URL when this node is selected.
isOpen - true if the initial state of this node is open (i.e. any child nodes are automatically displayed).
Returns:
the instance of the root tree node.

setTreeTitle

public TreePaje setTreeTitle(java.lang.String treeTitle)
Sets the title of the tree, which will appear above the root node.

Parameters:
treeTitle - the title of the page. Set to null (the default) to suppress the tree title.
Returns:
the modified TreePaje object.

PAJES 3.0.21

Copyright © 1998-2007 Viridian Pty Limited. All Rights Reserved.