Class BaseExternalEventAdapter
java.lang.Object
org.web3d.vrml.scripting.external.buffer.BaseExternalEventAdapter
- All Implemented Interfaces:
ExternalEventAdapter
BaseExternalEventAdapter
Base outgoing event adapter which attempts to abstract
the common logic between the SAI and EAI notification system.
- Author:
- Brad Vender
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe queue of eventOut buffers for each field with a listener.protected VRMLNodeType
The VRMLNodeType from the underlying implementation that we broadcast for.protected VRMLClock
The clock for producing consistent timestamps -
Constructor Summary
ConstructorsConstructorDescriptionBaseExternalEventAdapter
(VRMLNodeType aNode, VRMLClock clock) Construct the basic event adapter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(int fieldID, Object who) Add a listener for one of the fields of this node.void
fieldChanged
(int fieldID) Generate the event notification for a field of one of VRMLNodeType node this object is registered with.abstract void
generateBroadcast
(int fieldID, double timestamp) Broadcast an eventOutChanged event for a given field Modifications to the buffers arrays are synchronized so this needs to be too for safety.getListeners
(int fieldID) Get the listeners for a given fieldID.void
removeListener
(int fieldID, Object who) Remove a listener for one of the fields of this node.
-
Field Details
-
parentNode
The VRMLNodeType from the underlying implementation that we broadcast for. -
buffers
-
timeClock
The clock for producing consistent timestamps
-
-
Constructor Details
-
BaseExternalEventAdapter
Construct the basic event adapter.- Parameters:
aNode
- The underlying node that we are adapting for.clock
- The clock to use for timestamps.
-
-
Method Details
-
addListener
Add a listener for one of the fields of this node.- Specified by:
addListener
in interfaceExternalEventAdapter
- Parameters:
fieldID
- The ID of the field.who
-
-
fieldChanged
public void fieldChanged(int fieldID) Generate the event notification for a field of one of VRMLNodeType node this object is registered with.- Parameters:
fieldID
- The ID of the field which changed.
-
generateBroadcast
public abstract void generateBroadcast(int fieldID, double timestamp) Broadcast an eventOutChanged event for a given field Modifications to the buffers arrays are synchronized so this needs to be too for safety.- Specified by:
generateBroadcast
in interfaceExternalEventAdapter
- Parameters:
fieldID
- The fieldID which changedtimestamp
- The timestamp to use
-
getListeners
-
removeListener
Remove a listener for one of the fields of this node. Will also prune the buffer size if all listeners are removed.- Specified by:
removeListener
in interfaceExternalEventAdapter
- Parameters:
fieldID
- The ID of the field.who
- The listener to remove.
-