|
Jive API (3.0.13) Core Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CommentTreeWalker
Allows hierarchical navigation of comments. It closely follows the TreeModel interface in Swing in the hopes of being easier to use.
CommentManager| Method Summary | |
|---|---|
JiveIterator<Comment> |
children(Comment parent)
Returns an Iterable for all the child comments of the parent. |
Comment |
getChild(Comment parent,
int index)
Returns the child of parent at index index in the parent's child array. |
int |
getChildCount(Comment parent)
Returns the number of children of parent. |
int |
getCommentDepth(Comment comment)
Returns the depth of a comment in the comment tree hierarchy. |
int |
getIndexOfChild(Comment parent,
Comment child)
Returns the index of child in parent. |
Comment |
getParent(Comment child)
Returns the parent of the child comment. |
int |
getRecursiveChildCount(Comment parent)
Returns the total number of recursive children of a parent. |
boolean |
isLeaf(Comment node)
Returns true if node is a leaf. |
JiveIterator<Comment> |
recursiveChildren(Comment parent)
Returns an Iterable for all child comments (and sub-children, etc) of the parent. |
JiveIterator<Comment> |
topLevelComments()
Returns an iterator of top level comments. |
| Method Detail |
|---|
JiveIterator<Comment> topLevelComments()
Comment getParent(Comment child)
throws CommentNotFoundException
child comment. If the parent does not exist, this method will
return null. If the parent does exist, but cannot be loaded, this method will throw a
CommentNotFoundException
child - the child comment to return the parent for
CommentNotFoundException - if child does not have a parent, or if the parent comment
could not be loaded for any other reason.
Comment getChild(Comment parent,
int index)
throws CommentNotFoundException
index >= 0, and index < getChildCount(parent).
If the index is not valid, this method will return null, otherwise if the child could not be loaded
for any other reason, a CommentNotFoundException will be thrown.
parent - the parent comment.index - the index of the child.
CommentNotFoundException - if the index was invalid or the child could not be loaded
for any other reason.JiveIterator<Comment> children(Comment parent)
parent - the parent comment.
JiveIterator<Comment> recursiveChildren(Comment parent)
1 |-- 3 |-- |-- 4 |-- |-- |-- 7 |-- |-- |-- |-- 10 |-- |-- 6 |-- |-- 8 |-- 5Calling recursiveChildren(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 comment, especially in combination with the
getCommentDepth(Comment) method.
parent - the parent comment.
int getCommentDepth(Comment comment)
1 |-- 3 |-- |-- 4 |-- |-- |-- 7The depth of comment 4 is 2, the depth of comment 7 is 3, etc. This method is useful in combination with the
recursiveChildren(Comment) Iterable to build a UI of
hierarchical comments.
comment - the comment to determine the depth of.
int getChildCount(Comment parent)
parent - a node in the tree, obtained from this data source.
int getRecursiveChildCount(Comment parent)
parent - the parent comment to return a recursive child count for
parent.
int getIndexOfChild(Comment parent,
Comment 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 comment.child - the child comment to get the index for.
boolean isLeaf(Comment node)
node - a node in the tree, obtained from this data source
|
Jive Product Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||