org.xmlhammer.gui.overview
Class OverviewTreeModel

java.lang.Object
  extended by org.xmlhammer.gui.overview.OverviewTreeModel
All Implemented Interfaces:
javax.swing.tree.TreeModel, OverviewNode

public class OverviewTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel, OverviewNode


Field Summary
protected  javax.swing.event.EventListenerList listenerList
          Listeners.
 
Constructor Summary
OverviewTreeModel()
           
OverviewTreeModel(java.util.ArrayList<OverviewNode> children)
           
 
Method Summary
 void addChild(OverviewNode child)
           
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
          Adds a listener for the TreeModelEvent posted after the tree changes.
protected  void fireTreeNodesChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireTreeNodesInserted(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireTreeNodesRemoved(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireTreeStructureChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
          Notifies all listeners that have registered interest for notification on this event type.
 java.lang.Object getChild(java.lang.Object parent, int index)
           
 int getChildCount(java.lang.Object parent)
           
 java.util.ArrayList<OverviewNode> getChildNodes()
           
 java.lang.String getError()
           
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
           
 javax.swing.Icon getNodeIcon()
           
 java.lang.String getNodeName()
           
 OverviewNode getParentNode()
           
 OverviewNode[] getPathToRoot(OverviewNode node, int i)
           
 OverviewNode getRoot()
           
 javax.swing.event.TreeModelListener[] getTreeModelListeners()
          Returns an array of all the tree model listeners registered on this model.
 boolean isLeaf(java.lang.Object node)
           
 void nodeChanged(OverviewNode node)
           
 void nodeInserted(OverviewNode node)
           
 void nodePathChanged(OverviewNode node)
           
 void nodeRemoved(OverviewNode node)
           
 void nodesChanged(OverviewNode node, int[] ai)
           
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
          Removes a listener previously added with addTreeModelListener().
 void setChildren(java.util.ArrayList<OverviewNode> children)
           
 void structureChanged(OverviewNode node)
           
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerList

protected javax.swing.event.EventListenerList listenerList
Listeners.

Constructor Detail

OverviewTreeModel

public OverviewTreeModel()

OverviewTreeModel

public OverviewTreeModel(java.util.ArrayList<OverviewNode> children)
Method Detail

setChildren

public void setChildren(java.util.ArrayList<OverviewNode> children)

addChild

public void addChild(OverviewNode child)

getRoot

public OverviewNode getRoot()
Specified by:
getRoot in interface javax.swing.tree.TreeModel

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
Specified by:
getChild in interface javax.swing.tree.TreeModel

getChildCount

public int getChildCount(java.lang.Object parent)
Specified by:
getChildCount in interface javax.swing.tree.TreeModel

isLeaf

public boolean isLeaf(java.lang.Object node)
Specified by:
isLeaf in interface javax.swing.tree.TreeModel

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel

getError

public java.lang.String getError()
Specified by:
getError in interface OverviewNode

nodeChanged

public void nodeChanged(OverviewNode node)

nodePathChanged

public void nodePathChanged(OverviewNode node)

nodesChanged

public void nodesChanged(OverviewNode node,
                         int[] ai)

nodeRemoved

public void nodeRemoved(OverviewNode node)

nodeInserted

public void nodeInserted(OverviewNode node)

structureChanged

public void structureChanged(OverviewNode node)

getPathToRoot

public OverviewNode[] getPathToRoot(OverviewNode node,
                                    int i)

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes.

Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
l - the listener to add
See Also:
removeTreeModelListener(javax.swing.event.TreeModelListener)

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a listener previously added with addTreeModelListener().

Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
l - the listener to remove
See Also:
addTreeModelListener(javax.swing.event.TreeModelListener)

getTreeModelListeners

public javax.swing.event.TreeModelListener[] getTreeModelListeners()
Returns an array of all the tree model listeners registered on this model.

Returns:
all of this model's TreeModelListeners or an empty array if no tree model listeners are currently registered
Since:
1.4
See Also:
addTreeModelListener(javax.swing.event.TreeModelListener), removeTreeModelListener(javax.swing.event.TreeModelListener)

fireTreeNodesChanged

protected void fireTreeNodesChanged(java.lang.Object source,
                                    java.lang.Object[] path,
                                    int[] childIndices,
                                    java.lang.Object[] children)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
source - the node being changed
path - the path to the root node
childIndices - the indices of the changed elements
children - the changed elements
See Also:
EventListenerList

fireTreeNodesInserted

protected void fireTreeNodesInserted(java.lang.Object source,
                                     java.lang.Object[] path,
                                     int[] childIndices,
                                     java.lang.Object[] children)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
source - the node where new elements are being inserted
path - the path to the root node
childIndices - the indices of the new elements
children - the new elements
See Also:
EventListenerList

fireTreeNodesRemoved

protected void fireTreeNodesRemoved(java.lang.Object source,
                                    java.lang.Object[] path,
                                    int[] childIndices,
                                    java.lang.Object[] children)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
source - the node where elements are being removed
path - the path to the root node
childIndices - the indices of the removed elements
children - the removed elements
See Also:
EventListenerList

fireTreeStructureChanged

protected void fireTreeStructureChanged(java.lang.Object source,
                                        java.lang.Object[] path,
                                        int[] childIndices,
                                        java.lang.Object[] children)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
source - the node where the tree model has changed
path - the path to the root node
childIndices - the indices of the affected elements
children - the affected elements
See Also:
EventListenerList

getNodeName

public java.lang.String getNodeName()
Specified by:
getNodeName in interface OverviewNode

getChildNodes

public java.util.ArrayList<OverviewNode> getChildNodes()
Specified by:
getChildNodes in interface OverviewNode

getParentNode

public OverviewNode getParentNode()
Specified by:
getParentNode in interface OverviewNode

getNodeIcon

public javax.swing.Icon getNodeIcon()
Specified by:
getNodeIcon in interface OverviewNode


Copyright 2005-2005-2008 Edwin Dankert. All Rights Reserved.