public class DefaultTreeModelWrapper extends AbstractTreeModel implements TreeModelWrapper, TreeModelListener
TreeModel
and TreeModelWrapper
.
Modifier and Type | Field and Description |
---|---|
static int |
EVENT_TYPE_NODES_CHANGED |
static int |
EVENT_TYPE_NODES_INSERTED |
static int |
EVENT_TYPE_NODES_REMOVED |
static int |
EVENT_TYPE_STRUCTURE_CHANGED |
listenerList
Constructor and Description |
---|
DefaultTreeModelWrapper()
Creates an empty
DefaultTreeModelWrapper . |
DefaultTreeModelWrapper(TreeModel model)
Creates a DefaultTreeModelWrapper from for a tree model.
|
Modifier and Type | Method and Description |
---|---|
protected void |
clearAllListModelWrappers() |
protected void |
clearListModelWrapper(Object node) |
protected void |
configureListModelWrapper(ListModelWrapper wrapper,
Object node)
This is the method that will be called to configure the empty list model wrapper you created in
createListModelWrapper(Object) . |
protected TreeModelEvent |
convertTreeModelEvent(TreeModelEvent e)
Deprecated.
|
protected TreeModelEvent |
convertTreeModelEvent(TreeModelEvent e,
int eventType)
Converts the tree model event for the actual model to the event for this model.
|
protected ListModelWrapper |
createListModelWrapper(Object node)
Creates an empty list model wrapper.
|
TreeModel |
getActualModel()
Gets the actual tree model.
|
Object |
getChild(Object parent,
int index)
Implementations of the method in TreeModel.
|
int |
getChildCount(Object parent)
Implementations of the method in TreeModel.
|
int |
getIndexOfChild(Object parent,
Object child)
Implementations of the method in TreeModel.
|
protected ListModelWrapper |
getListModelWrapper(Object node)
Get the list model wrapper for the node.
|
Object |
getRoot()
Implementations of the method in TreeModel.
|
protected void |
initWrapper(Object node) |
boolean |
isLeaf(Object node)
Implementations of the method in TreeModel.
|
void |
setActualModel(TreeModel model)
Sets the actual tree model.
|
protected void |
setListModelWrapper(Object node,
ListModelWrapper wrapper) |
void |
treeNodesChanged(TreeModelEvent e)
Method for TreeModelListener.
|
void |
treeNodesInserted(TreeModelEvent e)
Method for TreeModelListener.
|
void |
treeNodesRemoved(TreeModelEvent e)
Method for TreeModelListener.
|
void |
treeStructureChanged(TreeModelEvent e)
Method for TreeModelListener.
|
void |
valueForPathChanged(TreePath path,
Object newValue)
Delegates to underlying tree model.
|
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeStructureChanged, getPathToRoot, getPathToRoot, getTreeModelListeners, nodeChanged, nodesChanged, removeTreeModelListener
public static final int EVENT_TYPE_STRUCTURE_CHANGED
public static final int EVENT_TYPE_NODES_INSERTED
public static final int EVENT_TYPE_NODES_REMOVED
public static final int EVENT_TYPE_NODES_CHANGED
public DefaultTreeModelWrapper()
DefaultTreeModelWrapper
.public DefaultTreeModelWrapper(TreeModel model)
model
- the original tree modelpublic void setActualModel(TreeModel model)
setActualModel
in interface TreeModelWrapper
model
- the original tree modelpublic TreeModel getActualModel()
getActualModel
in interface TreeModelWrapper
public Object getRoot()
public int getIndexOfChild(Object parent, Object child)
getIndexOfChild
in interface TreeModel
public Object getChild(Object parent, int index)
public int getChildCount(Object parent)
getChildCount
in interface TreeModel
public boolean isLeaf(Object node)
protected ListModelWrapper getListModelWrapper(Object node)
node
- the tree nodesetListModelWrapper(Object, com.jidesoft.list.ListModelWrapper)
protected void setListModelWrapper(Object node, ListModelWrapper wrapper)
protected void clearListModelWrapper(Object node)
protected void clearAllListModelWrappers()
protected void initWrapper(Object node)
protected ListModelWrapper createListModelWrapper(Object node)
FilterableTreeModel
overrides it to create an instance of FilterableListModel
. SortableTreeModel
overrides it to create an instance of SortableListModel
.
Default implementation of this method in this class simply returns a new instance of
DefaultListModelWrapper
.node
- the tree nodeprotected void configureListModelWrapper(ListModelWrapper wrapper, Object node)
createListModelWrapper(Object)
. Subclass can override it to configure the list model. For example, FilterableTreeModel
uses this method to add filters that defined on FilterableTreeModel
to
FilterableListModel
and turn those filters on.
In default implementation on DefaultTreeModelWrapper
, this method is empty.wrapper
- the wrapper to be configured.node
- the tree nodepublic void valueForPathChanged(TreePath path, Object newValue)
valueForPathChanged
in interface TreeModel
valueForPathChanged
in class AbstractTreeModel
path
- the tree pathnewValue
- the new valuepublic void treeNodesChanged(TreeModelEvent e)
treeNodesChanged
in interface TreeModelListener
e
- the TreeModelEventpublic void treeNodesInserted(TreeModelEvent e)
treeNodesInserted
in interface TreeModelListener
e
- the TreeModelEventpublic void treeNodesRemoved(TreeModelEvent e)
treeNodesRemoved
in interface TreeModelListener
e
- the TreeModelEventpublic void treeStructureChanged(TreeModelEvent e)
treeStructureChanged
in interface TreeModelListener
e
- the TreeModelEvent@Deprecated protected TreeModelEvent convertTreeModelEvent(TreeModelEvent e)
convertTreeModelEvent(javax.swing.event.TreeModelEvent, int)
e
- the TreeModelEventprotected TreeModelEvent convertTreeModelEvent(TreeModelEvent e, int eventType)
e
- the TreeModelEventeventType
- the event type, EVENT_TYPE_NODES_INSERTED
, EVENT_TYPE_NODES_REMOVED
or EVENT_TYPE_NODES_CHANGED