@Override protected void setInstanceIdValue(int id, Scriptable start, Object value) { Scriptable original = start; ProgressBarProxyPrototype proxy = this; while (start != null && !(start instanceof ProgressBarProxyPrototype)) { start = start.getPrototype(); } if (start instanceof ProgressBarProxyPrototype) { proxy = (ProgressBarProxyPrototype) start; } switch (id) { case Id_min: proxy.setProperty("min", value); proxy.onPropertyChanged("min", value); break; case Id_max: proxy.setProperty("max", value); proxy.onPropertyChanged("max", value); break; case Id_value: proxy.setProperty("value", value); proxy.onPropertyChanged("value", value); break; case Id_message: proxy.setProperty("message", value); proxy.onPropertyChanged("message", value); break; default: throw new IllegalArgumentException(String.valueOf(id)); } }
@Override protected Object getInstanceIdValue(int id, Scriptable start) { ProgressBarProxyPrototype proxy = this; while (start != null && !(start instanceof ProgressBarProxyPrototype)) { start = start.getPrototype(); } if (start instanceof ProgressBarProxyPrototype) { proxy = (ProgressBarProxyPrototype) start; } switch (id) { case Id_min: return proxy.getProperty("min"); case Id_max: return proxy.getProperty("max"); case Id_value: return proxy.getProperty("value"); case Id_message: return proxy.getProperty("message"); default: throw new IllegalArgumentException(String.valueOf(id)); } }
@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)); } }