Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.scripting.external.buffer
Class BaseExternalEventAdapter

java.lang.Object
  extended by org.web3d.vrml.scripting.external.buffer.BaseExternalEventAdapter
All Implemented Interfaces:
ExternalEventAdapter

public abstract class BaseExternalEventAdapter
extends java.lang.Object
implements 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
protected  java.util.LinkedList[] buffers
          The queue of eventOut buffers for each field with a listener.
protected  VRMLNodeType parentNode
          The VRMLNodeType from the underlying implementation that we broadcast for.
protected  VRMLClock timeClock
          The clock for producing consistent timestamps
 
Constructor Summary
BaseExternalEventAdapter(VRMLNodeType aNode, VRMLClock clock)
          Construct the basic event adapter.
 
Method Summary
 void addListener(int fieldID, java.lang.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.
protected  java.util.Vector getListeners(int fieldID)
          Get the listeners for a given fieldID.
 void removeListener(int fieldID, java.lang.Object who)
          Remove a listener for one of the fields of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentNode

protected VRMLNodeType parentNode
The VRMLNodeType from the underlying implementation that we broadcast for.


buffers

protected java.util.LinkedList[] buffers
The queue of eventOut buffers for each field with a listener.


timeClock

protected VRMLClock timeClock
The clock for producing consistent timestamps

Constructor Detail

BaseExternalEventAdapter

public BaseExternalEventAdapter(VRMLNodeType aNode,
                                VRMLClock clock)
Construct the basic event adapter.

Parameters:
aNode - The underlying node that we are adapting for.
clock - The clock to use for timestamps.
Method Detail

addListener

public void addListener(int fieldID,
                        java.lang.Object who)
Add a listener for one of the fields of this node.

Specified by:
addListener in interface ExternalEventAdapter
Parameters:
fieldID - The ID of the field.
who - The listener to add.

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 interface ExternalEventAdapter
Parameters:
fieldID - The fieldID which changed
timestamp - The timestamp to use

getListeners

protected java.util.Vector getListeners(int fieldID)
Get the listeners for a given fieldID. This doesn't perform initialization, and returns null for elements which don't exist yet.

Parameters:
fieldID - The ID of the field.

removeListener

public void removeListener(int fieldID,
                           java.lang.Object who)
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 interface ExternalEventAdapter
Parameters:
fieldID - The ID of the field.
who - The listener to remove.

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium