ice.storm
Class Scripter

java.lang.Object
  extended byice.storm.Scripter

public abstract class Scripter
extends Object

Scripting language interpreter. Object of this class represents an instance of the interpreter of some scripting language for a Pilot. Note that for a new instance of a Pilot a new instance of the Scripter is created. It's up to the Pilot to expose necessary properties into the Scripter so that the user scripts can access system stuff.


Constructor Summary
Scripter()
           
 
Method Summary
abstract  Object _unwrap(Object scriptObject)
          Internal API
protected  Viewport contextViewport()
           
abstract  void dispose()
          Dispose of this scripter instance
 Object enterExecutionFrame(Viewport contextViewport)
           
abstract  Object eval(Viewport view, String script, String url, int startLine)
          Called by the browser and/or pilots to execute commands in the scripting language
abstract  boolean evalCallback(Viewport view, Object function, Object[] args)
           
 Object evalCodeLocation(Viewport view, String codeLocation)
          Evaluate pseudo-location like in javascript:alert("Hello!") Assumes that location starts with "scrit-alias:"
abstract  boolean evalEventHandler(Viewport view, DynamicObject handlerThis, Object handler, DynamicObject event)
          Called by the browser and/or pilots to execute event handlers in the scripting language from Java
static int executionNestingLevel()
           
 void exitExecutionFrame(Object parentExecution)
           
abstract  void init(StormBase base)
          Initialize a Scripter instance int the specified StormBase
abstract  void resume()
           
abstract  String scripterName()
          Get default scripter name
abstract  void suspend()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scripter

public Scripter()
Method Detail

scripterName

public abstract String scripterName()
Get default scripter name


init

public abstract void init(StormBase base)
Initialize a Scripter instance int the specified StormBase

Parameters:
base - the StormBase where the scripter will be running

dispose

public abstract void dispose()
Dispose of this scripter instance


eval

public abstract Object eval(Viewport view,
                            String script,
                            String url,
                            int startLine)
Called by the browser and/or pilots to execute commands in the scripting language

Parameters:
view - viewport containing the script
script - the script to execute
url - location of file with script
startLine - starting lineNumber in the url

evalCodeLocation

public Object evalCodeLocation(Viewport view,
                               String codeLocation)
Evaluate pseudo-location like in javascript:alert("Hello!") Assumes that location starts with "scrit-alias:"


evalEventHandler

public abstract boolean evalEventHandler(Viewport view,
                                         DynamicObject handlerThis,
                                         Object handler,
                                         DynamicObject event)
Called by the browser and/or pilots to execute event handlers in the scripting language from Java

Parameters:
view - viewport containing the script
handlerThis - object that provides notion of this for handler
handler - object to execute as event handler
event - event object to supply to the handler
Returns:
true if default event action should run.

evalCallback

public abstract boolean evalCallback(Viewport view,
                                     Object function,
                                     Object[] args)

_unwrap

public abstract Object _unwrap(Object scriptObject)
Internal API


suspend

public abstract void suspend()

resume

public abstract void resume()

enterExecutionFrame

public final Object enterExecutionFrame(Viewport contextViewport)

exitExecutionFrame

public final void exitExecutionFrame(Object parentExecution)

contextViewport

protected Viewport contextViewport()

executionNestingLevel

public static int executionNestingLevel()