vrml.node
Class Script

java.lang.Object
  extended by vrml.BaseNode
      extended by vrml.node.Script

public abstract class Script
extends BaseNode

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.


Constructor Summary
Script()
           
 
Method Summary
protected  void dispose()
          Destroy the native peer instance.
 void eventsProcessed()
          Called after every invocation of processEvents().
protected  void finalize()
          Finalize.
protected  Field getEventIn(java.lang.String eventInName)
          Get an EventIn by name.
protected  Field getEventOut(java.lang.String eventOutName)
          Get an EventOut by name.
protected  Field getField(java.lang.String fieldName)
          Get a Field by name.
 void initialize()
          This method is called before any event is generated.
 void processEvent(Event event)
          Called automatically when the script receives an event.
 void processEvents(int count, Event[] events)
          Called automatically when the script receives some set of events.
 void shutdown()
          Called when the Script node is deleted.
 
Methods inherited from class vrml.BaseNode
getBrowser, getType, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Script

public Script()
Method Detail

dispose

protected void dispose()
Destroy the native peer instance. Normally this method is called from finalize(). If it is called before finalization, only finalize() can safely be called on the instance subsequently.

Overrides:
dispose in class BaseNode

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalize.

Overrides:
finalize in class BaseNode
Throws:
java.lang.Throwable

initialize

public void initialize()
This method is called before any event is generated.


getField

protected final Field getField(java.lang.String fieldName)
                        throws InvalidFieldException
Get a Field by name.

Parameters:
fieldName - Name of field to retrieve.
Returns:
Field with given name.
Throws:
InvalidFieldException - Invalid field name specified.

getEventOut

protected final Field getEventOut(java.lang.String eventOutName)
                           throws InvalidEventOutException
Get an EventOut by name.

Parameters:
eventOutName - Name of eventOut to retrieve.
Returns:
Field representing eventOut with given name.
Throws:
InvalidEventOutException - Invalid eventOut name specified.

getEventIn

protected final Field getEventIn(java.lang.String eventInName)
                          throws InvalidEventInException
Get an EventIn by name.

Parameters:
eventInName - Name of eventIn to retrieve.
Returns:
Field representing eventIn with given name.
Throws:
InvalidEventInException - Invalid eventIn name specified.

processEvents

public void processEvents(int count,
                          Event[] events)
Called automatically when the script receives some set of events. It should not be called directly except by its subclass.

Parameters:
count - Number of events delivered.
events - Array of events to process.

processEvent

public void processEvent(Event event)
Called automatically when the script receives an event.


eventsProcessed

public void eventsProcessed()
Called after every invocation of processEvents().


shutdown

public void shutdown()
Called when the Script node is deleted.