syn3d.nodes
Class ShapeNode

java.lang.Object
  extended by syn3d.base.ActiveNode
      extended by syn3d.nodes.ShapeNode
All Implemented Interfaces:
java.io.Serializable, EndNotificationListener
Direct Known Subclasses:
ShapeNodeJava3D, ShapeNodeXith3D

public class ShapeNode
extends ActiveNode
implements java.io.Serializable, EndNotificationListener

See Also:
Serialized Form

Nested Class Summary
protected  class ShapeNode.PropertiesPanel
           
 
Field Summary
protected static java.util.List actions
           
protected  java.awt.Color baseColor
           
protected  ColorMapper baseColorMapper
           
protected  DataSource baseColorMapperSource
           
static int FILLED_MODE
           
static int FLAT_MODE
           
protected  java.awt.Color highlightColor
           
protected  ColorMapper highlightColorMapper
           
protected  DataSource highlightColorMapperSource
           
protected  boolean highlighted
           
protected static javax.swing.Icon icon
           
protected  int mode
           
static int SHADING_MODE
           
static int WIREFRAME_MODE
           
 
Fields inherited from class syn3d.base.ActiveNode
children, name, parent
 
Constructor Summary
ShapeNode(ActiveNode parent)
           
 
Method Summary
 void configure()
           
 void configure(boolean showName)
           
protected  ShapeNode.PropertiesPanel createPanel(boolean showName)
          Factory for subclasses
 void doAction(java.lang.Object action)
          When the user has selected an action in the list return by getActions(), this method is called.
 void duplicateProperties(ShapeNode node)
          Utility method to set this shape properties to the same as another shape
 java.util.List getActions()
          Returns a list of possible actions on this node.
 java.awt.Color getBaseColor()
           
 java.awt.Color getHighlightColor()
           
 javax.swing.Icon getIcon()
          Utility method to specialize the swing tree renderer.
 int getMode()
           
 void highlight(boolean on, java.lang.Object parameter)
          Highlights this node some way.
 void notificationEnd(java.lang.Object referer)
          This callback is called after all notifications were processed.
 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 setBaseColor(java.awt.Color baseColor)
           
 void setHighlightColor(java.awt.Color highlightColor)
           
 void setMode(int mode)
           
 
Methods inherited from class syn3d.base.ActiveNode
addChild, findDescendantOfType, findDescendantOfType, get3DObject, getChildren, getName, getParent, notifyInternalChange, notifyStructuralChange, propagateAddChildEvent, propagateChangeNameEvent, propagateHighlightEvent, propagateInternalChangeEvent, propagateRemoveChildEvent, propagateStructuralChangeEvent, remove, removeChild, removeNodeTree, removeNodeTreeFrom, setName, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SHADING_MODE

public static final int SHADING_MODE
See Also:
Constant Field Values

FLAT_MODE

public static final int FLAT_MODE
See Also:
Constant Field Values

FILLED_MODE

public static final int FILLED_MODE
See Also:
Constant Field Values

WIREFRAME_MODE

public static final int WIREFRAME_MODE
See Also:
Constant Field Values

mode

protected int mode

highlighted

protected boolean highlighted

baseColor

protected java.awt.Color baseColor

highlightColor

protected java.awt.Color highlightColor

baseColorMapperSource

protected transient DataSource baseColorMapperSource

highlightColorMapperSource

protected transient DataSource highlightColorMapperSource

baseColorMapper

protected ColorMapper baseColorMapper

highlightColorMapper

protected ColorMapper highlightColorMapper

actions

protected static java.util.List actions

icon

protected static javax.swing.Icon icon
Constructor Detail

ShapeNode

public ShapeNode(ActiveNode parent)
Method Detail

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.

configure

public void configure()

configure

public void configure(boolean showName)

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.

highlight

public void highlight(boolean on,
                      java.lang.Object parameter)
Description copied from class: ActiveNode
Highlights this node some way. It's up to the underlying 3D model to decide what it means. This is an optional operation. Highlighting may occur when the user selects a node in the tree, for example, or when picking an object on a scene view. Note for subclasses : please call the super implementation for event propagation.

Overrides:
highlight in class ActiveNode
Parameters:
on - true indicates to highlight this node, false to revert it back to normal
parameter - 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 Tree

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

createPanel

protected ShapeNode.PropertiesPanel createPanel(boolean showName)
Factory for subclasses


notificationEnd

public void notificationEnd(java.lang.Object referer)
Description copied from interface: EndNotificationListener
This callback is called after all notifications were processed. The referer object is the one to decide what the end means. For example, it may be a single data source notifying both a range change and a value change. Or it could be a collection notifying all its sources.

Specified by:
notificationEnd in interface EndNotificationListener

getBaseColor

public java.awt.Color getBaseColor()
Returns:
Returns the baseColor.

setBaseColor

public void setBaseColor(java.awt.Color baseColor)
Parameters:
baseColor - The baseColor to set.

getHighlightColor

public java.awt.Color getHighlightColor()
Returns:
Returns the highlightColor.

setHighlightColor

public void setHighlightColor(java.awt.Color highlightColor)
Parameters:
highlightColor - The highlightColor to set.

getMode

public int getMode()
Returns:
Returns the mode.

setMode

public void setMode(int mode)
Parameters:
mode - The mode to set.

duplicateProperties

public void duplicateProperties(ShapeNode node)
Utility method to set this shape properties to the same as another shape