KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > script > Window


1 /*
2
3    Copyright 1999-2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17 */

18
19 package org.apache.batik.script;
20
21 import org.apache.batik.bridge.BridgeContext;
22 import org.w3c.dom.Document JavaDoc;
23 import org.w3c.dom.Node JavaDoc;
24
25 /**
26  * This interface represents the 'window' object defined in the global
27  * environment of a SVG document.
28  *
29  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
30  * @version $Id: Window.java,v 1.10 2004/11/18 01:47:01 deweese Exp $
31  */

32 public interface Window {
33     /**
34      * Evaluates the given string repeatedly after the given amount of
35      * time. This method does not stall the script: the evaluation is
36      * scheduled and the script continues its execution.
37      * @return an object representing the interval created.
38      */

39     Object JavaDoc setInterval(String JavaDoc script, long interval);
40
41     /**
42      * Calls the 'run' method of the given Runnable repeatedly after
43      * the given amount of time. This method does not stall the
44      * script: the evaluation is scheduled and the script continues
45      * its execution.
46      * @return an object representing the interval created.
47      */

48     Object JavaDoc setInterval(Runnable JavaDoc r, long interval);
49
50     /**
51      * Cancels an interval that was set by a call to 'setInterval'.
52      */

53     void clearInterval(Object JavaDoc interval);
54
55     /**
56      * Evaluates the given string after the given amount of time.
57      * This method does not stall the script: the evaluation is
58      * scheduled and the script continues its execution.
59      * @return an object representing the timeout created.
60      */

61     Object JavaDoc setTimeout(String JavaDoc script, long timeout);
62
63     /**
64      * Calls the 'run' method of the given Runnable after the given
65      * amount of time. This method does not stall the script: the
66      * evaluation is scheduled and the script continues its execution.
67      * @return an object representing the timeout created.
68      */

69     Object JavaDoc setTimeout(Runnable JavaDoc r, long timeout);
70
71     /**
72      * Cancels an timeout that was set by a call to 'setTimeout'.
73      */

74     void clearTimeout(Object JavaDoc timeout);
75
76     /**
77      * Parses the given XML string into a DocumentFragment of the
78      * given document or a new document if 'doc' is null.
79      * @return The document fragment or null on error.
80      */

81     Node JavaDoc parseXML(String JavaDoc text, Document JavaDoc doc);
82
83     /**
84      * Gets data from the given URI.
85      * @param uri The URI where the data is located.
86      * @param h A handler called when the data is available.
87      */

88     void getURL(String JavaDoc uri, URLResponseHandler h);
89
90     /**
91      * Gets data from the given URI.
92      * @param uri The URI where the data is located.
93      * @param h A handler called when the data is available.
94      * @param enc The character encoding of the data.
95      */

96     void getURL(String JavaDoc uri, URLResponseHandler h, String JavaDoc enc);
97
98     /**
99      * Posts data to the given URI.
100      * @param uri The URI where the data is located.
101      * @param content The data to post to the server.
102      * @param h A handler called when the data is available.
103      */

104     void postURL(String JavaDoc uri, String JavaDoc content, URLResponseHandler h);
105     
106     /**
107      * Posts data to the given URI.
108      * @param uri The URI where the data is located.
109      * @param content The data to post to the server.
110      * @param h A handler called when the data is available.
111      * @param mimeType The mimeType to asscoiate with post.
112      */

113     void postURL(String JavaDoc uri, String JavaDoc content, URLResponseHandler h,
114                  String JavaDoc mimeType);
115
116     /**
117      * Posts data to the given URI.
118      * @param uri The URI where the data is located.
119      * @param content The data to post to the server.
120      * @param h A handler called when the data is available.
121      * @param mimeType The mimeType to asscoiate with post.
122      * @param enc The encoding to apply to <tt>content</tt>
123      * may be "gzip", "deflate", or <tt>null</tt>.
124      */

125     void postURL(String JavaDoc uri, String JavaDoc content, URLResponseHandler h,
126                  String JavaDoc mimeType, String JavaDoc enc);
127
128
129     /**
130      * To handle the completion of a 'getURL()' or 'postURL' call.
131      */

132     public interface URLResponseHandler {
133         
134         /**
135          * Called when the response is recieved.
136          * @param success Whether the data was successfully retreived.
137          * @param mime The data MIME type.
138          * @param content The data.
139          */

140         void getURLDone(boolean success, String JavaDoc mime, String JavaDoc content);
141     }
142
143     /**
144      * To handle the completion of a 'getURL()' call.
145     public interface GetURLHandler extends URLResponseHandler { }
146      */

147
148
149     /**
150      * Displays an alert dialog box.
151      */

152     void alert(String JavaDoc message);
153
154     /**
155      * Displays a confirm dialog box.
156      */

157     boolean confirm(String JavaDoc message);
158
159     /**
160      * Displays an input dialog box.
161      * @return The input of the user, or null if the dialog was cancelled.
162      */

163     String JavaDoc prompt(String JavaDoc message);
164
165     /**
166      * Displays an input dialog box, given the default value.
167      * @return The input of the user, or null if the dialog was cancelled.
168      */

169     String JavaDoc prompt(String JavaDoc message, String JavaDoc defVal);
170
171     /**
172      * Returns the current BridgeContext. This object given a deep
173      * access to the viewer internals.
174      */

175     BridgeContext getBridgeContext();
176
177     /**
178      * Returns the associated interpreter.
179      */

180     Interpreter getInterpreter();
181 }
182
Popular Tags