jsynoptic.plugins.java3d.tree
Class AbstractNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by jsynoptic.plugins.java3d.tree.AbstractNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
CanvasNode, MaterialNode, ReferenceNode, RootNode, SceneGraphNode, UniverseNode

public abstract class AbstractNode
extends javax.swing.tree.DefaultMutableTreeNode

A tree node to hold a SceneGraph object and provide dedicated feature

See Also:
Serialized Form

Field Summary
protected  java.lang.String _name
          This node name
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
protected AbstractNode(Tree tree, java.lang.Object graphObject, boolean getChildren)
           
 
Method Summary
static void addResource(java.lang.String className, javax.swing.Icon icon, java.lang.String description)
          Add resources to display in the tree a scene graph object
static void addResources(java.lang.String className, java.lang.String id)
          Add resources to display in the tree a scene graph object The loaded resources are the icon and the description
protected  AbstractNode createNode(java.lang.Object graphObject)
           
 boolean getAllowsChildren()
           
 int getChildCount()
           
protected abstract  java.lang.Class<?> getChildrenNodeClass(java.lang.Object sceneGraphObject)
          According to a child scene graph object, returns the class of the Node to hold it in the Tree
static java.lang.String getDescription(java.lang.Object graphObject)
          Get a node description according to the class name
 java.lang.Object getGraphObject()
           
static javax.swing.Icon getIcon(java.lang.Object graphObject)
          Get a node icon according to the graph object class name
 java.lang.String getName()
           
 Node getOwner()
          Get the J3D Node owner of this scene graph object
protected abstract  void getSceneGraphChildren(java.util.ArrayList<java.lang.Object> list)
          Get the list of children of this scene graph object
 Tree getTree()
           
 void refresh()
           
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getChildAfter, getChildAt, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_name

protected java.lang.String _name
This node name

Constructor Detail

AbstractNode

protected AbstractNode(Tree tree,
                       java.lang.Object graphObject,
                       boolean getChildren)
Parameters:
graphObject -
getChildren -
Method Detail

addResources

public static void addResources(java.lang.String className,
                                java.lang.String id)
Add resources to display in the tree a scene graph object The loaded resources are the icon and the description

Parameters:
className - scene graph object class name
id - the key to look for the resources

addResource

public static void addResource(java.lang.String className,
                               javax.swing.Icon icon,
                               java.lang.String description)
Add resources to display in the tree a scene graph object

Parameters:
className - scene graph object class name
icon - the icon to display
description - the description to display

getDescription

public static java.lang.String getDescription(java.lang.Object graphObject)
Get a node description according to the class name


getIcon

public static javax.swing.Icon getIcon(java.lang.Object graphObject)
Get a node icon according to the graph object class name


getName

public java.lang.String getName()

getSceneGraphChildren

protected abstract void getSceneGraphChildren(java.util.ArrayList<java.lang.Object> list)
Get the list of children of this scene graph object

Parameters:
list - the list to fill with the scene graph children

getChildrenNodeClass

protected abstract java.lang.Class<?> getChildrenNodeClass(java.lang.Object sceneGraphObject)
According to a child scene graph object, returns the class of the Node to hold it in the Tree

Parameters:
sceneGraphObject - a child object of this Node scene graph object
Returns:
the class to use to create the Node
See Also:
createNode

refresh

public void refresh()

createNode

protected AbstractNode createNode(java.lang.Object graphObject)

getAllowsChildren

public boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode
Overrides:
getAllowsChildren in class javax.swing.tree.DefaultMutableTreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface javax.swing.tree.TreeNode
Overrides:
getChildCount in class javax.swing.tree.DefaultMutableTreeNode

getTree

public Tree getTree()
Returns:
Returns the _tree.

getGraphObject

public java.lang.Object getGraphObject()
Returns:
Returns the _graphObject.

getOwner

public Node getOwner()
Get the J3D Node owner of this scene graph object