SourceForge.net Logo
aXSL API 0.1

org.axsl.common
Interface OrderedTreeNode

All Superinterfaces:
javax.swing.tree.TreeNode
All Known Subinterfaces:
AbstractFlow, AbstractNormalBlockArea, AbstractTableBody, AbstractTableContainer, Area, AreaNode, AreaTree, BasicLink, BasicLinkArea, BeforeFloatRA, BidiOverride, Block, BlockArea, BlockContainer, BlockContainerRA, Bookmark, BookmarkTitle, BookmarkTree, Character, ColorProfile, ContainerRA, ContinuedLabel, Declarations, ExternalGraphic, ExternalGraphicArea, Float, Flow, FObj, FObjMixed, FObjScaled, FONode, Footnote, FootnoteBody, FootnoteRA, ForeignObjectArea, ForeignXML, FOText, FOTextContent, GenericContainer, InitialPropertySet, Inline, InlineArea, InlineContainer, InstreamForeignObject, Leader, LeaderArea, LineArea, ListBlock, ListBlockArea, ListItem, ListItemArea, ListItemBody, ListItemLabel, MainRA, Marker, MarkerContentArea, MultiCase, MultiProperties, MultiPropertySet, MultiSwitch, MultiToggle, NormalBlockArea, NormalFlowRA, PageCollection, PageNumber, PageNumberArea, PageNumberCitation, PageNumberCitationArea, PageSequence, Region, RegionAfter, RegionArea, RegionBefore, RegionBody, RegionEnd, RegionRABody, RegionStart, RetrieveMarker, Root, SimplePageMaster, SpanRA, StaticContent, SVGElement, Table, TableAndCaption, TableArea, TableBody, TableBodyContainer, TableCaption, TableCell, TableCellArea, TableColumn, TableFooter, TableFooterContainer, TableHeader, TableHeaderContainer, TableRow, TableRowContainer, TextArea, Title, Wrapper

public interface OrderedTreeNode
extends javax.swing.tree.TreeNode

A TreeNode that is aware of its relationships not only to its parents and children, but also to its siblings. The order and placement of children is significant.


Method Summary
 java.util.List getChildren()
          Return the List of this node's children.
 OrderedTreeNode getFirstChild()
          Returns the first child of this node.
 OrderedTreeNode getFirstLeaf()
          Finds and returns the first leaf that is a descendant of this node -- either this node or its first child's first leaf.
 OrderedTreeNode getLastChild()
          Returns the last child of this node.
 OrderedTreeNode getLastLeaf()
          Finds and returns the last leaf that is a descendant of this node -- either this node or its last child's last leaf.
 OrderedTreeNode getNextLeaf()
          Returns the leaf after this node or null if this node is the last leaf in the tree.
 OrderedTreeNode getNextSibling()
          Returns the next sibling node.
 OrderedTreeNode getPreviousLeaf()
          Returns the leaf before this node or null if this node is the first leaf in the tree.
 OrderedTreeNode getPreviousSibling()
          Returns the previous sibling node.
 java.util.List getSiblings()
          Returns the List of this node's parent's children, which includes this node.
 boolean hasChildren()
          Reports whether this node has any children.
 OrderedTreeNode nextPreOrderNode()
          Returns the next node in the tree relative to the current node, in pre-order traversal order.
 int siblingIndex()
          Returns this node's position within the siblings.
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf
 

Method Detail

getChildren

public java.util.List getChildren()
Return the List of this node's children.

Returns:
The List of this node's children.

getSiblings

public java.util.List getSiblings()
Returns the List of this node's parent's children, which includes this node.

Returns:
The List of this node's parent's children.

siblingIndex

public int siblingIndex()
Returns this node's position within the siblings.

Returns:
The index to "this" in the parent's children.

getPreviousSibling

public OrderedTreeNode getPreviousSibling()
Returns the previous sibling node.

Returns:
Return the sibling immediately preceding "this" in the parent's children, or null if this is the first child.

getNextSibling

public OrderedTreeNode getNextSibling()
Returns the next sibling node.

Returns:
Return the sibling immediately following "this" in the parent's children, or null if this is the last child.

hasChildren

public boolean hasChildren()
Reports whether this node has any children.

Returns:
True if this AreaNode has any children, false if it has none.

getFirstChild

public OrderedTreeNode getFirstChild()
Returns the first child of this node.

Returns:
The first child of this node, or null if this node has no children.

getLastChild

public OrderedTreeNode getLastChild()
Returns the last child of this node.

Returns:
The last child of this node, or null if this node has no children.

nextPreOrderNode

public OrderedTreeNode nextPreOrderNode()
Returns the next node in the tree relative to the current node, in pre-order traversal order. This is also known as breadth-first order.

Returns:
The next pre-order node, or null if there is none.

getFirstLeaf

public OrderedTreeNode getFirstLeaf()
Finds and returns the first leaf that is a descendant of this node -- either this node or its first child's first leaf. Returns this node if it is a leaf. (Liberated from DefaultMutableTreeNode).

Returns:
the first leaf in the subtree rooted at this node
See Also:
TreeNode.isLeaf(), DefaultMutableTreeNode.isNodeDescendant(javax.swing.tree.DefaultMutableTreeNode)

getLastLeaf

public OrderedTreeNode getLastLeaf()
Finds and returns the last leaf that is a descendant of this node -- either this node or its last child's last leaf. Returns this node if it is a leaf. (Liberated from DefaultMutableTreeNode).

Returns:
the last leaf in the subtree rooted at this node
See Also:
TreeNode.isLeaf(), DefaultMutableTreeNode.isNodeDescendant(javax.swing.tree.DefaultMutableTreeNode)

getNextLeaf

public OrderedTreeNode getNextLeaf()
Returns the leaf after this node or null if this node is the last leaf in the tree.

In this implementation of the MutableNode interface, this operation is very inefficient. In order to determine the next node, this method first performs a linear search in the parent's child-list in order to find the current node.

That implementation makes the operation suitable for short traversals from a known position. But to traverse all of the leaves in the tree, you should use depthFirstEnumeration to enumerate the nodes in the tree and use isLeaf on each node to determine which are leaves. (Liberated from DefaultMutableTreeNode).

Returns:
returns the next leaf past this node
See Also:
DefaultMutableTreeNode.depthFirstEnumeration(), TreeNode.isLeaf()

getPreviousLeaf

public OrderedTreeNode getPreviousLeaf()
Returns the leaf before this node or null if this node is the first leaf in the tree.

In this implementation of the MutableNode interface, this operation is very inefficient. In order to determine the previous node, this method first performs a linear search in the parent's child-list in order to find the current node.

That implementation makes the operation suitable for short traversals from a known position. But to traverse all of the leaves in the tree, you should use depthFirstEnumeration to enumerate the nodes in the tree and use isLeaf on each node to determine which are leaves. (Liberated from DefaultMutableTreeNode).

Returns:
returns the leaf before this node
See Also:
DefaultMutableTreeNode.depthFirstEnumeration(), TreeNode.isLeaf()

SourceForge.net Logo
aXSL API 0.1

This documentation was created September 6 2006 by The aXSL Group and may be freely copied. See license for details.