|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package javax.microedition.m2g; |
|
20 |
|
21 |
|
22 /** |
|
23 * <p>This interface is used to load external resources that are referenced |
|
24 * within a ScalableImage, namely within an SVG document in the case of SVG. |
|
25 * In SVGT 1.1, these resources are not required for displaying the SVG document. |
|
26 * If no ExternalResourceHandler is registered when creating the image, |
|
27 * the engine will retrieve these resources using its own implementation |
|
28 * of the requestResource method.</p> |
|
29 *<p> |
|
30 * The default engine behaviour can be overwritten by passing to {@link javax.microedition.m2g.ScalableImage#createImage createImage} |
|
31 * an implementation of this interface as paramater when the default implementation |
|
32 * is insufficient. For example, if the SVGImage is loaded from within a |
|
33 * Jar file, the implementation will not be able to load images that |
|
34 * have relative URIs (e.g., <image xlink:href="myImage.png" />). |
|
35 * All the external resources are requested by the engine at the time of |
|
36 * the <code>createImage</code> call. Note that SVGT 1.1 does |
|
37 * not contain external references to SVG files, therefore an external |
|
38 * resource can not contain subsequent external resources. </p> |
|
39 * |
|
40 * @see javax.microedition.m2g.ScalableImage |
|
41 */ |
|
42 public interface ExternalResourceHandler |
|
43 { |
|
44 |
|
45 /** |
|
46 * This method is invoked when an external resource is required by the underlying implementation. |
|
47 * When the request is completed by the implementation of this handler, a notification |
|
48 * must be sent to the SVG engine through the requestCompleted() method of <code>ScalableImage</code>. |
|
49 * To get a synchronous behaviour, requestCompleted() can be called in the implementation |
|
50 * of requestResource. If called later, rendering the document before |
|
51 * completing all the requests will just display the currently available content. |
|
52 * Once the request is completed, the image will have to be redrawn to reflect the newly |
|
53 * available data. |
|
54 * For more details on required resources, please refer to the <code>externalResourcesRequired</code> |
|
55 * attribute description in the SVG specification. |
|
56 * |
|
57 * @param image image that originated the external data request |
|
58 * @param URI the URI for the external resource. |
|
59 */ |
|
60 public void requestResource(ScalableImage image, String URI); |
|
61 |
|
62 }; |