You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2002/03/07 16:16:51 UTC
cvs commit: xml-batik/xdocs scriptFeatures.xml site-book.xml
hillion 02/03/07 07:16:51
Modified: samples starfield.svg
sources/org/apache/batik/script/rhino WindowWrapper.java
xdocs site-book.xml
Added: xdocs scriptFeatures.xml
Log:
- Removed the optional arguments from 'setTimeout' and 'setInterval'
since only netscape 4 use this form.
- Added a chapter in the doc about the scripting features in Batik.
Revision Changes Path
1.4 +15 -7 xml-batik/samples/starfield.svg
Index: starfield.svg
===================================================================
RCS file: /home/cvs/xml-batik/samples/starfield.svg,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- starfield.svg 25 Feb 2002 15:05:31 -0000 1.3
+++ starfield.svg 7 Mar 2002 15:16:50 -0000 1.4
@@ -14,7 +14,7 @@
<!-- A star field -->
<!-- -->
<!-- @author shillion@ilog.fr -->
-<!-- @version $Id: starfield.svg,v 1.3 2002/02/25 15:05:31 hillion Exp $ -->
+<!-- @version $Id: starfield.svg,v 1.4 2002/03/07 15:16:50 hillion Exp $ -->
<!-- ========================================================================= -->
<svg xmlns="http://www.w3.org/2000/svg"
@@ -213,6 +213,9 @@
}
}
+ var controlPanelDy;
+ var controlPanelSgn;
+
//
// Shows/hides the control panel.
//
@@ -222,10 +225,14 @@
showControlPanel = !showControlPanel
if (showControlPanel) {
updateText("help", helpText2)
- setTimeout(controlPanelAnimation, 50, 20, 1)
+ controlPanelDy = 20
+ controlPanelSgn = 1
+ setTimeout("controlPanelAnimation()", 50)
} else {
updateText("help", helpText1)
- setTimeout(controlPanelAnimation, 50, 0, -1)
+ controlPanelDy = 0
+ controlPanelSgn = -1
+ setTimeout("controlPanelAnimation()", 50)
}
}
}
@@ -233,13 +240,14 @@
//
// Animates the control panel.
//
- function controlPanelAnimation(n, sgn) {
+ function controlPanelAnimation() {
var elt = document.getElementById("control-panel");
- elt.setAttributeNS(null, "transform", "translate(0 " + ((n - 100) * sgn) + ")");
+ elt.setAttributeNS(null, "transform", "translate(0 " + ((controlPanelDy - 100) * controlPanelSgn) + ")");
- if (n < 200) {
- setTimeout(controlPanelAnimation, 50, n + 20, sgn)
+ if (controlPanelDy < 200) {
+ controlPanelDy += 20
+ setTimeout("controlPanelAnimation()", 50)
} else {
controlPanelMoving = false;
}
1.2 +9 -3 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WindowWrapper.java 25 Feb 2002 15:05:33 -0000 1.1
+++ WindowWrapper.java 7 Mar 2002 15:16:50 -0000 1.2
@@ -27,7 +27,7 @@
* This class wraps a Window object to expose it to the interpreter.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: WindowWrapper.java,v 1.1 2002/02/25 15:05:33 hillion Exp $
+ * @version $Id: WindowWrapper.java,v 1.2 2002/03/07 15:16:50 hillion Exp $
*/
public class WindowWrapper extends ScriptableObject {
@@ -82,14 +82,17 @@
long to = ((Long)NativeJavaObject.coerceType
(Long.TYPE, args[1])).longValue();
if (args[0] instanceof Function) {
+ /*
Object[] fargs = new Object[len - 2];
for (int i = 2, j = 0; i < len; i++, j++) {
fargs[j] = args[i];
}
+ */
RhinoInterpreter interp =
(RhinoInterpreter)window.getInterpreter();
FunctionWrapper fw;
- fw = new FunctionWrapper(interp, (Function)args[0], fargs);
+ fw = new FunctionWrapper(interp, (Function)args[0],
+ new Object[0]);
return window.setInterval(fw, to);
}
String script =
@@ -114,14 +117,17 @@
long to = ((Long)NativeJavaObject.coerceType
(Long.TYPE, args[1])).longValue();
if (args[0] instanceof Function) {
+ /*
Object[] fargs = new Object[len - 2];
for (int i = 2, j = 0; i < len; i++, j++) {
fargs[j] = args[i];
}
+ */
RhinoInterpreter interp =
(RhinoInterpreter)window.getInterpreter();
FunctionWrapper fw;
- fw = new FunctionWrapper(interp, (Function)args[0], fargs);
+ fw = new FunctionWrapper(interp, (Function)args[0],
+ new Object[0]);
return window.setTimeout(fw, to);
}
String script =
1.26 +4 -3 xml-batik/xdocs/site-book.xml
Index: site-book.xml
===================================================================
RCS file: /home/cvs/xml-batik/xdocs/site-book.xml,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- site-book.xml 31 Jul 2001 13:09:06 -0000 1.25
+++ site-book.xml 7 Mar 2002 15:16:50 -0000 1.26
@@ -12,7 +12,7 @@
<!-- author stephane@hillion.org -->
<!-- author tkormann@apache.org -->
<!-- author vincent.hardy@eng.sun.com -->
-<!-- version $Id: site-book.xml,v 1.25 2001/07/31 13:09:06 hillion Exp $ -->
+<!-- version $Id: site-book.xml,v 1.26 2002/03/07 15:16:50 hillion Exp $ -->
<!-- ========================================================================= -->
<book title="Apache Batik documentation" copyright="2000-2001 The Apache Software Foundation">
@@ -58,8 +58,9 @@
<page id="architecture" label="Architecture" source="architecture.xml"/>
<page id="svggen" label="Generator" source="svggen.xml" />
<page id="domapi" label="DOM API" source="domTutorial.xml" />
- <page id="scripting" label="Scripting" source="scriptIntro.xml" />
- <page id="svgcanvas" label="JSVGCanvas" source="jsvgcanvas.xml" />
+ <page id="scripting" label="Scripting Intro" source="scriptIntro.xml" />
+ <page id="scriptfeatures" label="Script Features" source="scriptFeatures.xml" />
+ <page id="svgcanvas" label="JSVGCanvas" source="jsvgcanvas.xml" />
<page id="rasterizerTutorial" label="Transcoder API" source="rasterizerTutorial.xml"/>
<separator/>
<page id="extendingBatik" label="Extensions" source="extendingBatik.xml" />
1.1 xml-batik/xdocs/scriptFeatures.xml
Index: scriptFeatures.xml
===================================================================
<?xml version="1.0"?>
<!DOCTYPE document SYSTEM "./dtd/document-v10.dtd">
<!-- ========================================================================= -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software License -->
<!-- version 1.1, a copy of which has been included with this distribution in -->
<!-- the LICENSE file. -->
<!-- ========================================================================= -->
<!-- ========================================================================= -->
<!-- author shillion@ilog.fr -->
<!-- version $Id: scriptFeatures.xml,v 1.1 2002/03/07 15:16:50 hillion Exp $ -->
<!-- ========================================================================= -->
<document>
<header>
<title>Batik Scripting Features</title>
<authors>
<person name="Stephane Hillion" email="shillion@ilog.fr"/>
</authors>
</header>
<body>
<s1 title="Introduction">
<p>
This page lists the scripting features supported by Batik.
The ECMAScript syntax is used.
</p>
<note>
The features implemented in Batik are some of those found in all
the most popular web browsers.
</note>
</s1>
<s1 title="The window object">
<p>
The Batik internals can be accessed in script by using the
<code>window</code> object.
</p>
<note>In the ECMAScript programs executed in an SVG document,
the <code>window</code> object is the global object, so
its properties and methods can be accessed without qualifing
them.</note>
<p>
It provides the following features:
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Property <code>document</code></td>
</tr>
</table>
<p>
The current SVG document.
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Property <code>event</code> (or <code>evt</code>)</td>
</tr>
</table>
<p>
The last triggered event.
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Property <code>window</code></td>
</tr>
</table>
<p>
An alias to the current global object.
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Method <code>alert</code>(<em>message</em>)</td>
</tr>
</table>
<p>
Shows an alert dialog.
</p>
<ul>
<li><em>message</em>: The string to display</li>
</ul>
<!-- ========================================================= -->
<table>
<tr>
<td>Method <code>confirm</code>(<em>question</em>)</td>
</tr>
</table>
<p>
Shows an confirm dialog with 'OK' and 'Cancel' button.
</p>
<ul>
<li><em>question</em>: The string to display</li>
</ul>
<p>
This method returns <code>true</code> if the user clicked on the
'OK' button, <code>false</code> otherwise.
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Method <code>prompt</code>(<em>message</em>,
[<em>defaultValue</em>])</td>
</tr>
</table>
<p>
Shows an input dialog.
</p>
<ul>
<li><em>message</em>: The string to display</li>
<li><em>defaultValue</em>: The optional default value to set
when the dialog first displays.</li>
</ul>
<p>
This method returns the string value entered by the user, or null.
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Method <code>setInterval</code>(<em>script</em>,
<em>interval</em>)</td>
</tr>
</table>
<p>
Evaluates the given string repeatedly after the given amount of
time. This method does not stall the script: the evaluation is
scheduled and the script continues its execution.
</p>
<ul>
<li><em>script</em>: A string representing the script to evaluate.</li>
<li><em>interval</em>: The interval in milliseconds.</li>
</ul>
<p>
This method returns an object which can be used with
<code>clearInterval</code>.
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Method <code>setInterval</code>(<em>function</em>,
<em>interval</em>)</td>
</tr>
</table>
<p>
Calls the given function repeatedly after the given amount of
time. This method does not stall the script: the evaluation is
scheduled and the script continues its execution.
</p>
<ul>
<li><em>function</em>: A function to call.</li>
<li><em>interval</em>: The interval in milliseconds.</li>
</ul>
<p>
This method returns an object which can be used with
<code>clearInterval</code>.
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Method <code>clearInterval</code>(<em>intervalID</em>)</td>
</tr>
</table>
<p>
Cancels an interval that was set by a call to <code>setInterval</code>.
</p>
<ul>
<li><em>intervalID</em>: An object returned by a call to
<code>setInterval</code>.</li>
</ul>
<!-- ========================================================= -->
<table>
<tr>
<td>Method <code>setTimeout</code>(<em>script</em>,
<em>timeout</em>)</td>
</tr>
</table>
<p>
Evaluates the given string after the given amount of
time. This method does not stall the script: the evaluation is
scheduled and the script continues its execution.
</p>
<ul>
<li><em>script</em>: A string representing the script to evaluate.</li>
<li><em>interval</em>: The timeout in milliseconds.</li>
</ul>
<p>
This method returns an object which can be used with
<code>clearTimeout</code>.
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Method <code>setTimeout</code>(<em>function</em>,
<em>timeout</em>)</td>
</tr>
</table>
<p>
Calls the given function after the given amount of
time. This method does not stall the script: the evaluation is
scheduled and the script continues its execution.
</p>
<ul>
<li><em>function</em>: A function to call.</li>
<li><em>interval</em>: The timeout in milliseconds.</li>
</ul>
<p>
This method returns an object which can be used with
<code>clearTimeout</code>.
</p>
<!-- ========================================================= -->
<table>
<tr>
<td>Method <code>clearTimeout</code>(<em>timeoutID</em>)</td>
</tr>
</table>
<p>
Cancels an timeout that was set by a call to <code>setTimeout</code>.
</p>
<ul>
<li><em>timeoutID</em>: An object returned by a call to
<code>setTimeout</code>.</li>
</ul>
</s1>
</body>
</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org