|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tbee.swing.tree.TreeModelSupport
org.tbee.swing.tree.AbstractTreeModel<T>
public abstract class AbstractTreeModel<T>
A utility class to create custom TreeModels where the nodes themselves do not need to implement TreeNode or MutableTreeNode. The object representing a tree node should have "toString" return the text that will be shown in the tree. If an array, List, Set, or Map is used, only getRoot (because we need to start somewhere) and loadChilderen need to be extended.
| Field Summary | |
|---|---|
static int |
LOADONDEMAND_MINIMAL
|
static int |
LOADONDEMAND_VISUAL
|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
protected Map<T,Collection<T>> |
treeNodes
|
| Constructor Summary | |
|---|---|
AbstractTreeModel()
|
|
| Method Summary | |
|---|---|
void |
clear()
Clear the cache |
void |
clear(T node)
Remove one node and all its childeren from the cache |
Object |
getChild(Object parent,
int index)
|
int |
getChildCount(Object parent)
|
Collection<T> |
getChilderen(T parent)
Get all childeren of a node and load them if they are not in the cache |
int |
getIndexOfChild(Object parent,
Object child)
|
int |
getLoadOnDemandMode()
|
T |
getParent(T child)
Find the parent using a child. |
abstract T |
getRoot()
|
TreePath |
getTreePathFor(T node)
Get the treepath for a node |
boolean |
isLeaf(Object node)
|
boolean |
isLoaded(T node)
Detect if the node in question has been loaded or not (loading on demand) |
protected Collection<T> |
loadChilderen(T parent)
loading-on-demand hook-in |
static void |
main(String[] args)
open a frame for quick testing |
void |
setLoadOnDemandMode(int mode)
The load-on-demand mode sets how much data is loaded. |
void |
updateChilderen(T parent,
Collection<T> childeren)
|
void |
valueForPathChanged(TreePath path,
Object newValue)
|
| Methods inherited from class org.tbee.swing.tree.TreeModelSupport |
|---|
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, removeTreeModelListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.tree.TreeModel |
|---|
addTreeModelListener, removeTreeModelListener |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
protected Map<T,Collection<T>> treeNodes
public static int LOADONDEMAND_MINIMAL
public static int LOADONDEMAND_VISUAL
| Constructor Detail |
|---|
public AbstractTreeModel()
| Method Detail |
|---|
public abstract T getRoot()
getRoot in interface TreeModelprotected Collection<T> loadChilderen(T parent)
parent -
public void setLoadOnDemandMode(int mode)
public int getLoadOnDemandMode()
public void clear()
node - public void clear(T node)
node - public TreePath getTreePathFor(T node)
node -
public boolean isLoaded(T node)
public int getChildCount(Object parent)
getChildCount in interface TreeModelTreeModel.getChildCount(java.lang.Object)public Collection<T> getChilderen(T parent)
public void updateChilderen(T parent,
Collection<T> childeren)
parent - childeren -
public Object getChild(Object parent,
int index)
getChild in interface TreeModelTreeModel.getChild(java.lang.Object, int)
public int getIndexOfChild(Object parent,
Object child)
getIndexOfChild in interface TreeModelTreeModel.getIndexOfChild(java.lang.Object, java.lang.Object)public boolean isLeaf(Object node)
isLeaf in interface TreeModel
public void valueForPathChanged(TreePath path,
Object newValue)
valueForPathChanged in interface TreeModelpublic T getParent(T child)
public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||