K
- key type (usually Integer).V
- value type (usually String).public class Tree<K,V> extends java.lang.Object implements OptionProvider<K,V>
TreeProvider
object and will keep the
children in the same order they are returned by the provider. The only restriction is to have one of the
roots as first entry. Any orphan node will be put on the same level with the first entry (root).Constructor and Description |
---|
Tree(TreeProvider<K,V> provider)
Build a tree based on the information returned by the provider.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<Tree<K,V>> |
getChildren()
List of children.
|
static Tree<java.lang.Integer,java.lang.String> |
getDefaultTree(DBFunctions db)
Build a tree upon a simple query that has ID on the first column, parent ID on the second, and value
to be displayed on the third.
|
K |
getKey()
Key of this node.
|
java.util.Collection<Option<K,V>> |
getOptions()
|
java.util.Collection<Option<K,java.lang.String>> |
getOptionsFullPath(java.lang.String sSeparator)
Get the options having as value the concatenated values of the parents and their own, separated by
the specified separator.
|
V |
getValue()
Value for this node.
|
public Tree(TreeProvider<K,V> provider)
provider
- public K getKey()
public V getValue()
public java.util.List<Tree<K,V>> getChildren()
public java.util.Collection<Option<K,V>> getOptions()
getOptions
in interface OptionProvider<K,V>
public java.util.Collection<Option<K,java.lang.String>> getOptionsFullPath(java.lang.String sSeparator)
sSeparator
- some separator, for example " » "public static Tree<java.lang.Integer,java.lang.String> getDefaultTree(DBFunctions db)
BasicDBTreeProvider
to do
the actual work.db
- BasicDBTreeProvider