Package org.mozilla.javascript

Examples of org.mozilla.javascript.Function.call()


                Scriptable thisObj = scope;
                Context cx = Context.getCurrentContext();
                for (int i = 0; i < len; i++) {
                    ScriptableWidget row = wrap(repeater.getRow(i));
                    args[0] = row;
                    Object result = fun.call(cx, scope, thisObj, args);
                    index[i] = Context.toBoolean(result);
                }   
                for (int i = len-1; i >= 0; --i) {
                    if (index[i]) {
                        Widget row = repeater.getRow(i);
View Full Code Here


                    Object[] args = new Object[1];
                    Scriptable scope = getTopLevelScope(this);
                    Scriptable thisObj = scope;
                    Context cx = Context.getCurrentContext();
                    args[0] = ((ActionEvent)e).getActionCommand();
                    fun.call(cx, scope, thisObj, args);
                } catch (Exception exc) {
                    throw Context.reportRuntimeError(exc.getMessage());
                }
            }
        } else if (e instanceof ValueChangedEvent) {
View Full Code Here

                    Scriptable scope = getTopLevelScope(this);
                    Scriptable thisObj = scope;
                    Context cx = Context.getCurrentContext();
                    args[0] = vce.getOldValue();
                    args[1] = vce.getNewValue();
                    fun.call(cx, scope, thisObj, args);
                } catch (Exception exc) {
                    throw Context.reportRuntimeError(exc.getMessage());
                }
            }
        }
View Full Code Here

      }
      if(!stream.started){
        // call the onConnect function
        Scriptable global = GlobalData.getGlobalScope();
        Function onConnect = (Function) global.get("onConnect", global);
        onConnect.call(PersevereContextFactory.getContext(), global, global, new Object[]{ stream });
      }
      stream.started = true;
    }
    return stream;
  }
View Full Code Here

    final Function doAuthentication = (Function) global.get("authenticate", global);
    // create a wrapper to record the authenticated user in the current thread
    authenticateHandler = new PersevereNativeFunction(){
      @Override
      public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
        Object user = doAuthentication.call(cx, scope, thisObj, args);
        UserSecurity.registerThisThread(user);
        return user;
      }
     
    };
View Full Code Here

      if (nameObject instanceof String)
        name =  (String) nameObject;
     
      try{
        totalTests++;
        testFunction.call(cx, scope, thisObj, args);
        try{
          Transaction.currentTransaction().commit();
        }
        finally{
          Transaction.startTransaction();
View Full Code Here

    public String handle(ClientImpl client, Transport transport, Message message) throws IOException {
      if (!message.getChannel().startsWith("/meta")){
        // These are published messages
        Persistable target = (Persistable) Identification.idForString((String) message.getChannel()).getTarget();
        Function messageFunc = (Function) target.get("message");
        messageFunc.call(PersevereContextFactory.getContext(), GlobalData.getGlobalScope(), target, new Object[]{message.getData()});
        // don't actually publish it, let Persevere handle it
        return null;
      }
      if (message.getChannel().startsWith("/meta/subscribe")){
        // A subscription request, we just need to make sure the global listener
View Full Code Here

            // errors for get()s of nonexistent name, so use has() first
            if (ScriptableObject.hasProperty(obj, "toSource")) {
        Object v = ScriptableObject.getProperty(obj, "toSource");
        if (v instanceof Function) {
            Function f = (Function)v;
            return ScriptRuntime.toString(f.call(cx, scope, obj, ScriptRuntime.emptyArgs));
        }
            }
            return ScriptRuntime.toString(value);
        }
        return value.toString();
View Full Code Here

    Scriptable global = GlobalData.getGlobalScope();
    Function onDisconnect = (Function) global.get("onDisconnect", global);

    if(started){
     
      onDisconnect.call(PersevereContextFactory.getContext(), global, global, new Object[]{ this });
    }
  }


  public synchronized void fire(Notification response) throws IOException {
View Full Code Here

                    if(i > maxIterations && PersistableObject.isSecurityEnabled() && !UserSecurity.hasPermission(SystemPermission.runLongQueries)){
                      throw ScriptRuntime.constructError("AccessError", "Query has taken too much computation, and the user is not allowed to execute resource-intense queries. Increase maxIterations in your config file to allow longer running non-indexed queries to be processed.");
                    }
                  }
                  next = sourceIterator.next();
                  if(ScriptRuntime.toBoolean(f.call(cx, scope, thisObj, new Object[]{next, i, thisObj})))
                    return;
                  if(i > lastSizeEstimateIndex){
                    lastSizeEstimateIndex = i;
                    sizeEstimate--;
                  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.