Class ExternalEventQueue
- All Implemented Interfaces:
NodeRealizationProcessor,ExternalView
This queue handles all of the event types, including the replaceWorld methods. Because I do not fully understand the intention of the beginUpdate/endUpdate queue system for handling browser requests, it is possible to change between queued and unqueued behavior by modifying the appropriate static constants.
Amalgamation of distinct set1Value events into single setValue events is the responsibility of the event buffers/field wrapper classes. The only functionality that this class exposes is the ability to locate the appropriate previous buffers, and exposing the synchronization lock for thread safety.
This class was previously named the EAIEventQueue, which became a misnomer when it was repurposed for both EAI and external SAI support. It has not been seen as sufficiently useful to split this queue into an EAI and an SAI version, thus the compilation dependencies from the VRML and X3D systems.
The responsibility for registering the event queue with the appropriate triggering mechanisms (current the EventModelEvaluator) is external to this class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.j3d.util.ErrorReporterThe ErrorReporter to send messages tofinal ObjectExternal lock for the event list. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidStart queuing updates.voidclear()Clear out any held referencesvoidEnd queuing of updates, and send the current set to be processed.getLast(ExternalEvent type) Return the ExternalEvent which is equal to the sent type.booleanisNodeRealized(VRMLNodeType node) Methods for NodeRealizationProcessorvoidmarkNodeRealized(VRMLNodeType node) Mark a node as undergoing realizationvoidComplete the realization of a node.voidpostAddRoute(VRML97CommonBrowser theBrowser, BrowserCore theCore, VRMLNodeType fromNode, String eventOut, VRMLNodeType toNode, String eventIn) Process a Browser.addRoute request.voidpostCreateVrmlFromURL(VRML97CommonBrowser theBrowser, String[] url, VRMLNodeType node, String eventIn) Process a Browser.createVrmlFromURL requestvoidpostLoadURL(VRML97CommonBrowser browser, String[] url, String[] param) Process a browser.loadURL request.voidpostRealizeNode(VRMLNodeType nodeToRealize) Process a node realization requestvoidpostRemoveRoute(VRML97CommonBrowser browser, BrowserCore core, VRMLNodeType from, String eventOut, VRMLNodeType to, String eventIn) Process a browser.deleteRoute request.voidpostReplaceWorld(VRML97CommonBrowser browser, VRMLNodeType[] value) Process a browser.replaceWorld requestvoidprocessEvent(ExternalEvent event) Process an addition to the event queue.voidProcess all waiting events.voidsetErrorReporter(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.
-
Field Details
-
eventLock
External lock for the event list. This has to be public because the logic for merging set1Value calls isn't thread safe otherwise. -
errorReporter
protected org.j3d.util.ErrorReporter errorReporterThe ErrorReporter to send messages to
-
-
Constructor Details
-
ExternalEventQueue
public ExternalEventQueue(org.j3d.util.ErrorReporter reporter) Basic constructor.- Parameters:
reporter- The ErrorReporter to use.
-
-
Method Details
-
beginUpdate
public void beginUpdate()Start queuing updates. It isn't an error to call this multiple times, but extra calls are ignored. -
endUpdate
public void endUpdate()End queuing of updates, and send the current set to be processed. It isn't an error to call this multiple times, but extra calls are ignored. -
getLast
Return the ExternalEvent which is equal to the sent type. This relies on the trick that EventIn instances are equal based on node and field ID properties.- Parameters:
type-- Returns:
-
postAddRoute
public void postAddRoute(VRML97CommonBrowser theBrowser, BrowserCore theCore, VRMLNodeType fromNode, String eventOut, VRMLNodeType toNode, String eventIn) Process a Browser.addRoute request.- Parameters:
theBrowser-theCore-fromNode-eventOut-toNode-eventIn-
-
postCreateVrmlFromURL
public void postCreateVrmlFromURL(VRML97CommonBrowser theBrowser, String[] url, VRMLNodeType node, String eventIn) Process a Browser.createVrmlFromURL request- Parameters:
theBrowser-url-node-eventIn-
-
postLoadURL
Process a browser.loadURL request.- Parameters:
browser-url-param-
-
postRealizeNode
Process a node realization request- Parameters:
nodeToRealize-
-
postRemoveRoute
public void postRemoveRoute(VRML97CommonBrowser browser, BrowserCore core, VRMLNodeType from, String eventOut, VRMLNodeType to, String eventIn) Process a browser.deleteRoute request. The EAI specification doesn't specifically state that this should be buffered, but it is a world state modification.- Parameters:
browser-core-from-eventOut-to-eventIn-
-
postReplaceWorld
Process a browser.replaceWorld request- Parameters:
browser-value-
-
processEvent
Process an addition to the event queue. This will either add the event to the queue, or execute it immediately depending on the queuing state- Parameters:
event-
-
clear
-
processEvents
public void processEvents()Process all waiting events.- Specified by:
processEventsin interfaceExternalView- See Also:
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Description copied from interface:ExternalViewRegister 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.- Specified by:
setErrorReporterin interfaceExternalView- Parameters:
reporter- The instance to use or null
-
isNodeRealized
Methods for NodeRealizationProcessor- Specified by:
isNodeRealizedin interfaceNodeRealizationProcessor- Parameters:
node- The node in question- Returns:
- The current status
-
markNodeRealized
Description copied from interface:NodeRealizationProcessorMark a node as undergoing realization- Specified by:
markNodeRealizedin interfaceNodeRealizationProcessor- Parameters:
node-
-
markRealizationComplete
Description copied from interface:NodeRealizationProcessorComplete the realization of a node. Removes the realization processing record to free up memory.- Specified by:
markRealizationCompletein interfaceNodeRealizationProcessor- Parameters:
node-
-