JIDE 3.5.15

com.jidesoft.tree
Class DefaultTreeModelWrapper

java.lang.Object
  extended by com.jidesoft.tree.AbstractTreeModel
      extended by com.jidesoft.tree.DefaultTreeModelWrapper
All Implemented Interfaces:
TreeModelWrapper, EventListener, TreeModelListener, TreeModel
Direct Known Subclasses:
FilterableTreeModel, SortableTreeModel

public class DefaultTreeModelWrapper
extends AbstractTreeModel
implements TreeModelWrapper, TreeModelListener

The default implementation of TreeModelWrapper. It implements all methods on TreeModel and TreeModelWrapper.


Field Summary
static int EVENT_TYPE_NODES_CHANGED
           
static int EVENT_TYPE_NODES_INSERTED
           
static int EVENT_TYPE_NODES_REMOVED
           
static int EVENT_TYPE_STRUCTURE_CHANGED
           
 
Fields inherited from class com.jidesoft.tree.AbstractTreeModel
listenerList
 
Constructor Summary
DefaultTreeModelWrapper()
          Creates an empty DefaultTreeModelWrapper.
DefaultTreeModelWrapper(TreeModel model)
          Creates a DefaultTreeModelWrapper from for a tree model.
 
Method Summary
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. replaced by convertTreeModelEvent(javax.swing.event.TreeModelEvent, int)
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.
 
Methods inherited from class com.jidesoft.tree.AbstractTreeModel
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeStructureChanged, getPathToRoot, getPathToRoot, getTreeModelListeners, nodeChanged, nodesChanged, removeTreeModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_TYPE_STRUCTURE_CHANGED

public static final int EVENT_TYPE_STRUCTURE_CHANGED
See Also:
Constant Field Values

EVENT_TYPE_NODES_INSERTED

public static final int EVENT_TYPE_NODES_INSERTED
See Also:
Constant Field Values

EVENT_TYPE_NODES_REMOVED

public static final int EVENT_TYPE_NODES_REMOVED
See Also:
Constant Field Values

EVENT_TYPE_NODES_CHANGED

public static final int EVENT_TYPE_NODES_CHANGED
See Also:
Constant Field Values
Constructor Detail

DefaultTreeModelWrapper

public DefaultTreeModelWrapper()
Creates an empty DefaultTreeModelWrapper.


DefaultTreeModelWrapper

public DefaultTreeModelWrapper(TreeModel model)
Creates a DefaultTreeModelWrapper from for a tree model.

Parameters:
model - the original tree model
Method Detail

setActualModel

public void setActualModel(TreeModel model)
Sets the actual tree model.

Specified by:
setActualModel in interface TreeModelWrapper
Parameters:
model - the original tree model

getActualModel

public TreeModel getActualModel()
Gets the actual tree model. Since TreeModelWrapper is just a wrapper around another tree model, this method will return you the actual tree model.

Specified by:
getActualModel in interface TreeModelWrapper
Returns:
the actual tree model.

getRoot

public Object getRoot()
Implementations of the method in TreeModel. it delegates to the actual tree model.

Specified by:
getRoot in interface TreeModel
Returns:
the root

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Implementations of the method in TreeModel. it delegates to the actual tree model after index conversion.

Specified by:
getIndexOfChild in interface TreeModel

getChild

public Object getChild(Object parent,
                       int index)
Implementations of the method in TreeModel. it delegates to the actual tree model after index conversion.

Specified by:
getChild in interface TreeModel

getChildCount

public int getChildCount(Object parent)
Implementations of the method in TreeModel. it delegates to the actual tree model after index conversion.

Specified by:
getChildCount in interface TreeModel

isLeaf

public boolean isLeaf(Object node)
Implementations of the method in TreeModel. it delegates to the actual tree model.

Specified by:
isLeaf in interface TreeModel

getListModelWrapper

protected ListModelWrapper getListModelWrapper(Object node)
Get the list model wrapper for the node.

Parameters:
node - the tree node
Returns:
the list model wrapper associated with the node.
See Also:
setListModelWrapper(Object, com.jidesoft.list.ListModelWrapper)

setListModelWrapper

protected void setListModelWrapper(Object node,
                                   ListModelWrapper wrapper)

clearListModelWrapper

protected void clearListModelWrapper(Object node)

clearAllListModelWrappers

protected void clearAllListModelWrappers()

initWrapper

protected void initWrapper(Object node)

createListModelWrapper

protected ListModelWrapper createListModelWrapper(Object node)
Creates an empty list model wrapper. Subclass can override this method to create their special list model wrapper. For example, 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.

Parameters:
node - the tree node
Returns:
an empty list model wrapper.

configureListModelWrapper

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). 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.

Parameters:
wrapper - the wrapper to be configured.
node - the tree node

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)
Delegates to underlying tree model.

Specified by:
valueForPathChanged in interface TreeModel
Overrides:
valueForPathChanged in class AbstractTreeModel
Parameters:
path - the tree path
newValue - the new value

treeNodesChanged

public void treeNodesChanged(TreeModelEvent e)
Method for TreeModelListener. It will listen to the event from actual tree model and fire converted tree model for this tree model.

Specified by:
treeNodesChanged in interface TreeModelListener
Parameters:
e - the TreeModelEvent

treeNodesInserted

public void treeNodesInserted(TreeModelEvent e)
Method for TreeModelListener. It will listen to the event from actual tree model and fire converted tree model for this tree model.

Specified by:
treeNodesInserted in interface TreeModelListener
Parameters:
e - the TreeModelEvent

treeNodesRemoved

public void treeNodesRemoved(TreeModelEvent e)
Method for TreeModelListener. It will listen to the event from actual tree model and fire converted tree model for this tree model.

Specified by:
treeNodesRemoved in interface TreeModelListener
Parameters:
e - the TreeModelEvent

treeStructureChanged

public void treeStructureChanged(TreeModelEvent e)
Method for TreeModelListener. It will listen to the event from actual tree model and fire converted tree model for this tree model.

Specified by:
treeStructureChanged in interface TreeModelListener
Parameters:
e - the TreeModelEvent

convertTreeModelEvent

@Deprecated
protected TreeModelEvent convertTreeModelEvent(TreeModelEvent e)
Deprecated. replaced by convertTreeModelEvent(javax.swing.event.TreeModelEvent, int)

Converts the tree model event for the actual model to the event for this model.

Parameters:
e - the TreeModelEvent
Returns:
the tree model event for this model.

convertTreeModelEvent

protected TreeModelEvent convertTreeModelEvent(TreeModelEvent e,
                                               int eventType)
Converts the tree model event for the actual model to the event for this model.

Parameters:
e - the TreeModelEvent
eventType - the event type, EVENT_TYPE_NODES_INSERTED, EVENT_TYPE_NODES_REMOVED or EVENT_TYPE_NODES_CHANGED
Returns:
the tree model event for this model.
Since:
3.4.6

JIDE 3.5.15