KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > swing > svg > SVGUserAgent


1 /*
2
3    Copyright 2001-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 package org.apache.batik.swing.svg;
19
20 import org.apache.batik.bridge.ExternalResourceSecurity;
21 import org.apache.batik.bridge.ScriptSecurity;
22 import org.apache.batik.util.ParsedURL;
23 import org.w3c.dom.Element JavaDoc;
24
25 /**
26  * This interface must be implemented to provide client services to
27  * a JSVGComponent.
28  *
29  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
30  * @version $Id: SVGUserAgent.java,v 1.17 2005/03/27 08:58:36 cam Exp $
31  */

32 public interface SVGUserAgent {
33     
34     /**
35      * Displays an error message.
36      */

37     void displayError(String JavaDoc message);
38     
39     /**
40      * Displays an error resulting from the specified Exception.
41      */

42     void displayError(Exception JavaDoc ex);
43
44     /**
45      * Displays a message in the User Agent interface.
46      * The given message is typically displayed in a status bar.
47      */

48     void displayMessage(String JavaDoc message);
49
50     /**
51      * Shows an alert dialog box.
52      */

53     void showAlert(String JavaDoc message);
54
55     /**
56      * Shows a prompt dialog box.
57      */

58     String JavaDoc showPrompt(String JavaDoc message);
59
60     /**
61      * Shows a prompt dialog box.
62      */

63     String JavaDoc showPrompt(String JavaDoc message, String JavaDoc defaultValue);
64
65     /**
66      * Shows a confirm dialog box.
67      */

68     boolean showConfirm(String JavaDoc message);
69
70     /**
71      * Returns the size of a px CSS unit in millimeters.
72      */

73     float getPixelUnitToMillimeter();
74
75     /**
76      * Returns the size of a px CSS unit in millimeters.
77      * This will be removed after next release.
78      * @see #getPixelUnitToMillimeter()
79      */

80     float getPixelToMM();
81
82     /**
83      * Returns the default font family.
84      */

85     String JavaDoc getDefaultFontFamily();
86
87     /**
88      * Returns the medium font size.
89      */

90     float getMediumFontSize();
91
92     /**
93      * Returns a lighter font-weight.
94      */

95     float getLighterFontWeight(float f);
96
97     /**
98      * Returns a bolder font-weight.
99      */

100     float getBolderFontWeight(float f);
101
102     /**
103      * Returns the language settings.
104      */

105     String JavaDoc getLanguages();
106
107     /**
108      * Returns the user stylesheet uri.
109      * @return null if no user style sheet was specified.
110      */

111     String JavaDoc getUserStyleSheetURI();
112
113     /**
114      * Returns the class name of the XML parser.
115      */

116     String JavaDoc getXMLParserClassName();
117
118     /**
119      * Returns true if the XML parser must be in validation mode, false
120      * otherwise.
121      */

122     boolean isXMLParserValidating();
123
124     /**
125      * Returns this user agent's CSS media.
126      */

127     String JavaDoc getMedia();
128
129     /**
130      * Returns this user agent's alternate style-sheet title.
131      */

132     String JavaDoc getAlternateStyleSheet();
133
134     /**
135      * Opens a link in a new component.
136      * @param uri The document URI.
137      * @param newc Whether the link should be activated in a new component.
138      */

139     void openLink(String JavaDoc uri, boolean newc);
140
141     /**
142      * Tells whether the given extension is supported by this
143      * user agent.
144      */

145     boolean supportExtension(String JavaDoc s);
146
147     /**
148      * Notifies the UserAgent that the input element
149      * has been found in the document. This is sometimes
150      * called, for example, to handle &lt;a&gt; or
151      * &lt;title&gt; elements in a UserAgent-dependant
152      * way.
153      */

154     void handleElement(Element JavaDoc elt, Object JavaDoc data);
155
156
157     /**
158      * Returns the security settings for the given script
159      * type, script url and document url
160      *
161      * @param scriptType type of script, as found in the
162      * type attribute of the &lt;script&gt; element.
163      * @param scriptURL url for the script, as defined in
164      * the script's xlink:href attribute. If that
165      * attribute was empty, then this parameter should
166      * be null
167      * @param docURL url for the document into which the
168      * script was found.
169      */

170     ScriptSecurity getScriptSecurity(String JavaDoc scriptType,
171                                      ParsedURL scriptURL,
172                                      ParsedURL docURL);
173         
174     /**
175      * This method throws a SecurityException if the script
176      * of given type, found at url and referenced from docURL
177      * should not be loaded.
178      *
179      * This is a convenience method to call checkLoadScript
180      * on the ScriptSecurity strategy returned by
181      * getScriptSecurity.
182      *
183      * @param scriptType type of script, as found in the
184      * type attribute of the &lt;script&gt; element.
185      * @param scriptURL url for the script, as defined in
186      * the script's xlink:href attribute. If that
187      * attribute was empty, then this parameter should
188      * be null
189      * @param docURL url for the document into which the
190      * script was found.
191      */

192     void checkLoadScript(String JavaDoc scriptType,
193                          ParsedURL scriptURL,
194                          ParsedURL docURL) throws SecurityException JavaDoc;
195
196     /**
197      * Returns the security settings for the given
198      * resource url and document url
199      *
200      * @param resourceURL url for the resource, as defined in
201      * the resource's xlink:href attribute. If that
202      * attribute was empty, then this parameter should
203      * be null
204      * @param docURL url for the document into which the
205      * resource was found.
206      */

207     ExternalResourceSecurity
208         getExternalResourceSecurity(ParsedURL resourceURL,
209                                     ParsedURL docURL);
210         
211     /**
212      * This method throws a SecurityException if the resource
213      * found at url and referenced from docURL
214      * should not be loaded.
215      *
216      * This is a convenience method to call checkLoadExternalResource
217      * on the ExternalResourceSecurity strategy returned by
218      * getExternalResourceSecurity.
219      *
220      * @param resourceURL url for the script, as defined in
221      * the resource's xlink:href attribute. If that
222      * attribute was empty, then this parameter should
223      * be null
224      * @param docURL url for the document into which the
225      * resource was found.
226      */

227     void checkLoadExternalResource(ParsedURL resourceURL,
228                                    ParsedURL docURL) throws SecurityException JavaDoc;
229
230 }
231
Popular Tags