public class TLcdFlatListTreeModel extends Object implements TreeModel
A TreeModel
for a tree based on an ILcdLayered
instance, which can be used to visualise the layers in the ILcdLayered
using a
JTree
. It will only show the flat structure of the layers in the
ILcdLayered
. When for example an ILcdLayerTreeNode
with children is
contained in the ILcdLayered
, it will only show the ILcdLayerTreeNode
and not its child nodes.
This model also adds a listener to the ILcdLayered
instance, and converts all the
TLcdLayeredEvent
s originating from it into the
corresponding TreeModelEvent
s which are passed to the
TreeModelListener
s registered to this model.
Constructor and Description |
---|
TLcdFlatListTreeModel(ILcdLayered aLayered)
Create a new instance of
TLcdFlatListTreeModel based on the layers in
aLayered . |
Modifier and Type | Method and Description |
---|---|
void |
addTreeModelListener(TreeModelListener l) |
Object |
getChild(Object parent,
int index) |
int |
getChildCount(Object parent) |
int |
getIndexOfChild(Object parent,
Object child) |
Object |
getRoot() |
boolean |
isLeaf(Object node) |
void |
removeTreeModelListener(TreeModelListener l) |
void |
valueForPathChanged(TreePath path,
Object newValue) |
public TLcdFlatListTreeModel(ILcdLayered aLayered)
TLcdFlatListTreeModel
based on the layers in
aLayered
. The root node of this model is not relevant, and it is advised to not
display it (JTree#setRootVisible(false)
).
Editing this tree model by using valueForPathChanged
is not supported.aLayered
- the ILcdLayered
containing all the layers for this modelpublic int getChildCount(Object parent)
getChildCount
in interface TreeModel
public void valueForPathChanged(TreePath path, Object newValue)
valueForPathChanged
in interface TreeModel
public int getIndexOfChild(Object parent, Object child)
getIndexOfChild
in interface TreeModel
public void addTreeModelListener(TreeModelListener l)
addTreeModelListener
in interface TreeModel
public void removeTreeModelListener(TreeModelListener l)
removeTreeModelListener
in interface TreeModel