Java Reference
In-Depth Information
public void run() {
synchronized (addToTree) {
for(inti=0;i<addToTree.size(); i++) {
svgDocument.getDocumentElement().appendChild(
(SVGElement) addToTree.elementAt(i));
}
addToTree.removeAllElements();
}
}
public void hideNotify() {
}
public void showNotify() {
}
}
■
Note
Listing 16-15
won't
work with JSR 226, as JSR 226 does not include the
SVGDocument
class,
support for the SVG DOM, or the ability to create empty SVG images with interaction hints. While it's possible
to create SVG XML on a Java ME device and render it using JSR 226, you won't have the flexibility that the
SVGDocument
and other JSR 287 classes provide that let you work with individual SVG DOM elements.
You initialize this call with a preexisting
SVGImage
. The image might be one from
another source, or you can create an empty
SVGImage
by invoking the
SVGImage static
method
createEmptyImage
, like this:
SVGImage svgImage = SVGImage.createEmptyImage( null, hints );
The first argument to
createEmptyImage
is an optional
ExternalResourceHandler
, just as
if you were creating an
SVGImage
for an existing image. The second argument is informa-
tion about the kind of interactions the
SVGImage
instance should expect from users and
the SVG content itself. It's a bit mask that can contain the following values, binary ORed:
•
SVGImage.INTERACTION_MODE_DISABLED
: Indicates that no user interaction with the
SVG image will take place
•
SVGImage.INTERACTION_MODE_SCRIPT_EXECUTION
: Indicates that script execution within
the SVG image may take place (with most implementations of the API, this has no
effect)