Package org.xj3d.core.eventmodel
Class BindableNodeManager
java.lang.Object
org.xj3d.core.eventmodel.BindableNodeManager
- All Implemented Interfaces:
VRMLBindableNodeListener
The manager of bindable/activatable nodes at runtime.
This common manager is responsible for handling the details of a single type of bindable or activatable node. The primary difference between the two types is that bindable nodes also have a bindTime field that must be set at the time they get bound.
- Version:
- $Revision: 1.2 $
- Author:
- Justin Couch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the default node to the bottom of the stack.void
addNode
(VRMLBindableNodeType node, boolean isDefault) Add a bindable node to the management system.void
clearAll()
Clear all of the nodes that this manager is currently dealing with.boolean
contains
(VRMLBindableNodeType node) Check to see if the bindable manager contains this node instance already.Get the currently bound node.Fetch the first node that was added to the manager after it was cleared.void
nodeIsBound
(VRMLNodeType src, boolean yes) Notification that the environment has requested that this node be now bound or removed as the active node in the stack.void
Remove a bindable node from the management system.void
setErrorReporter
(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.void
Set the handler for node bind change events.void
setVRMLClock
(VRMLClock clk) Set the VRML clock instance that we are using so that we can set the bind time information for nodes that require it.
-
Constructor Details
-
BindableNodeManager
public BindableNodeManager()Create and initialise a route manager instance
-
-
Method Details
-
nodeIsBound
Notification that the environment has requested that this node be now bound or removed as the active node in the stack.- Specified by:
nodeIsBound
in interfaceVRMLBindableNodeListener
- Parameters:
src
- The source node that is to be boundyes
- true if the node is to becoming active
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Parameters:
reporter
- The instance to use or null
-
setVRMLClock
Set the VRML clock instance that we are using so that we can set the bind time information for nodes that require it. A value of null can be used to clear the current clock instance.- Parameters:
clk
- The new clock to set
-
getBoundNode
Get the currently bound node. If there are no nodes being managed then this will return null.- Returns:
- The currently bound node
-
getFirstNode
Fetch the first node that was added to the manager after it was cleared. This is used to determine the default instance to use when the scene is first loaded. The concept of the first node is a bit grey and should really only be used during the scene setup phase. For example, if the end user deletes the first node from the runtime scene graph, does this call still make sense? We shouldn't really need to keep an ordered list of the items as they are added.- Returns:
- The first added node
-
contains
Check to see if the bindable manager contains this node instance already.- Parameters:
node
- The node instance to check- Returns:
- true if the instance is already registered
-
addDefaultBindable
Add the default node to the bottom of the stack. This should be called before any setBind() methods are called at the start of of the world.- Parameters:
node
-
-
addNode
Add a bindable node to the management system.- Parameters:
node
- The instance to add to this managerisDefault
- Is this a default bindable
-
removeNode
Remove a bindable node from the management system.- Parameters:
node
- The instance to add to this manager
-
clearAll
public void clearAll()Clear all of the nodes that this manager is currently dealing with. All listeners are removed and no watch is kept on the nodes. -
setNodeChangeListener
Set the handler for node bind change events. This will replace the current listener. A value of null will de-register the current listener instance.- Parameters:
l
- The listener to be used or null
-