syn3d.nodes
Class SwitchNode

java.lang.Object
  extended by syn3d.base.ActiveNode
      extended by syn3d.nodes.GroupNode
          extended by syn3d.nodes.SwitchNode
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SwitchNodeJava3D, SwitchNodeXith3D

public class SwitchNode
extends GroupNode
implements java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
protected static class SwitchNode.Action
           
 
Field Summary
protected static int anonymousNodeNumber
           
protected static javax.swing.Icon icon
           
protected  java.util.BitSet status
           
 
Fields inherited from class syn3d.base.ActiveNode
children, name, parent
 
Constructor Summary
SwitchNode(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.List getActions()
          Returns a list of possible actions on this node.
 javax.swing.Icon getIcon()
          Utility method to specialize the swing tree renderer.
 boolean getStatus(ActiveNode child)
           
protected  void removeChild(ActiveNode child)
          Internal use function.
 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 setStatus(ActiveNode child, boolean status)
           
 
Methods inherited from class syn3d.nodes.GroupNode
getScene
 
Methods inherited from class syn3d.base.ActiveNode
findDescendantOfType, findDescendantOfType, get3DObject, getChildren, getName, getParent, highlight, notifyInternalChange, notifyStructuralChange, propagateAddChildEvent, propagateChangeNameEvent, propagateHighlightEvent, propagateInternalChangeEvent, propagateRemoveChildEvent, propagateStructuralChangeEvent, remove, removeNodeTree, removeNodeTreeFrom, setName, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

status

protected java.util.BitSet status

anonymousNodeNumber

protected static int anonymousNodeNumber

icon

protected static javax.swing.Icon icon
Constructor Detail

SwitchNode

public SwitchNode(ActiveNode parent)
Method Detail

addChild

protected void addChild(ActiveNode child)
Description copied from class: ActiveNode
Internal use function. Overload this to do some action when a new child is added to this node Don't forget to call super implementation Beware : this function is called in the child constructor, so don't rely on the child beeing fully set up yet

Overrides:
addChild in class ActiveNode

removeChild

protected void removeChild(ActiveNode child)
Description copied from class: ActiveNode
Internal use function. Overload this to do some action when a new child is removed from this node Don't forget to call super implementation

Overrides:
removeChild in class ActiveNode

getActions

public java.util.List getActions()
Description copied from class: ActiveNode
Returns a list of possible actions on this node. Actions may be classified by categories using the "|" separator. Ex: a transform node may have the following actions: "Rotate|90° on X", "Rotate|180° on X", etc...

Overrides:
getActions in class ActiveNode
Returns:
an array of possible actions, or a null or empty array if this node doesn't handle any action

doAction

public void doAction(java.lang.Object action)
Description copied from class: ActiveNode
When the user has selected an action in the list return by getActions(), this method is called. The node should then do what it claims.

Overrides:
doAction in class ActiveNode
Parameters:
action - An action previously declared by the getActions method.

getIcon

public javax.swing.Icon getIcon()
Description copied from class: ActiveNode
Utility method to specialize the swing tree renderer. Give a look to your node, don't let it anonymous!

Overrides:
getIcon in class ActiveNode
Returns:
an Icon to display in the swing tree. May be shared along a node type class, or may even change according the the state of this node.

restoreReferences

public void restoreReferences(ActiveNode parent)
Description copied from class: ActiveNode
Restore a serialized object to the scene graph. The scene is restored from root to leaf, hierachically. A node can count on its parent beeing successfully deserialized, and its precisely the added value of this method to indicate to this object the parent it should attach to. This node is responsible for re-creating its children if it returned true in the save operation. See description of the saveChildren method. This method is called after this node was successfully de-serialized, to give it an occasion to restore anything it may have to with its parent (listeners, etc...). As with the plugin interface methode create, this method should ensure that the 3D object this nodes refers to is added to its parent children list in the underlying 3D model (Java3D, Xith3D). Default behavior is to set this node's parent field to the given value, but an implementor SHALL do what's necessary for the underlying 3D scene graph.

Overrides:
restoreReferences in class ActiveNode
Parameters:
parent - The active node to attach this one to once it has been successfully de-serialized

saveChildren

public boolean saveChildren()
Description copied from class: ActiveNode
The scene/swing tree is serialized from root to leaf, hierachically. A node can count on its parent beeing successfully serialized, and should not try to save its parent. On the other hand, if it is able to re-create the children upon reload it should return true and this branch is considered done. This is especially useful for nodes loaded from external scene object files. This method is called after the object was successfully serialized, to determine wheter or not continue in this tree branch.

Overrides:
saveChildren in class ActiveNode
Returns:
true if this object handles its children, false if it does not. Default is false

setStatus

public void setStatus(ActiveNode child,
                      boolean status)

getStatus

public boolean getStatus(ActiveNode child)