Package vrml.node
Class Script
java.lang.Object
vrml.BaseNode
vrml.node.Script
This is the general Script class, to be subclassed by all scripts.
Note that the provided methods allow the script author to explicitly
throw tailored exceptions in case something goes wrong in the
script.
- Version:
- $Revision: 1.8 $
- Author:
- Alan Hudson
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled after every invocation of processEvents()protected final FieldgetEventIn(String fieldName) Get an EventIn by name.protected final FieldgetEventOut(String fieldName) Get an EventOut by name.protected final FieldGet a Field by name.voidCalled before any event is generatedvoidprepareScript(Browser b, Map<String, Field> fields, VRMLNodeType node) Prepare the script for execution.voidprocessEvent(Event event) Called when there is an Event to be processedvoidprocessEvents(int count, Event[] events) Called automatically when the script receives some set of events.voidshutdown()Called when the Script node is deleted.Methods inherited from class vrml.BaseNode
getBrowser, getImplNode, getType
-
Constructor Details
-
Script
public Script()
-
-
Method Details
-
prepareScript
Prepare the script for execution. Should never be called by user code. belongs to a local usage only.- Parameters:
b- The browser reference to usefields- The mapping of field names to JSAI field instancesnode- The real node representing this script
-
getField
Get a Field by name.- Parameters:
fieldName- The requested field- Returns:
- Throws:
InvalidFieldException- if fieldName isn't a valid field name
-
getEventOut
Get an EventOut by name.- Parameters:
fieldName- The requested eventOut- Returns:
- Throws:
InvalidEventOutException- if fieldName isn't a valid name
-
getEventIn
Get an EventIn by name.- Parameters:
fieldName- The requested eventIn- Returns:
- Throws:
InvalidEventInException- if fieldName isn't a valid name
-
initialize
public void initialize()Called before any event is generated -
processEvents
Called automatically when the script receives some set of events. It shall not be called directly except by its subclass.- Parameters:
count- indicates the number of events delivered.events- The events to process
-
processEvent
Called when there is an Event to be processed- Parameters:
event- The event to process
-
eventsProcessed
public void eventsProcessed()Called after every invocation of processEvents() -
shutdown
public void shutdown()Called when the Script node is deleted.
-