|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsyn3d.base.ActiveNode
public abstract class ActiveNode
Active nodes are a the plugin interface to build the 3D scene graph, which is itself mapped to the swing tree. They can represent any object for the scene, be it a Shape3D, a Transform group or an ambiant light. As their name suggests, they also bring their own possible actions. For example, a rotation transform may declare an action to rotate 90° on X axis, and so on. A switch group may declare actions to set its children visible or not. Etc... Another reason why this interface is neither the swing nor the 3D node, is for serialization. See the save/restore methods for comments.
Field Summary | |
---|---|
protected java.util.ArrayList |
children
|
protected java.lang.String |
name
Name of this node. |
protected ActiveNode |
parent
|
Constructor Summary | |
---|---|
protected |
ActiveNode()
|
|
ActiveNode(ActiveNode parent)
|
Method Summary | |
---|---|
protected void |
addChild(ActiveNode child)
Internal use function. |
void |
doAction(java.lang.Object action)
When the user has selected an action in the list return by getActions(), this method is called. |
java.util.ArrayList |
findDescendantOfType(java.lang.Class c)
Utility method to recursively find all descendant of a given type |
java.util.ArrayList |
findDescendantOfType(java.lang.Class c,
java.util.ArrayList array)
Utility method to recursively find all descendant of a given type. |
java.lang.Object |
get3DObject()
Returns the 3D object that this node refers to. |
java.util.List |
getActions()
Returns a list of possible actions on this node. |
java.util.ArrayList |
getChildren()
|
javax.swing.Icon |
getIcon()
Utility method to specialize the swing tree renderer. |
java.lang.String |
getName()
|
ActiveNode |
getParent()
|
void |
highlight(boolean on,
java.lang.Object parameter)
Highlights this node some way. |
void |
notifyInternalChange()
Notify the system that this node has changed and the scene needs to be re-built |
void |
notifyStructuralChange()
Notify the system that this node structure has changed and the tree needs to be re-built in addition to the scene |
protected void |
propagateAddChildEvent(ActiveNode child)
|
protected void |
propagateChangeNameEvent(ActiveNode node)
|
protected void |
propagateHighlightEvent(ActiveNode node,
boolean on)
|
protected void |
propagateInternalChangeEvent(ActiveNode node)
|
protected void |
propagateRemoveChildEvent(ActiveNode child)
|
protected void |
propagateStructuralChangeEvent(ActiveNode node)
|
void |
remove()
Removes this node from the parent list. |
protected void |
removeChild(ActiveNode child)
Internal use function. |
void |
removeNodeTree()
Delete the node tree from the current ActiveNode |
protected void |
removeNodeTreeFrom(ActiveNode node)
Delete the node tree from the node |
void |
restoreReferences(ActiveNode parent)
Restore a serialized object to the scene graph. |
boolean |
saveChildren()
The scene/swing tree is serialized from root to leaf, hierachically. |
void |
setName(java.lang.String name)
|
void |
setParent(ActiveNode parent)
|
java.lang.String |
toString()
Returns the name of this node if it is not null, or Object.toString() otherwise. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient ActiveNode parent
protected transient java.util.ArrayList children
protected java.lang.String name
Constructor Detail |
---|
protected ActiveNode()
public ActiveNode(ActiveNode parent)
Method Detail |
---|
public void setParent(ActiveNode parent)
public void remove()
protected void addChild(ActiveNode child)
protected void removeChild(ActiveNode child)
protected void propagateAddChildEvent(ActiveNode child)
protected void propagateRemoveChildEvent(ActiveNode child)
protected void propagateChangeNameEvent(ActiveNode node)
protected void propagateHighlightEvent(ActiveNode node, boolean on)
protected void propagateInternalChangeEvent(ActiveNode node)
protected void propagateStructuralChangeEvent(ActiveNode node)
public void notifyInternalChange()
public void notifyStructuralChange()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- The name to set.public java.lang.String toString()
toString
in class java.lang.Object
public java.util.ArrayList getChildren()
public java.lang.Object get3DObject()
public javax.swing.Icon getIcon()
public java.util.List getActions()
public void doAction(java.lang.Object action)
action
- An action previously declared by the getActions method.public boolean saveChildren()
public void restoreReferences(ActiveNode parent)
parent
- The active node to attach this one to once it has been successfully de-serializedpublic ActiveNode getParent()
public void highlight(boolean on, java.lang.Object parameter)
on
- true indicates to highlight this node, false to revert it back to normalparameter
- A parameter set from the 3D underlying model in case of a picking operation,
or the node's 3D object in case of a user selection in the Scene Treepublic java.util.ArrayList findDescendantOfType(java.lang.Class c)
c
- The class to look for
public java.util.ArrayList findDescendantOfType(java.lang.Class c, java.util.ArrayList array)
c
- The class to look forarray
- if not null, use this array to return the children into
public void removeNodeTree()
protected void removeNodeTreeFrom(ActiveNode node)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |