syn3d.ui
Class SceneGraphModel

java.lang.Object
  extended by syn3d.ui.SceneGraphModel
All Implemented Interfaces:
javax.swing.tree.TreeModel
Direct Known Subclasses:
SceneGraphModelJava3D, SceneGraphModelXith3D

public abstract class SceneGraphModel
extends java.lang.Object
implements javax.swing.tree.TreeModel

Class description ...

Author:
Claude CAZENAVE

Field Summary
protected  javax.swing.event.EventListenerList listenerList
          Listeners.
protected static MenuResourceBundle resources
          Resources
protected  RootNode rootNode
           
 
Constructor Summary
SceneGraphModel()
           
 
Method Summary
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
           
 void fireTreeChanged(ActiveNode source, java.lang.Object[] path, int[] childIndices, ActiveNode[] 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)
           
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
           
 ActiveNode[] getPathToRoot(ActiveNode o)
          Builds the parents of object up to and including the root object, where the original object is the last element in the returned array.
 ActiveNode[] getPathToRoot(ActiveNode o, int depth)
          Builds the parents of object up to and including the root object, where the original object is the last element in the returned array.
 java.lang.Object getRoot()
           
 RootNode getRootNode()
           
 boolean isLeaf(java.lang.Object node)
           
protected abstract  boolean isLeaf3D(java.lang.Object o)
           
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
           
 void setRootNode(RootNode rootNode)
           
 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

resources

protected static MenuResourceBundle resources
Resources


rootNode

protected RootNode rootNode

listenerList

protected javax.swing.event.EventListenerList listenerList
Listeners.

Constructor Detail

SceneGraphModel

public SceneGraphModel()
Method Detail

setRootNode

public void setRootNode(RootNode rootNode)

getRootNode

public RootNode getRootNode()

getRoot

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

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener l)
Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Specified by:
removeTreeModelListener 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

getPathToRoot

public ActiveNode[] getPathToRoot(ActiveNode o)
Builds the parents of object up to and including the root object, where the original object is the last element in the returned array. The length of the returned array gives the object's depth in the tree.

Parameters:
o - the Object to get the path for
Returns:
an array of Object giving the path from the root to the specified object

getPathToRoot

public ActiveNode[] getPathToRoot(ActiveNode o,
                                  int depth)
Builds the parents of object up to and including the root object, where the original object is the last element in the returned array. The length of the returned array gives the object's depth in the tree.

Parameters:
o - the Object to get the path for
depth - an int giving the number of steps already taken towards the root (on recursive calls), used to size the returned array
Returns:
an array of Object giving the path from the root to the specified object

fireTreeChanged

public void fireTreeChanged(ActiveNode source,
                            java.lang.Object[] path,
                            int[] childIndices,
                            ActiveNode[] 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

getChildCount

public int getChildCount(java.lang.Object parent)
Specified by:
getChildCount 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

getIndexOfChild

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

isLeaf

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

isLeaf3D

protected abstract boolean isLeaf3D(java.lang.Object o)