| <?xml version="1.0"?> |
| <!DOCTYPE document SYSTEM "./dtd/document-v10.dtd"> |
| |
| <!-- |
| |
| Copyright 2002 The Apache Software Foundation |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <!-- ========================================================================= --> |
| <!-- author shillion@ilog.fr --> |
| <!-- version $Id$ --> |
| <!-- ========================================================================= --> |
| <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 as global |
| variables and functions.</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 a confirm dialog with 'OK' and 'Cancel' buttons. |
| </p> |
| <ul> |
| <li><em>question</em>: The string to display</li> |
| </ul> |
| <p> |
| This method returns <code>true</code> if the user clicks 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>timeout</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>timeout</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 a 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> |
| |
| <!-- ========================================================= --> |
| |
| <table> |
| <tr> |
| <td>Method <code>parseXML</code>(<em>text</em>, |
| <em>document</em>)</td> |
| |
| </tr> |
| </table> |
| <p> |
| Parses and returns a DocumentFragment object. |
| </p> |
| <ul> |
| <li><em>text</em>: A string representing an XML document fragment.</li> |
| <li><em>document</em>: The document used to build the DOM |
| representation of the XML fragment.</li> |
| </ul> |
| <p> |
| This method returns a <code>org.w3c.dom.DocumentFragment</code> object. |
| </p> |
| |
| |
| <!-- ========================================================= --> |
| |
| <table> |
| <tr> |
| <td>Method <code>getURL</code>(<em>uri</em>, |
| <em>function</em>[, |
| <em>encoding</em>])</td> |
| |
| </tr> |
| </table> |
| <p> |
| Gets data from the given URI. This method returns immediately and |
| the given function is called when the data is fully downloaded. |
| </p> |
| <ul> |
| <li><em>uri</em>: A string representing the location of the data.</li> |
| <li><em>function</em>: A function called when the data is available, |
| or when the loading has failed. The argument passed to the |
| function is an ECMAScript Object with 3 properties: |
| <ul> |
| <li><em>success</em>: true if the data is available, false |
| otherwise,</li> |
| <li><em>contentType</em>: the content type of the data, if the |
| information is known by the viewer,</li> |
| <li><em>content</em>: A string representing the data.</li> |
| </ul> |
| </li> |
| <li><em>encoding</em>: The character encoding of the data file, |
| by default UTF-8 is used.</li> |
| |
| </ul> |
| |
| </s1> |
| </body> |
| </document> |