コード例 #1
0
  @Override
  public Object execIdCall(
      IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
    if (!f.hasTag(CLASS_TAG)) {
      return super.execIdCall(f, cx, scope, thisObj, args);
    }

    while (thisObj != null && !(thisObj instanceof AttrProxyPrototype)) {
      thisObj = thisObj.getPrototype();
    }

    AttrProxyPrototype proxy = (AttrProxyPrototype) thisObj;
    int id = f.methodId();
    switch (id) {
      case Id_constructor:
        return jsConstructor(scope, args);
      case Id_getValue:
        return getValue(cx, thisObj, args);

      case Id_getName:
        return getName(cx, thisObj, args);

      case Id_getOwnerElement:
        return getOwnerElement(cx, thisObj, args);

      case Id_getSpecified:
        return getSpecified(cx, thisObj, args);

      case Id_setValue:
        setValue(cx, thisObj, args);
        return Undefined.instance;
      default:
        throw new IllegalArgumentException(String.valueOf(id));
    }
  }
コード例 #2
0
  @Override
  public Object execIdCall(
      IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
    if (!f.hasTag(CLASS_TAG)) {
      return super.execIdCall(f, cx, scope, thisObj, args);
    }

    while (thisObj != null && !(thisObj instanceof ProgressBarProxyPrototype)) {
      thisObj = thisObj.getPrototype();
    }

    ProgressBarProxyPrototype proxy = (ProgressBarProxyPrototype) thisObj;
    int id = f.methodId();
    switch (id) {
      case Id_constructor:
        return jsConstructor(scope, args);
      case Id_getMin:
        return proxy.getProperty("min");
      case Id_setMin:
        proxy.setProperty("min", args[0]);
        proxy.onPropertyChanged("min", args[0]);
        return Undefined.instance;
      case Id_getMax:
        return proxy.getProperty("max");
      case Id_setMax:
        proxy.setProperty("max", args[0]);
        proxy.onPropertyChanged("max", args[0]);
        return Undefined.instance;
      case Id_getValue:
        return proxy.getProperty("value");
      case Id_setValue:
        proxy.setProperty("value", args[0]);
        proxy.onPropertyChanged("value", args[0]);
        return Undefined.instance;
      case Id_getMessage:
        return proxy.getProperty("message");
      case Id_setMessage:
        proxy.setProperty("message", args[0]);
        proxy.onPropertyChanged("message", args[0]);
        return Undefined.instance;
      default:
        throw new IllegalArgumentException(String.valueOf(id));
    }
  }