Package com.google.minijoe.sys

Examples of com.google.minijoe.sys.JsFunction


  static final JsObject COMPILER_PROTOTYPE = new JsObject(OBJECT_PROTOTYPE);

  public Eval() {
    super(COMPILER_PROTOTYPE);
    scopeChain = JsSystem.createGlobal();
    addVar("eval", new JsFunction(ID_EVAL, 2));
  }
View Full Code Here


    this.root = root;
    this.callBackScope = scope;
    this.callbackEventLock = lock;
       
    addVar("getContext", new JsFunction(ID_GET_CONTEXT, 1));
  }
View Full Code Here

    super(PROTOTYPE);
   
    this.rootDocument = rootDocument;
    scopeChain = JsSystem.createGlobal();
   
    addVar("getElementById", new JsFunction(ID_GET_ELEMENT_BY_ID, 1));
    addVar("write", new JsFunction(ID_WRITE, 1));
      
    addVar("setTimeout", new JsFunction(ID_SET_TIMEOUT, 2));
    addVar("setInterval", new JsFunction(ID_SET_INTERVAL, 2));
    addVar("document", this);
    addVar("window", this);
    addVar("console", this);
   
    addVar("debug", new JsFunction(ID_DEBUG, 1)); //console.debug
   
    if (rootDocument != null) {
      System.out.println("doc h:"+rootDocument.getHeight());
      addVar("width", new JsFunction(ID_WIDTH, -1));
      addVar("height", new JsFunction(ID_HEIGHT, -1));
      addVar("innerWidth", new JsFunction(ID_WIDTH, -1));
      addVar("innerHeight", new JsFunction(ID_HEIGHT, -1));
    } else {
      System.out.println("null doc root passed to JsWindow"); //FIXME: need proper err handling
    }
    stack.setObject(0, this);
  }
View Full Code Here

        synchronized (schedule) {
          next = (Object[]) schedule.elementAt(0);
          schedule.removeElementAt(0);
        }
        long time = ((Long) next[1]).longValue();
        JsFunction call = (JsFunction) next[2];
        synchronized (eventLock) {
          eventLock.wait (Math.max(5, time - System.currentTimeMillis()));
          // Note: stack[0] is filled with 'this' in the constructor
          stack.setObject(1, this);
          stack.setObject(2, call);
          call.eval(stack, 1, 0);
        }
       
        this.rootDocument.invalidate(false);//repaint!
        if (next.length == 4) {
          schedule(call, ((Integer) next[3]).intValue(), true);
View Full Code Here

          e.printStackTrace();
        }
    }
    addVar("responseText", responseText.toString());
    addVar("readyState", READY_STATE_DONE);
    JsFunction onReadyStateChangeCallBack = (JsFunction) this
        .getObject("onReadyStateChange");
    if (onReadyStateChangeCallBack != null) {
      doCallBack(onReadyStateChangeCallBack);
    } else {
      // System.out.println("NO callback:" + onReadyStateChangeCallBack);
View Full Code Here

    super(PROTOTYPE);
   
    this.rootDocument = rootDocument;
    scopeChain = JsSystem.createGlobal();
   
    addVar("getElementById", new JsFunction(ID_GET_ELEMENT_BY_ID, 1));
    addVar("write", new JsFunction(ID_WRITE, 1));
  
    addVar("setTimeout", new JsFunction(ID_SET_TIMEOUT, 2));
    addVar("setInterval", new JsFunction(ID_SET_INTERVAL, 2));
    addVar("document", this);
    addVar("window", this);
   
    if (rootDocument != null) {
      addVar("width", new Double(rootDocument.getWidth()));
View Full Code Here

        synchronized (schedule) {
          next = (Object[]) schedule.elementAt(0);
          schedule.removeElementAt(0);
        }
        long time = ((Long) next[1]).longValue();
        JsFunction call = (JsFunction) next[2];
        synchronized (eventLock) {
          eventLock.wait (Math.max(5, time - System.currentTimeMillis()));
          // Note: stack[0] is filled with 'this' in the constructor
          stack.setObject(1, this);
          stack.setObject(2, call);
          call.eval(stack, 1, 0);
        }
        //screen.drawTree(g, dx, dy, clipX, clipY, clipW, clipH); //FIXME: need to get hold of g
        if (next.length == 4) {
          schedule(call, ((Integer) next[3]).intValue(), true);
        }
View Full Code Here

  private void onLoadCallBack(JsFunction callBack) {
    System.out.println("finished loading img");
    addVar("width", new Integer(this.imgWidget.getWidth()));
    addVar("height", new Integer(this.imgWidget.getHeight()));
   
    JsFunction onLoadCallBack = (JsFunction) this.getObject("onLoad");
    if (onLoadCallBack != null) {
      synchronized (callbackEventLock) {
        JsArray callBackStack = new JsArray();
        callBackStack.setObject(0, this.callBackScope);
        callBackStack.setObject(1, callBack);
View Full Code Here

    super(PROTOTYPE);
    scopeChain = JsSystem.createGlobal();
    this.midlet = midlet;
    this.screen = new Canvas2D(this);
   
    addVar("getElementById", new JsFunction(ID_GET_ELEMENT_BY_ID, 1));
    addVar("write", new JsFunction(ID_WRITE, 1));
    addVar("getContext", new JsFunction(ID_GET_CONTEXT, 1));
    addVar("setTimeout", new JsFunction(ID_SET_TIMEOUT, 2));
    addVar("setInterval", new JsFunction(ID_SET_INTERVAL, 2));
    addVar("document", this);
    addVar("window", this);
       
    addVar("width", new Double(screen.getWidth()));
    addVar("height", new Double(screen.getHeight()));
View Full Code Here

        synchronized (schedule) {
          next = (Object[]) schedule.elementAt(0);
          schedule.removeElementAt(0);
        }
        long time = ((Long) next[1]).longValue();
        JsFunction call = (JsFunction) next[2];
        synchronized (eventLock) {
          eventLock.wait (Math.max(5, time - System.currentTimeMillis()));
          // Note: stack[0] is filled with 'this' in the constructor
          stack.setObject(1, this);
          stack.setObject(2, call);
          call.eval(stack, 1, 0);
        }
        screen.repaint();
        if (next.length == 4) {
          schedule(call, ((Integer) next[3]).intValue(), true);
        }
View Full Code Here

TOP

Related Classes of com.google.minijoe.sys.JsFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.