1 18 package org.apache.batik.script.rhino; 19 20 import org.mozilla.javascript.Context; 21 import org.mozilla.javascript.Scriptable; 22 import org.mozilla.javascript.WrapFactory; 23 import org.w3c.dom.events.EventTarget ; 24 25 33 class BatikWrapFactory extends WrapFactory { 34 private RhinoInterpreter interpreter; 35 36 public BatikWrapFactory(RhinoInterpreter interp) { 37 interpreter = interp; 38 setJavaPrimitiveWrap(false); 39 } 40 41 public Object wrap(Context ctx, Scriptable scope, 42 Object obj, Class staticType) { 43 if (obj instanceof EventTarget ) { 44 return interpreter.buildEventTargetWrapper((EventTarget )obj); 45 } 46 return super.wrap(ctx, scope, obj, staticType); 47 } 48 } 49 | Popular Tags |