http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Overview
FAQ
License
Download
Install
Demo

In the news

Tools and Apps
Browser
Rasterizer
Font Converter
Pretty-printer

Architecture
API (Javadoc)
Generator
DOM API
JSVGCanvas
Transcoder API

Scripting Intro
Scripting Features
Java Scripting
Security

Extensions

Testing

Contributors
Mail Lists

CVS Repository
Bug Database

Status

Glossary


Introduction

This page lists the scripting features supported by Batik. The ECMAScript syntax is used.

Note The features implemented in Batik are some of those found in all the most popular web browsers.


The window object

The Batik internals can be accessed in script by using the window object.

NoteIn the ECMAScript programs executed in an SVG document, the window object is the global object, so its properties and methods can be accessed as global variables and functions.

It provides the following features:

Property document 

The current SVG document.

Property event (or evt

The last triggered event.

Property window 

An alias to the current global object.

Method alert(message

Shows an alert dialog.

  • message: The string to display
Method confirm(question

Shows a confirm dialog with 'OK' and 'Cancel' buttons.

  • question: The string to display

This method returns true if the user clicks on the 'OK' button, false otherwise.

Method prompt(message[, defaultValue]) 

Shows an input dialog.

  • message: The string to display
  • defaultValue: The optional default value to set when the dialog first displays.

This method returns the string value entered by the user, or null.

Method setInterval(script, interval

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.

  • script: A string representing the script to evaluate.
  • interval: The interval in milliseconds.

This method returns an object which can be used with clearInterval.

Method setInterval(function, interval

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.

  • function: A function to call.
  • interval: The interval in milliseconds.

This method returns an object which can be used with clearInterval.

Method clearInterval(intervalID

Cancels an interval that was set by a call to setInterval.

  • intervalID: An object returned by a call to setInterval.
Method setTimeout(script, timeout

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.

  • script: A string representing the script to evaluate.
  • timeout: The timeout in milliseconds.

This method returns an object which can be used with clearTimeout.

Method setTimeout(function, timeout

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.

  • function: A function to call.
  • timeout: The timeout in milliseconds.

This method returns an object which can be used with clearTimeout.

Method clearTimeout(timeoutID

Cancels a timeout that was set by a call to setTimeout.

  • timeoutID: An object returned by a call to setTimeout.
Method parseXML(text, document

Parses and returns a DocumentFragment object.

  • text: A string representing an XML document fragment.
  • document: The document used to build the DOM representation of the XML fragment.

This method returns a org.w3c.dom.DocumentFragment object.

Method getURL(uri, function[, encoding]) 

Gets data from the given URI. This method returns immediately and the given function is called when the data is fully downloaded.

  • uri: A string representing the location of the data.
  • function: 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:
    • success: true if the data is available, false otherwise,
    • contentType: the content type of the data, if the information is known by the viewer,
    • content: A string representing the data.
  • encoding: The character encoding of the data file, by default UTF-8 is used.


Copyright © 2000-2002 The Apache Software Foundation. All Rights Reserved.