|
Jive Forums API (5.5.20.2-oracle) Core Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TreeWalker
Allows hierarchical navigation of a Thread. It closely follows the TreeModel interface in Swing in the hopes of being easier to use.
ForumThread
Method Summary | |
---|---|
ForumMessage |
getChild(ForumMessage parent,
int index)
Returns the child of parent at index index in the parent's child array. |
int |
getChildCount(ForumMessage parent)
Returns the number of children of parent. |
java.util.Iterator |
getChildren(ForumMessage parent)
Returns an Iterator for all the child messages of the parent. |
int |
getIndexOfChild(ForumMessage parent,
ForumMessage child)
Returns the index of child in parent. |
int |
getMessageDepth(ForumMessage message)
Returns the depth of a message in the message tree hierarchy. |
ForumMessage |
getParent(ForumMessage child)
Returns the parent of the child ForumMessage. |
int |
getRecursiveChildCount(ForumMessage parent)
Returns the total number of recursive children of a parent. |
java.util.Iterator |
getRecursiveChildren(ForumMessage parent)
Returns an Iterator for all child messages (and sub-children, etc) of the parent. |
java.util.Iterator |
getRecursiveMessages()
Returns an Iterator for all messages in the thread in depth-first order. |
ForumMessage |
getRoot()
Returns the root of the tree. |
boolean |
hasParent(ForumMessage child)
Returns true if the child message has a parent message. |
boolean |
isLeaf(ForumMessage node)
Returns true if node is a leaf. |
Method Detail |
---|
ForumMessage getRoot()
boolean hasParent(ForumMessage child)
child
message has a parent message.
child
- the message.
ForumMessage getParent(ForumMessage child) throws ForumMessageNotFoundException
child
ForumMessage.
ForumMessageNotFoundException
- if child does not have a parent,
or if the parent message could not be loaded for any other reason.ForumMessage getChild(ForumMessage parent, int index) throws ForumMessageNotFoundException
index
>= 0, and
index
< getChildCount(parent). If the index is not valid,
or if the child could not be loaded for any other reason, a
ForumMessageNotFoundException will be thrown.
parent
- the parent message.index
- the index of the child.
ForumMessageNotFoundException
- if the index was invalid or the
child could not be loaded for any other reason.java.util.Iterator getChildren(ForumMessage parent)
getRecursiveChildren(ForumMessage)
method.
parent
- the parent message.
java.util.Iterator getRecursiveMessages()
1 |-- 3 |-- |-- 4 |-- |-- |-- 7 |-- |-- |-- |-- 10 |-- |-- 6 |-- |-- 8 |-- 5Calling getRecursiveMessages() on the tree above would return the sequence 1, 3, 4, 7, 10, 6, 8, 5. This method is a powerful way to show the full tree of messages, especially in combination with the
getMessageDepth(ForumMessage)
method.
java.util.Iterator getRecursiveChildren(ForumMessage parent)
1 |-- 3 |-- |-- 4 |-- |-- |-- 7 |-- |-- |-- |-- 10 |-- |-- 6 |-- |-- 8 |-- 5Calling getRecursiveChildren(3) on the tree above would return the sequence 4, 7, 10, 6, 8. This method is a powerful way to show all children of a message, especially in combination with the
getMessageDepth(ForumMessage)
method.
parent
- the parent message.
int getMessageDepth(ForumMessage message)
1 |-- 3 |-- |-- 4 |-- |-- |-- 7The depth of message 4 is 2, the depth of message 7 is 3, etc. This method is useful in combination with the
getRecursiveChildren(ForumMessage)
Iterator to build a UI of hierarchical messages.
message
- the message to determine the depth of.
int getChildCount(ForumMessage parent)
parent
- a node in the tree, obtained from this data source.
int getRecursiveChildCount(ForumMessage parent)
parent
.int getIndexOfChild(ForumMessage parent, ForumMessage child)
4 |-- 2 |-- |-- 1 |-- |-- 6 |-- |-- 8 |-- 5In this example, getIndexOfChild(4, 2) would return 0, getIndexOfChild(4, 5) would return 1, and getIndexOfChild(2, 8) would return 2. getIndexOfChild(4, 8) -- NOT VALID
parent
- the parent message.child
- the child message to get the index for.
boolean isLeaf(ForumMessage node)
node
- a node in the tree, obtained from this data source
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |