deweese 2003/12/30 11:34:28 Modified: . build.xml contrib/solitaire solitaire.svg contrib/solitaire/cards default.svg lib js.jar sources/org/apache/batik/script/rhino WindowWrapper.java Log: 1) All return values from Window methods are properly wrapped as JavaScript Objects. 2) Rhino no longer throws an error if you ask for the 'svgDocument' on window. 3) 'solitaire' now works with ASV 3.0 Revision Changes Path 1.147 +3 -1 xml-batik/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/xml-batik/build.xml,v retrieving revision 1.146 retrieving revision 1.147 diff -u -r1.146 -r1.147 --- build.xml 18 Dec 2003 12:08:38 -0000 1.146 +++ build.xml 30 Dec 2003 19:34:28 -0000 1.147 @@ -147,6 +147,8 @@ <echo message=" ttf2svg --> converts selected glyphs from a True Type"/> <echo message=" Font file to the SVG Font format"/> <echo message=" regard --> runs the regard regression utility"/> + <echo message=" regard.manual --> runs regard tests that require user"/> + <echo message=" interaction."/> <echo message=" runtestsuite --> runs a TestSuite, given an XML test suite"/> <echo message=" document"/> <echo message=" runtest --> runs a test whose class name is given at the command line"/> 1.2 +27 -4 xml-batik/contrib/solitaire/solitaire.svg Index: solitaire.svg =================================================================== RCS file: /home/cvs/xml-batik/contrib/solitaire/solitaire.svg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- solitaire.svg 20 Dec 2003 00:06:44 -0000 1.1 +++ solitaire.svg 30 Dec 2003 19:34:28 -0000 1.2 @@ -60,7 +60,8 @@ <svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink"> + xmlns:xlink="http://www.w3.org/1999/xlink" + onload="loadHandler(evt)"> <script language="text/ecmascript" xlink:href="script/util.js"/> <script language="text/ecmascript" xlink:href="script/board.js"/> @@ -73,6 +74,7 @@ var cg = document.getElementById("cards"); var dragGroup = document.getElementById("drag"); var winGroup = document.getElementById("win"); + var root = document.getRootElement(); var BOARD = new Board(cg, dragGroup); BOARD.setNotifyMoveDone(solitareMoveDone); @@ -86,8 +88,30 @@ var pileUp, pileDown; var dealUp, dealDown; + function loadHandler(evt) { + getURL("cards/default.svg", setupCards); + } + + function setupCards(result) { + if (!result.content) + return; + var doc = parseXML(result.content, document); + var fc; + for (fc=doc.firstChild; fc; fc = fc.nextSibling) { + if (fc.nodeName == "svg") break; + } + if (fc.nodeName != "svg") return; + for (fc=fc.firstChild; fc; fc = fc.nextSibling) { + if (fc.nodeName == "defs") break; + } + if (fc.nodeName != "defs") return; + root.appendChild(fc); + init(); + } + + function init() { - var deck = new Deck(document, 1, "cards/default.svg", 75, 105); + var deck = new Deck(document, 1, "", 75, 105); deck.shuffle(); for (var i=0; i<4; i++) { DECK_PILES[i].setDragCheck(deckDragCheck); @@ -131,7 +155,6 @@ dealUp.addCard(deck.dealCard(i==2)); } } - init(); var DOUBLE_CLICK_TGT; var DOUBLE_CLICK_X; 1.2 +5 -15 xml-batik/contrib/solitaire/cards/default.svg Index: default.svg =================================================================== RCS file: /home/cvs/xml-batik/contrib/solitaire/cards/default.svg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- default.svg 20 Dec 2003 00:06:44 -0000 1.1 +++ default.svg 30 Dec 2003 19:34:28 -0000 1.2 @@ -1,6 +1,6 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" - "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> +<svg width="1000" height="450" viewBox="0 0 1000 450" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- ============================================================================ @@ -56,17 +56,7 @@ <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id$ --> <!-- ====================================================================== --> -<svg width="1000" height="450" viewBox="0 0 1000 450" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink"> - - <font-face font-family="strokeBSVG"> - <font-face-src> - <font-face-uri xlink:href="strokeFont.svg#strokeB"/> - </font-face-src> - </font-face> - - <defs > + <defs id="cardDefs"> <symbol id="heart" viewBox="0 0 102 109"> <path d="M51,109 c7,-35 51,-59 51,-80 c0,-16 -10,-29 -22,-29 c-16,0 -29,13 -29,29 c0,-16 -13,-29 -29,-29 1.10 +285 -290 xml-batik/lib/js.jar <<Binary file>> 1.20 +17 -13 xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java Index: WindowWrapper.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- WindowWrapper.java 9 Aug 2003 16:58:40 -0000 1.19 +++ WindowWrapper.java 30 Dec 2003 19:34:28 -0000 1.20 @@ -121,11 +121,11 @@ FunctionWrapper fw; fw = new FunctionWrapper(interp, (Function)args[0], EMPTY_ARGUMENTS); - return window.setInterval(fw, to); + return Context.toObject(window.setInterval(fw, to), thisObj); } String script = (String)Context.toType(args[0], String.class); - return window.setInterval(script, to); + return Context.toObject(window.setInterval(script, to), thisObj); } /** @@ -148,11 +148,11 @@ FunctionWrapper fw; fw = new FunctionWrapper(interp, (Function)args[0], EMPTY_ARGUMENTS); - return window.setTimeout(fw, to); + return Context.toObject(window.setTimeout(fw, to), thisObj); } String script = (String)Context.toType(args[0], String.class); - return window.setTimeout(script, to); + return Context.toObject(window.setTimeout(script, to), thisObj); } /** @@ -203,13 +203,14 @@ AccessControlContext acc = ((RhinoInterpreter)window.getInterpreter()).getAccessControlContext(); - return AccessController.doPrivileged( new PrivilegedAction() { + Object ret = AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return window.parseXML ((String)Context.toType(args[0], String.class), (Document)Context.toType(args[1], Document.class)); } }, acc); + return Context.toObject(ret, thisObj); } /** @@ -281,7 +282,7 @@ /** * Wraps the 'confirm' method of the Window interface. */ - public static boolean confirm(Context cx, + public static Object confirm(Context cx, Scriptable thisObj, Object[] args, Function funObj) @@ -291,15 +292,18 @@ if (len >= 1) { String message = (String)Context.toType(args[0], String.class); - return window.confirm(message); + if (window.confirm(message)) + return Context.toObject(Boolean.TRUE, thisObj); + else + return Context.toObject(Boolean.FALSE, thisObj); } - return false; + return Context.toObject(Boolean.FALSE, thisObj); } /** * Wraps the 'prompt' method of the Window interface. */ - public static String prompt(Context cx, + public static Object prompt(Context cx, Scriptable thisObj, Object[] args, Function funObj) @@ -308,19 +312,19 @@ Window window = ((RhinoInterpreter.ExtendedContext)cx).getWindow(); switch (len) { case 0: - return ""; + return Context.toObject("", thisObj); case 1: String message = (String)Context.toType(args[0], String.class); - return window.prompt(message); + return Context.toObject(window.prompt(message), thisObj); default: message = (String)Context.toType(args[0], String.class); String defVal = (String)Context.toType(args[1], String.class); - return window.prompt(message, defVal); + return Context.toObject(window.prompt(message, defVal), thisObj); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]