Class GWTInterop

java.lang.Object
com.singularsys.client.GWTInterop
All Implemented Interfaces:
EntryPoint

@JsType(namespace="<global>", name="Jep") public class GWTInterop extends Object implements EntryPoint
GWT entry point exposing parts of the Jep system to JavaScript using the JsInterop system. The class is renamed to Jep in JavaScript
See Also:
  • Constructor Details

  • Method Details

    • onModuleLoad

      @JsIgnore public void onModuleLoad()
      Standard GWT method called when the module is loaded. Calls the onModLoad() native method which in turn calls the JavaScript jepModuleLoaded() method.
      Specified by:
      onModuleLoad in interface EntryPoint
    • onModLoad

      @JsIgnore protected void onModLoad()
      Calls the JavaScript jepModuleLoaded() method.
    • parse

      @JsMethod public GWTInterop.GWTNode parse(String S) throws ParseException
      Parse an expression
      Parameters:
      S - expression
      Returns:
      root node of parse tree or null on ParseException
      Throws:
      ParseException - if an error in parsing
    • parseNE

      @JsMethod public GWTInterop.GWTNode parseNE(String S)
      Parse an expression, does not throw exceptions
      Parameters:
      S - expression
      Returns:
      root node of parse tree or null if an error in parsing
      See Also:
    • evaluate

      @JsMethod public Object evaluate(GWTInterop.GWTNode node) throws EvaluationException
      Evaluate an expression
      Parameters:
      node - root of the expression
      Returns:
      result of evaluation converted to a format suitable for use in JavScript
      Throws:
      EvaluationException - if an error during evaluation
    • evaluateNE

      @JsMethod public Object evaluateNE(GWTInterop.GWTNode node)
      Evaluate an expression, does not throw exceptions
      Parameters:
      node - root of the expression
      Returns:
      result of evaluation converted to a format suitable for use in JavScript, or null if an error during evaluation
      See Also:
    • setVariable

      @JsMethod public GWTInterop.GWTVariable setVariable(String name, Object val) throws JepException
      Set the value of a variable.
      Parameters:
      name - name of variable
      val - value
      Returns:
      object representing the variable
      Throws:
      JepException - if the value cannot be converted a double, string or array, or an attempt to set a constant variable
    • setVariableNE

      @JsMethod public GWTInterop.GWTVariable setVariableNE(String name, Object val)
      Set the value of a variable, does not throw exceptions
      Parameters:
      name - name of variable
      val - value
      Returns:
      object representing the variable or null on error
    • getVariableValue

      @JsMethod public Object getVariableValue(String name)
      Gets the value of a variable as an object value
      Parameters:
      name - variable name
      Returns:
      value as an object or null if no such variable exists
    • getJavaValue

      @JsIgnore public Object getJavaValue(Object val) throws EvaluationException
      Convert a JavaScript value to Java value suitable for Jep. Most types are parsed directly apart from JsArray arrays which are converted to Vectors<Object> the type used by standard Jep.
      Parameters:
      val - value from JavaScript, must be Number, String, Boolean or array.
      Returns:
      converted value or null on error.
      Throws:
      EvaluationException - if the value cannot be converted to a Number, String or array
    • getJSValue

      @JsIgnore public Object getJSValue(Object val)
      Convert values produced by Jep into values suitable for JavaScript. Changes Jeps Vector representation for arrays to
      Parameters:
      val -
      Returns:
    • getErrorMsg

      @JsMethod public String getErrorMsg()
      Returns the error message generated by the last action.
      Returns:
      the error message or "" if no error detected
    • toString

      @JsMethod public Object toString(GWTInterop.GWTNode node)
      Construct a string representation of the node
      Parameters:
      node - root node of an expression
      Returns:
      a string representation
    • consoleLog

      @JsIgnore public void consoleLog(String msg)
      Native method to write to the JavaScript console
      Parameters:
      msg -