// http://xmlgraphics.apache.org/batik/faq.html#display-does-not-update
// http://xmlgraphics.apache.org/batik/faq.html#must-mouseover-to-change
final Scriptable thisObj = getScriptable();
final ItsNatSVGOMDocumentBatik batikDoc = getItsNatSVGOMDocBatikInBrowser().getItsNatSVGOMDocumentBatik();
JSVGCanvasApplet canvas = batikDoc.getJSVGCanvasApplet();
UpdateManager um = canvas.getUpdateManager();
RunnableQueue queue = um.getUpdateRunnableQueue();
try
{
queue.invokeAndWait(
new Runnable()
{
public void run()
{
Object[] jsParams;
if (params != null)
{
if (params.length == 0) jsParams = params;
else
{
jsParams = new Object[params.length];
for(int i = 0; i < params.length; i++)
{
Object param = params[i];
if (param != null)
{
// Este es un intento de hacer lo más interoperable posible Batik y el browser
if (param instanceof ObjectBatikInBrowser)
jsParams[i] = ((ObjectBatikInBrowser)param).getScriptable();
else
jsParams[i] = param;
}
}
}
}
else jsParams = new Object[0];
RhinoInterpreterFixed interpreter = batikDoc.getRhinoInterpreterFixed();
Function func = (Function)ScriptableObject.getProperty(thisObj,name);
res[0] = interpreter.callJSMethod(func, thisObj,params);
}
}
);