Revision 2744
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/desktopopen/DesktopOpen.java | ||
---|---|---|
1 |
package org.gvsig.desktopopen; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URI; |
|
5 |
|
|
6 |
public interface DesktopOpen { |
|
7 |
|
|
8 |
public boolean browse(URI uri); |
|
9 |
|
|
10 |
public boolean edit(File file); |
|
11 |
|
|
12 |
public boolean open(File file); |
|
13 |
|
|
14 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/htmlbuilder/HTMLBuilder.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.htmlbuilder; |
|
3 |
|
|
4 |
import java.awt.Color; |
|
5 |
import java.util.Date; |
|
6 |
import java.util.List; |
|
7 |
import java.util.Map; |
|
8 |
|
|
9 |
/** |
|
10 |
* |
|
11 |
* @author jjdelcerro |
|
12 |
*/ |
|
13 |
public interface HTMLBuilder { |
|
14 |
|
|
15 |
|
|
16 |
public static final String accesskey = "accesskey"; |
|
17 |
public static final String class_ = "class"; |
|
18 |
public static final String contenteditable = "contenteditable"; |
|
19 |
public static final String content = "content"; |
|
20 |
public static final String dir = "dir"; |
|
21 |
public static final String draggable = "draggable"; |
|
22 |
public static final String dropzone = "dropzone"; |
|
23 |
public static final String hidden = "hidden"; |
|
24 |
public static final String id = "id"; |
|
25 |
public static final String lang = "lang"; |
|
26 |
public static final String spellcheck = "spellcheck"; |
|
27 |
public static final String style = "style"; |
|
28 |
public static final String tabindex = "tabindex"; |
|
29 |
public static final String title = "title"; |
|
30 |
public static final String translate = "translate"; |
|
31 |
|
|
32 |
public static final String alt = "alt"; |
|
33 |
public static final String coords = "coords"; |
|
34 |
public static final String download = "download"; |
|
35 |
public static final String href = "href"; |
|
36 |
public static final String hreflang = "hreflang"; |
|
37 |
public static final String media = "media"; |
|
38 |
public static final String nohref = "nohref"; |
|
39 |
public static final String rel = "rel"; |
|
40 |
public static final String shape = "shape"; |
|
41 |
public static final String target = "target"; |
|
42 |
public static final String type = "type"; |
|
43 |
|
|
44 |
public static final String autofocus = "autofocus"; |
|
45 |
public static final String disabled = "disabled"; |
|
46 |
public static final String form = "form"; |
|
47 |
public static final String formaction = "formaction"; |
|
48 |
public static final String formenctype = "formenctype"; |
|
49 |
public static final String formmethod = "formmethod"; |
|
50 |
public static final String formnovalidate = "formnovalidate"; |
|
51 |
public static final String formtarget = "formtarget"; |
|
52 |
public static final String framename = "framename"; |
|
53 |
public static final String name = "name"; |
|
54 |
public static final String value = "value"; |
|
55 |
public static final String height = "height"; |
|
56 |
public static final String width = "width"; |
|
57 |
public static final String align = "align"; |
|
58 |
public static final String open = "open"; |
|
59 |
public static final String size = "size"; |
|
60 |
public static final String color = "color"; |
|
61 |
public static final String face = "face"; |
|
62 |
public static final String noshade = "noshade"; |
|
63 |
public static final String xmlns = "xmlns"; |
|
64 |
public static final String for_ = "for"; |
|
65 |
public static final String charset = "charset"; |
|
66 |
|
|
67 |
public static final String max = "max"; |
|
68 |
public static final String min = "min"; |
|
69 |
public static final String low = "low"; |
|
70 |
public static final String hight = "hight"; |
|
71 |
public static final String optimun = "optimun"; |
|
72 |
|
|
73 |
public static final String compact = "compact"; |
|
74 |
public static final String reversed = "reversed"; |
|
75 |
public static final String start = "start"; |
|
76 |
|
|
77 |
public static final String multiple = "multiple"; |
|
78 |
public static final String required = "required"; |
|
79 |
|
|
80 |
public static final String bgcolor = "bgcolor"; |
|
81 |
public static final String border = "border"; |
|
82 |
public static final String cellpadding = "cellpadding"; |
|
83 |
public static final String cellspacing = "cellspacing"; |
|
84 |
|
|
85 |
public static final String colspan = "colspan"; |
|
86 |
public static final String nowrap = "nowrap"; |
|
87 |
public static final String valign = "valign"; |
|
88 |
|
|
89 |
public static final String cols = "cols"; |
|
90 |
public static final String dirname = "dirname"; |
|
91 |
public static final String maxlength = "maxlength"; |
|
92 |
public static final String placeholder = "placeholder"; |
|
93 |
public static final String readonly = "readonly"; |
|
94 |
public static final String rows = "rows"; |
|
95 |
public static final String wrap = "wrap"; |
|
96 |
|
|
97 |
public static final String datetime = "datetime"; |
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
public static final String target_blank = "_blank"; |
|
105 |
public static final String target_self = "_self"; |
|
106 |
public static final String target_parent = "_parent"; |
|
107 |
public static final String target_top = "_top"; |
|
108 |
|
|
109 |
public static final String method_get = "get"; |
|
110 |
public static final String method_post = "post"; |
|
111 |
|
|
112 |
public static final String type_button = "button"; |
|
113 |
public static final String type_reset = "reset"; |
|
114 |
public static final String type_submit = "submit"; |
|
115 |
|
|
116 |
public static final String valign_top = "top"; |
|
117 |
public static final String valign_middle = "middle"; |
|
118 |
public static final String valign_bottom = "bottom"; |
|
119 |
public static final String valign_baseline = "baseline"; |
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
public interface HTMLElement { |
|
124 |
public boolean allowContents(); |
|
125 |
|
|
126 |
public boolean allowAttributes(); |
|
127 |
|
|
128 |
public String toHTML(); |
|
129 |
} |
|
130 |
|
|
131 |
public interface HTMLElementWithAttributes extends HTMLElement { |
|
132 |
public Map<String,String> getAttributes(); |
|
133 |
|
|
134 |
public Map<String,String> getStyle(); |
|
135 |
|
|
136 |
public HTMLElementWithAttributes set(String name, String value); |
|
137 |
|
|
138 |
public HTMLElementWithAttributes set(String name, int value); |
|
139 |
|
|
140 |
public HTMLElementWithAttributes set(String name, double value); |
|
141 |
|
|
142 |
public HTMLElementWithAttributes set(String name, HTMLColor color); |
|
143 |
|
|
144 |
public HTMLElementWithAttributes set(String name); |
|
145 |
|
|
146 |
public HTMLElementWithAttributes style(String name, String value); |
|
147 |
|
|
148 |
public HTMLElementWithAttributes style(String name, int value); |
|
149 |
|
|
150 |
public HTMLElementWithAttributes style(String name, double value); |
|
151 |
|
|
152 |
public HTMLElementWithAttributes style(String name, HTMLColor color); |
|
153 |
|
|
154 |
} |
|
155 |
|
|
156 |
public interface HTMLElementWithContents extends HTMLElement { |
|
157 |
|
|
158 |
public HTMLElementWithContents contents(Object... values); |
|
159 |
|
|
160 |
public List<HTMLElement> getContents(); |
|
161 |
} |
|
162 |
|
|
163 |
public interface HTMLComplexElement |
|
164 |
extends HTMLElementWithContents, HTMLElementWithAttributes |
|
165 |
{ |
|
166 |
@Override |
|
167 |
public HTMLComplexElement contents(Object... values); |
|
168 |
|
|
169 |
@Override |
|
170 |
public HTMLComplexElement set(String name, String value); |
|
171 |
|
|
172 |
@Override |
|
173 |
public HTMLComplexElement set(String name, int value); |
|
174 |
|
|
175 |
@Override |
|
176 |
public HTMLComplexElement set(String name, double value); |
|
177 |
|
|
178 |
@Override |
|
179 |
public HTMLComplexElement set(String name, HTMLColor color); |
|
180 |
|
|
181 |
@Override |
|
182 |
public HTMLComplexElement set(String name); |
|
183 |
|
|
184 |
@Override |
|
185 |
public HTMLComplexElement style(String name, String value); |
|
186 |
|
|
187 |
@Override |
|
188 |
public HTMLComplexElement style(String name, int value); |
|
189 |
|
|
190 |
@Override |
|
191 |
public HTMLComplexElement style(String name, double value); |
|
192 |
|
|
193 |
@Override |
|
194 |
public HTMLComplexElement style(String name, HTMLColor color); |
|
195 |
|
|
196 |
} |
|
197 |
|
|
198 |
public interface HTMLColor extends HTMLElement { |
|
199 |
|
|
200 |
} |
|
201 |
|
|
202 |
HTMLColor color(Color color); |
|
203 |
|
|
204 |
HTMLColor color(String color); |
|
205 |
|
|
206 |
HTMLColor color(int r, int g, int b); |
|
207 |
|
|
208 |
HTMLElement contents(HTMLElement... values); |
|
209 |
|
|
210 |
HTMLElement custom(String value); |
|
211 |
|
|
212 |
HTMLElement plain(String value); |
|
213 |
|
|
214 |
HTMLElement plainWithNl(String value); |
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
HTMLComplexElement a(Object... contents); |
|
220 |
|
|
221 |
HTMLComplexElement a(String link, Object... contents); |
|
222 |
|
|
223 |
HTMLComplexElement abbr(Object... contents); |
|
224 |
|
|
225 |
HTMLComplexElement acronym(Object... contents); |
|
226 |
|
|
227 |
HTMLComplexElement address(Object... contents); |
|
228 |
|
|
229 |
HTMLComplexElement area(Object... contents); |
|
230 |
|
|
231 |
HTMLComplexElement article(Object... contents); |
|
232 |
|
|
233 |
HTMLComplexElement aside(Object... contents); |
|
234 |
|
|
235 |
HTMLComplexElement b(Object... contents); |
|
236 |
|
|
237 |
HTMLElementWithAttributes base(); |
|
238 |
|
|
239 |
HTMLElementWithAttributes basefont(); |
|
240 |
|
|
241 |
HTMLComplexElement bdi(Object... contents); |
|
242 |
|
|
243 |
HTMLComplexElement bdo(Object... contents); |
|
244 |
|
|
245 |
HTMLElementWithContents big(Object... contents); |
|
246 |
|
|
247 |
HTMLComplexElement blockquote(Object... contents); |
|
248 |
|
|
249 |
HTMLComplexElement body(Object... contents); |
|
250 |
|
|
251 |
HTMLElement br(); |
|
252 |
|
|
253 |
HTMLComplexElement button(Object... contents); |
|
254 |
|
|
255 |
HTMLComplexElement canvas(Object... contents); |
|
256 |
|
|
257 |
HTMLComplexElement caption(Object... contents); |
|
258 |
|
|
259 |
HTMLElementWithContents center(Object... contents); |
|
260 |
|
|
261 |
HTMLComplexElement cite(Object... contents); |
|
262 |
|
|
263 |
HTMLComplexElement code(Object... contents); |
|
264 |
|
|
265 |
HTMLElementWithAttributes col(); |
|
266 |
|
|
267 |
HTMLComplexElement colgroup(Object... contents); |
|
268 |
|
|
269 |
HTMLComplexElement data(Object... contents); |
|
270 |
|
|
271 |
HTMLComplexElement datalist(Object... contents); |
|
272 |
|
|
273 |
HTMLComplexElement dd(Object... contents); |
|
274 |
|
|
275 |
HTMLComplexElement del(Object... contents); |
|
276 |
|
|
277 |
HTMLComplexElement details(Object... contents); |
|
278 |
|
|
279 |
HTMLComplexElement dfn(Object... contents); |
|
280 |
|
|
281 |
HTMLComplexElement dialog(Object... contents); |
|
282 |
|
|
283 |
HTMLElementWithContents dir(Object... contents); |
|
284 |
|
|
285 |
HTMLComplexElement div(Object... contents); |
|
286 |
|
|
287 |
HTMLComplexElement dl(Object... contents); |
|
288 |
|
|
289 |
HTMLComplexElement dt(Object... contents); |
|
290 |
|
|
291 |
HTMLComplexElement em(Object... contents); |
|
292 |
|
|
293 |
HTMLElementWithAttributes embed(); |
|
294 |
|
|
295 |
HTMLComplexElement fieldset(Object... contents); |
|
296 |
|
|
297 |
HTMLComplexElement figcaption(Object... contents); |
|
298 |
|
|
299 |
HTMLComplexElement figure(Object... contents); |
|
300 |
|
|
301 |
HTMLComplexElement font(Object... contents); |
|
302 |
|
|
303 |
HTMLComplexElement font(int size, HTMLColor color); |
|
304 |
|
|
305 |
HTMLComplexElement font(int size, HTMLColor color, String face, Object... contents); |
|
306 |
|
|
307 |
HTMLComplexElement footer(Object... contents); |
|
308 |
|
|
309 |
HTMLComplexElement form(Object... contents); |
|
310 |
|
|
311 |
HTMLComplexElement frame(Object... contents); |
|
312 |
|
|
313 |
HTMLComplexElement frameset(Object... contents); |
|
314 |
|
|
315 |
HTMLComplexElement h1(Object... contents); |
|
316 |
|
|
317 |
HTMLComplexElement h2(Object... contents); |
|
318 |
|
|
319 |
HTMLComplexElement h3(Object... contents); |
|
320 |
|
|
321 |
HTMLComplexElement h4(Object... contents); |
|
322 |
|
|
323 |
HTMLComplexElement h5(Object... contents); |
|
324 |
|
|
325 |
HTMLComplexElement h6(Object... contents); |
|
326 |
|
|
327 |
HTMLComplexElement head(Object... contents); |
|
328 |
|
|
329 |
HTMLComplexElement header(Object... contents); |
|
330 |
|
|
331 |
HTMLComplexElement hr(Object... contents); |
|
332 |
|
|
333 |
HTMLComplexElement html(Object... contents); |
|
334 |
|
|
335 |
HTMLComplexElement i(Object... contents); |
|
336 |
|
|
337 |
HTMLComplexElement iframe(Object... contents); |
|
338 |
|
|
339 |
HTMLElementWithAttributes img(); |
|
340 |
|
|
341 |
HTMLElementWithAttributes input(Object... contents); |
|
342 |
|
|
343 |
HTMLComplexElement ins(Object... contents); |
|
344 |
|
|
345 |
HTMLComplexElement kbd(Object... contents); |
|
346 |
|
|
347 |
HTMLComplexElement label(Object... contents); |
|
348 |
|
|
349 |
HTMLComplexElement legend(Object... contents); |
|
350 |
|
|
351 |
HTMLComplexElement li(Object... contents); |
|
352 |
|
|
353 |
HTMLElementWithAttributes link(); |
|
354 |
|
|
355 |
HTMLElementWithAttributes link(String rel, String type, String href); |
|
356 |
|
|
357 |
HTMLComplexElement main(Object... contents); |
|
358 |
|
|
359 |
HTMLComplexElement map(Object... contents); |
|
360 |
|
|
361 |
HTMLComplexElement mark(Object... contents); |
|
362 |
|
|
363 |
HTMLElementWithAttributes meta(); |
|
364 |
|
|
365 |
HTMLElementWithAttributes meta(String charset); |
|
366 |
|
|
367 |
HTMLElementWithAttributes meta(String name, String content); |
|
368 |
|
|
369 |
HTMLComplexElement meter(Object... contents); |
|
370 |
|
|
371 |
HTMLComplexElement nav(Object... contents); |
|
372 |
|
|
373 |
HTMLElementWithContents noframes(Object... contents); |
|
374 |
|
|
375 |
HTMLElementWithContents noscript(Object... contents); |
|
376 |
|
|
377 |
HTMLComplexElement object(Object... contents); |
|
378 |
|
|
379 |
HTMLComplexElement ol(Object... contents); |
|
380 |
|
|
381 |
HTMLComplexElement optgroup(Object... contents); |
|
382 |
|
|
383 |
HTMLComplexElement option(Object... contents); |
|
384 |
|
|
385 |
HTMLComplexElement output(Object... contents); |
|
386 |
|
|
387 |
HTMLComplexElement p(Object... contents); |
|
388 |
|
|
389 |
HTMLElementWithAttributes param(); |
|
390 |
|
|
391 |
HTMLComplexElement pre(Object... contents); |
|
392 |
|
|
393 |
HTMLComplexElement progress(Object... contents); |
|
394 |
|
|
395 |
HTMLComplexElement q(Object... contents); |
|
396 |
|
|
397 |
HTMLComplexElement rp(Object... contents); |
|
398 |
|
|
399 |
HTMLComplexElement rt(Object... contents); |
|
400 |
|
|
401 |
HTMLComplexElement ruby(Object... contents); |
|
402 |
|
|
403 |
HTMLComplexElement s(Object... contents); |
|
404 |
|
|
405 |
HTMLComplexElement samp(Object... contents); |
|
406 |
|
|
407 |
HTMLComplexElement script(Object... contents); |
|
408 |
|
|
409 |
HTMLComplexElement section(Object... contents); |
|
410 |
|
|
411 |
HTMLComplexElement select(Object... contents); |
|
412 |
|
|
413 |
HTMLComplexElement small(Object... contents); |
|
414 |
|
|
415 |
HTMLComplexElement source(Object... contents); |
|
416 |
|
|
417 |
HTMLComplexElement span(Object... contents); |
|
418 |
|
|
419 |
HTMLElementWithContents strike(Object... contents); |
|
420 |
|
|
421 |
HTMLComplexElement strong(Object... contents); |
|
422 |
|
|
423 |
HTMLComplexElement style(Object... contents); |
|
424 |
|
|
425 |
HTMLComplexElement sub(Object... contents); |
|
426 |
|
|
427 |
HTMLComplexElement summary(Object... contents); |
|
428 |
|
|
429 |
HTMLComplexElement sup(Object... contents); |
|
430 |
|
|
431 |
HTMLComplexElement svg(Object... contents); |
|
432 |
|
|
433 |
HTMLComplexElement table(Object... contents); |
|
434 |
|
|
435 |
HTMLComplexElement table(int border, int cellpadding, int cellspacing); |
|
436 |
|
|
437 |
HTMLComplexElement table(int border, int cellpadding, int cellspacing, int widthpercent); |
|
438 |
|
|
439 |
HTMLComplexElement tbody(Object... contents); |
|
440 |
|
|
441 |
HTMLComplexElement td(Object... contents); |
|
442 |
|
|
443 |
HTMLComplexElement td(boolean wrap, int colspan); |
|
444 |
|
|
445 |
HTMLComplexElement td(boolean wrap, int colspan, String valign); |
|
446 |
|
|
447 |
HTMLComplexElement template(Object... contents); |
|
448 |
|
|
449 |
HTMLComplexElement textarea(Object... contents); |
|
450 |
|
|
451 |
HTMLComplexElement textarea(int rows, int cols); |
|
452 |
|
|
453 |
HTMLComplexElement textarea(int rows, int cols, int maxlength); |
|
454 |
|
|
455 |
HTMLComplexElement tfoot(Object... contents); |
|
456 |
|
|
457 |
HTMLComplexElement th(Object... contents); |
|
458 |
|
|
459 |
HTMLComplexElement thead(Object... contents); |
|
460 |
|
|
461 |
HTMLComplexElement time(Object... contents); |
|
462 |
|
|
463 |
HTMLComplexElement time(Date datetime); |
|
464 |
|
|
465 |
HTMLComplexElement time(String datetime); |
|
466 |
|
|
467 |
HTMLComplexElement title(Object... contents); |
|
468 |
|
|
469 |
HTMLComplexElement tr(Object... contents); |
|
470 |
|
|
471 |
HTMLComplexElement tr(HTMLColor color); |
|
472 |
|
|
473 |
HTMLComplexElement tr(String valign); |
|
474 |
|
|
475 |
HTMLComplexElement tr(String valign, HTMLColor color); |
|
476 |
|
|
477 |
HTMLComplexElement track(Object... contents); |
|
478 |
|
|
479 |
HTMLElementWithContents tt(Object... contents); |
|
480 |
|
|
481 |
HTMLComplexElement u(Object... contents); |
|
482 |
|
|
483 |
HTMLComplexElement ul(Object... contents); |
|
484 |
|
|
485 |
HTMLComplexElement var(Object... contents); |
|
486 |
|
|
487 |
HTMLComplexElement video(Object... contents); |
|
488 |
|
|
489 |
HTMLComplexElement wbr(Object... contents); |
|
490 |
|
|
491 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/texteditor/JTextEditor.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.texteditor; |
|
25 |
|
|
26 |
import java.awt.event.ActionListener; |
|
27 |
import javax.swing.text.JTextComponent; |
|
28 |
import org.gvsig.tools.swing.api.ChangeListenerSupport; |
|
29 |
import org.gvsig.tools.swing.api.Component; |
|
30 |
|
|
31 |
/** |
|
32 |
* @author gvSIG Team |
|
33 |
* |
|
34 |
*/ |
|
35 |
public interface JTextEditor extends Component, ChangeListenerSupport { |
|
36 |
|
|
37 |
public interface UpdateCaretPositionActionEvent { |
|
38 |
|
|
39 |
public int getLine(); |
|
40 |
|
|
41 |
public int getColumn(); |
|
42 |
|
|
43 |
public boolean hasLineAndColumn(); |
|
44 |
} |
|
45 |
|
|
46 |
public void setMimetype(String mimeType); |
|
47 |
|
|
48 |
public String getMimetype(); |
|
49 |
|
|
50 |
public void setText(String text); |
|
51 |
|
|
52 |
public String getText(); |
|
53 |
|
|
54 |
public JTextComponent getJTextComponent(); |
|
55 |
|
|
56 |
public void selectLine(int line); |
|
57 |
|
|
58 |
public void gotoline(int line); |
|
59 |
|
|
60 |
public int getLineCount(); |
|
61 |
|
|
62 |
public void clean(); |
|
63 |
|
|
64 |
public void addUpdateCaretPositionActionListener(ActionListener actionlistener); |
|
65 |
|
|
66 |
public boolean isModified(); |
|
67 |
|
|
68 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/texteditor/TextEditorManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.texteditor; |
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* @author gvSIG Team |
|
31 |
* |
|
32 |
*/ |
|
33 |
|
|
34 |
public interface TextEditorManager { |
|
35 |
|
|
36 |
public JTextEditor createTextEditor(); |
|
37 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/svgsupport/SVGRenderer.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or modify it under |
|
7 |
* the terms of the GNU General Public License as published by the Free Software |
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
9 |
* version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
14 |
* details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us at info AT |
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.svgsupport; |
|
24 |
|
|
25 |
import java.awt.Graphics2D; |
|
26 |
import java.awt.geom.Rectangle2D; |
|
27 |
import java.io.File; |
|
28 |
import java.io.IOException; |
|
29 |
import java.net.URL; |
|
30 |
|
|
31 |
public interface SVGRenderer { |
|
32 |
|
|
33 |
public Rectangle2D getBounds(); |
|
34 |
|
|
35 |
public void drawInsideRectangle( |
|
36 |
Graphics2D g, |
|
37 |
Rectangle2D rect, |
|
38 |
boolean keepAspectRatio |
|
39 |
); |
|
40 |
|
|
41 |
public void setSource(URL url) throws IOException; |
|
42 |
public void setSource(File f) throws IOException; |
|
43 |
|
|
44 |
|
|
45 |
public URL getSource(); |
|
46 |
|
|
47 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/svgsupport/SVGSupportManager.java | ||
---|---|---|
1 |
package org.gvsig.svgsupport; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
import java.net.URL; |
|
6 |
|
|
7 |
public interface SVGSupportManager { |
|
8 |
|
|
9 |
public SVGRenderer createRenderer(); |
|
10 |
public SVGRenderer createRenderer(URL source) throws IOException ; |
|
11 |
public SVGRenderer createRenderer(File source) throws IOException ; |
|
12 |
|
|
13 |
|
|
14 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/SimpleServer.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver; |
|
3 |
|
|
4 |
import java.net.URL; |
|
5 |
import java.util.Map; |
|
6 |
import org.gvsig.simplehttpserver.commands.Command; |
|
7 |
|
|
8 |
|
|
9 |
public interface SimpleServer { |
|
10 |
|
|
11 |
public static int INFO = 0; |
|
12 |
public static int WARN = 1; |
|
13 |
public static int DEBUG = 2; |
|
14 |
|
|
15 |
public interface LoggerListener { |
|
16 |
public void log(int level, String message); |
|
17 |
} |
|
18 |
|
|
19 |
public SimpleServerConfig getConfig(); |
|
20 |
|
|
21 |
public void start(); |
|
22 |
|
|
23 |
public void stop(); |
|
24 |
|
|
25 |
public void reload(); |
|
26 |
|
|
27 |
public boolean isStarted(); |
|
28 |
|
|
29 |
public void addLogListener(LoggerListener logger); |
|
30 |
|
|
31 |
public void removeLogListener(LoggerListener logger); |
|
32 |
|
|
33 |
public URL getURL(String path); |
|
34 |
|
|
35 |
public String getHost(); |
|
36 |
|
|
37 |
public void log(int level, String message); |
|
38 |
|
|
39 |
public Map<String, Command> getCommands(); |
|
40 |
|
|
41 |
public Command getCommand(String arg); |
|
42 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/CommandFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver.commands; |
|
3 |
|
|
4 |
import org.apache.commons.lang3.Range; |
|
5 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
6 |
|
|
7 |
/** |
|
8 |
* |
|
9 |
* @author jjdelcerro |
|
10 |
*/ |
|
11 |
public interface CommandFactory { |
|
12 |
|
|
13 |
String getMimeType(); |
|
14 |
|
|
15 |
String getName(); |
|
16 |
|
|
17 |
Range getNumArgs(); |
|
18 |
|
|
19 |
String getDescription(); |
|
20 |
|
|
21 |
public Command create(SimpleServer server); |
|
22 |
|
|
23 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/Help.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver.commands; |
|
3 |
|
|
4 |
import java.io.InputStream; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Map; |
|
7 |
import javax.json.Json; |
|
8 |
import javax.json.JsonArrayBuilder; |
|
9 |
import javax.json.JsonObject; |
|
10 |
import javax.json.JsonObjectBuilder; |
|
11 |
import org.apache.commons.lang3.StringUtils; |
|
12 |
import org.gvsig.htmlbuilder.HTMLBuilder; |
|
13 |
import org.gvsig.htmlbuilder.HTMLBuilder.HTMLComplexElement; |
|
14 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
15 |
import org.gvsig.tools.util.ToolsUtilLocator; |
|
16 |
|
|
17 |
/** |
|
18 |
* |
|
19 |
* @author gvSIG Team |
|
20 |
*/ |
|
21 |
public class Help extends AbstractCommand { |
|
22 |
|
|
23 |
public Help(CommandFactory factory, SimpleServer server) { |
|
24 |
super(factory,server); |
|
25 |
} |
|
26 |
|
|
27 |
|
|
28 |
@Override |
|
29 |
public Object call(int argc, List<String> args, InputStream contents) { |
|
30 |
Map<String, Command> commands = this.getServer().getCommands(); |
|
31 |
if( argc>0 && StringUtils.equalsIgnoreCase("asjson", args.get(1)) ) { |
|
32 |
JsonArrayBuilder builder = Json.createArrayBuilder(); |
|
33 |
for (Command command : commands.values()) { |
|
34 |
builder.add(this.getCommandDescription(command)); |
|
35 |
} |
|
36 |
return builder.toString(); |
|
37 |
} else { |
|
38 |
HTMLBuilder builder = ToolsUtilLocator.getToolsUtilManager().createHTMLBuilder(); |
|
39 |
HTMLComplexElement table = builder.table( |
|
40 |
0,1,4, |
|
41 |
builder.thead( |
|
42 |
builder.tr( |
|
43 |
builder.th("Return type"), |
|
44 |
builder.th("Name"), |
|
45 |
builder.th("Description") |
|
46 |
) |
|
47 |
) |
|
48 |
); |
|
49 |
|
|
50 |
for (Command command : commands.values()) { |
|
51 |
HTMLComplexElement tr = builder.tr(HTMLBuilder.valign_top).contents( |
|
52 |
builder.td(command.getMimeType()), |
|
53 |
builder.td(command.getName()), |
|
54 |
builder.td( |
|
55 |
builder.plainWithNl(command.getDescription()+"\n\n") |
|
56 |
) |
|
57 |
); |
|
58 |
table.contents(tr); |
|
59 |
} |
|
60 |
return table.toHTML(); |
|
61 |
} |
|
62 |
} |
|
63 |
|
|
64 |
public JsonObject getCommandDescription(Command command) { |
|
65 |
JsonObjectBuilder builder = Json.createObjectBuilder(); |
|
66 |
builder.add("Name", command.getName()); |
|
67 |
builder.add("NumArgs", command.getNumArgs().toString()); |
|
68 |
builder.add("MimeType", StringUtils.defaultString(command.getMimeType())); |
|
69 |
builder.add("Description", StringUtils.defaultString(command.getDescription())); |
|
70 |
return builder.build(); |
|
71 |
} |
|
72 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/AbstractCommandFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver.commands; |
|
3 |
|
|
4 |
import org.apache.commons.lang3.Range; |
|
5 |
|
|
6 |
/** |
|
7 |
* |
|
8 |
* @author jjdelcerro |
|
9 |
*/ |
|
10 |
public abstract class AbstractCommandFactory implements CommandFactory { |
|
11 |
|
|
12 |
private final String name; |
|
13 |
private final Range nargs; |
|
14 |
private final String mimetype; |
|
15 |
private final String description; |
|
16 |
|
|
17 |
protected AbstractCommandFactory(String name, Range nargs, String mimetype, String description) { |
|
18 |
this.name = name; |
|
19 |
this.nargs = nargs; |
|
20 |
this.mimetype = mimetype; |
|
21 |
this.description = description; |
|
22 |
} |
|
23 |
|
|
24 |
@Override |
|
25 |
public String getDescription() { |
|
26 |
return this.description; |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
public String getName() { |
|
31 |
return this.name; |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public Range getNumArgs() { |
|
36 |
return this.nargs; |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public String getMimeType() { |
|
41 |
return this.mimetype; |
|
42 |
} |
|
43 |
|
|
44 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/Command.java | ||
---|---|---|
1 |
package org.gvsig.simplehttpserver.commands; |
|
2 |
|
|
3 |
import java.io.InputStream; |
|
4 |
import java.util.List; |
|
5 |
import org.apache.commons.lang3.Range; |
|
6 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
7 |
|
|
8 |
|
|
9 |
/** |
|
10 |
* |
|
11 |
* @author jjdelcerro |
|
12 |
*/ |
|
13 |
public interface Command { |
|
14 |
|
|
15 |
Object call(int argc, List<String> args, InputStream contents) throws Exception; |
|
16 |
|
|
17 |
String getMimeType(); |
|
18 |
|
|
19 |
String getName(); |
|
20 |
|
|
21 |
Range getNumArgs(); |
|
22 |
|
|
23 |
String getDescription(); |
|
24 |
|
|
25 |
SimpleServer getServer(); |
|
26 |
|
|
27 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/HelpFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver.commands; |
|
3 |
|
|
4 |
import org.apache.commons.lang3.Range; |
|
5 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
6 |
|
|
7 |
/** |
|
8 |
* |
|
9 |
* @author gvSIG Team |
|
10 |
*/ |
|
11 |
public class HelpFactory extends AbstractCommandFactory { |
|
12 |
|
|
13 |
public HelpFactory() { |
|
14 |
super( |
|
15 |
"help", |
|
16 |
Range.between(0,1), |
|
17 |
"text/html", |
|
18 |
"help\n\n" + |
|
19 |
"Retrieve a short help of supported commands.\n" + |
|
20 |
"Use help/asjson to retrieve this help as json." |
|
21 |
); |
|
22 |
} |
|
23 |
|
|
24 |
@Override |
|
25 |
public Command create(SimpleServer server) { |
|
26 |
return new Help(this, server); |
|
27 |
} |
|
28 |
|
|
29 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/AbstractCommand.java | ||
---|---|---|
1 |
package org.gvsig.simplehttpserver.commands; |
|
2 |
|
|
3 |
import org.apache.commons.lang3.Range; |
|
4 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
5 |
import org.gvsig.simplehttpserver.SimpleServerConfig; |
|
6 |
import org.slf4j.Logger; |
|
7 |
import org.slf4j.LoggerFactory; |
|
8 |
|
|
9 |
/** |
|
10 |
* |
|
11 |
* @author gvSIG Team |
|
12 |
*/ |
|
13 |
public abstract class AbstractCommand implements Command { |
|
14 |
|
|
15 |
protected static final Logger LOG = LoggerFactory.getLogger(AbstractCommand.class); |
|
16 |
|
|
17 |
private final SimpleServer server; |
|
18 |
private final CommandFactory factory; |
|
19 |
|
|
20 |
public AbstractCommand(CommandFactory factory, SimpleServer server) { |
|
21 |
this.server = server; |
|
22 |
this.factory = factory; |
|
23 |
} |
|
24 |
|
|
25 |
protected SimpleServerConfig getConfig() { |
|
26 |
return this.server.getConfig(); |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
public SimpleServer getServer() { |
|
31 |
return this.server; |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public String getDescription() { |
|
36 |
return this.factory.getDescription().replace("${host}", this.server.getHost()); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public String getName() { |
|
41 |
return this.factory.getName(); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public Range getNumArgs() { |
|
46 |
return this.factory.getNumArgs(); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public String getMimeType() { |
|
51 |
return this.factory.getMimeType(); |
|
52 |
} |
|
53 |
|
|
54 |
|
|
55 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/SimpleServerConfig.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver; |
|
3 |
|
|
4 |
import java.beans.PropertyChangeListener; |
|
5 |
import java.net.URL; |
|
6 |
import java.util.Collection; |
|
7 |
import org.gvsig.simplehttpserver.commands.CommandFactory; |
|
8 |
import org.gvsig.tools.util.PropertiesSupport; |
|
9 |
|
|
10 |
/** |
|
11 |
* |
|
12 |
* @author gvSIG Team |
|
13 |
*/ |
|
14 |
public interface SimpleServerConfig extends PropertiesSupport { |
|
15 |
|
|
16 |
public int getPort(); |
|
17 |
|
|
18 |
public int getTimeout(); |
|
19 |
|
|
20 |
public String getServerInfo(); |
|
21 |
|
|
22 |
public SimpleServerConfig setPort(int port); |
|
23 |
|
|
24 |
public SimpleServerConfig setTimeout(int timeout); |
|
25 |
|
|
26 |
public SimpleServerConfig setServerInfo(String serverInfo); |
|
27 |
|
|
28 |
public SimpleServerConfig addCommandFactory(CommandFactory factory); |
|
29 |
|
|
30 |
public void removeCommandFactory(String name); |
|
31 |
|
|
32 |
public void removeCommandFactory(CommandFactory factory); |
|
33 |
|
|
34 |
public Collection<CommandFactory> getCommandFactories(); |
|
35 |
|
|
36 |
public void addPropertyChangeListener(PropertyChangeListener listener); |
|
37 |
|
|
38 |
public void removePropertyChangeListener(PropertyChangeListener listener); |
|
39 |
|
|
40 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/SimpleServerManager.java | ||
---|---|---|
1 |
package org.gvsig.simplehttpserver; |
|
2 |
|
|
3 |
/** |
|
4 |
* |
|
5 |
* @author gvSIG Team |
|
6 |
*/ |
|
7 |
public interface SimpleServerManager { |
|
8 |
|
|
9 |
public SimpleServerConfig createSimpleServerConfig(); |
|
10 |
|
|
11 |
public SimpleServer createSimpleServer(SimpleServerConfig config); |
|
12 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/tools/util/ToolsUtilLocator.java | ||
---|---|---|
1 |
package org.gvsig.tools.util; |
|
2 |
|
|
3 |
/** |
|
4 |
* gvSIG. Desktop Geographic Information System. |
|
5 |
* |
|
6 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or modify it under |
|
9 |
* the terms of the GNU General Public License as published by the Free Software |
|
10 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
11 |
* version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
14 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
15 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
16 |
* details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License along with |
|
19 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
20 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us at info AT |
|
23 |
* gvsig.com, or visit our website www.gvsig.com. |
|
24 |
*/ |
|
25 |
|
|
26 |
import org.gvsig.configurableactions.ConfigurableActionsMamager; |
|
27 |
import org.gvsig.euclidean.EuclideanManager; |
|
28 |
import org.gvsig.filedialogchooser.FileDialogChooserManager; |
|
29 |
import org.gvsig.imageviewer.ImageViewerManager; |
|
30 |
import org.gvsig.propertypage.PropertiesPageManager; |
|
31 |
import org.gvsig.svgsupport.SVGSupportManager; |
|
32 |
import org.gvsig.texteditor.TextEditorManager; |
|
33 |
import org.gvsig.tools.locator.AbstractLocator; |
|
34 |
import org.gvsig.tools.locator.Locator; |
|
35 |
import org.gvsig.tools.locator.LocatorException; |
|
36 |
import org.gvsig.webbrowser2.WebBrowserManager; |
|
37 |
import org.gvsig.json.JsonManager; |
|
38 |
import org.gvsig.simplehttpserver.SimpleServerManager; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author gvSIG Team |
|
42 |
* |
|
43 |
*/ |
|
44 |
@SuppressWarnings("rawtypes") |
|
45 |
public class ToolsUtilLocator extends AbstractLocator { |
|
46 |
|
|
47 |
private static final String LOCATOR_NAME = "ToolsUtilLocator"; |
|
48 |
|
|
49 |
public static final String TOOLS_UTIL_MANAGER_NAME = "org.gvsig.tools.util.manager"; |
|
50 |
private static final String TOOLS_UTIL_MANAGER_DESCRIPTION = "Tools utilities."; |
|
51 |
|
|
52 |
public static final String PROPERTIES_PAGE_MANAGER_NAME = "org.gvsig.tools.properties.page.manager"; |
|
53 |
private static final String PROPERTIES_PAGE_MANAGER_DESCRIPTION = "Properties page manager"; |
|
54 |
|
|
55 |
public static final String FILE_DIALOG_CHOOSER_MANAGER_NAME = "org.gvsig.filedialogchooser.manager"; |
|
56 |
private static final String FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION = "File dialog chooser."; |
|
57 |
|
|
58 |
public static final String PLUGINS_SVGSUPPORT_MANAGER_NAME = "SVGSupportManager"; |
|
59 |
private static final String PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION = "SVGSupportManager"; |
|
60 |
|
|
61 |
public static final String PLUGINS_IMAGEVIEWER_MANAGER_NAME = "ImageViewerManager"; |
|
62 |
private static final String PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION = "ImageViewerManager"; |
|
63 |
|
|
64 |
public static final String CONFIGURABLE_ACTIONS_MANAGER_NAME = "ConfigurableActionsMamager"; |
|
65 |
private static final String CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION = "ConfigurableActionsMamager"; |
|
66 |
|
|
67 |
public static final String TEXTEDITOR_MANAGER_NAME = "TextEditorMamager"; |
|
68 |
private static final String TEXTEDITOR_MANAGER_DESCRIPTION = "TextEditorMamager"; |
|
69 |
|
|
70 |
public static final String WEBBROWSER_MANAGER_NAME = "WebBrowserMamager"; |
|
71 |
private static final String WEBBROWSER_MANAGER_DESCRIPTION = "WebBrowserMamager"; |
|
72 |
|
|
73 |
public static final String EUCLIDEAN_MANAGER_NAME = "EuclideanManager"; |
|
74 |
private static final String EUCLIDEAN_MANAGER_DESCRIPTION = "EuclideanManager"; |
|
75 |
|
|
76 |
public static final String JSON_MANAGER_NAME = "org.gvsig.json.manager"; |
|
77 |
private static final String JSON_MANAGER_DESCRIPTION = "Json tools."; |
|
78 |
|
|
79 |
public static final String SIMPLEHTTPSERVER_MANAGER_NAME = "org.gvsig.simplehttpserver"; |
|
80 |
private static final String SIMPLEHTTPSERVER_MANAGER_DESCRIPTION = "Simple http server"; |
|
81 |
|
|
82 |
private static final ToolsUtilLocator INSTANCE = new ToolsUtilLocator(); |
|
83 |
|
|
84 |
private ToolsUtilLocator() { |
|
85 |
|
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Return the singleton instance. |
|
90 |
* |
|
91 |
* @return the singleton instance |
|
92 |
*/ |
|
93 |
public static ToolsUtilLocator getInstance() { |
|
94 |
return INSTANCE; |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
public String getLocatorName() { |
|
99 |
return LOCATOR_NAME; |
|
100 |
} |
|
101 |
|
|
102 |
/** |
|
103 |
* Return a reference to ToolsUtilManager. |
|
104 |
* |
|
105 |
* @return a reference to ToolsUtilManager |
|
106 |
* @throws LocatorException if there is no access to the class or the class |
|
107 |
* cannot be instantiated |
|
108 |
* @see Locator#get(String) |
|
109 |
*/ |
|
110 |
public static ToolsUtilManager getToolsUtilManager() |
|
111 |
throws LocatorException { |
|
112 |
return (ToolsUtilManager) getInstance().get(TOOLS_UTIL_MANAGER_NAME); |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* Registers the Class implementing the ToolsUtilManager interface. |
|
117 |
* |
|
118 |
* @param clazz implementing the ToolsUtilManager interface |
|
119 |
*/ |
|
120 |
public static void registerToolsUtilManager(Class clazz) { |
|
121 |
getInstance().register(TOOLS_UTIL_MANAGER_NAME, |
|
122 |
TOOLS_UTIL_MANAGER_DESCRIPTION, clazz); |
|
123 |
} |
|
124 |
|
|
125 |
public static void registerDefaultToolsUtilManager(Class clazz) { |
|
126 |
getInstance().registerDefault(TOOLS_UTIL_MANAGER_NAME, |
|
127 |
TOOLS_UTIL_MANAGER_DESCRIPTION, clazz); |
|
128 |
} |
|
129 |
|
|
130 |
public static FileDialogChooserManager getFileDialogChooserManager() |
|
131 |
throws LocatorException { |
|
132 |
return (FileDialogChooserManager) getInstance().get(FILE_DIALOG_CHOOSER_MANAGER_NAME); |
|
133 |
} |
|
134 |
|
|
135 |
public static void registerFileDialogChooserManager(Class clazz) { |
|
136 |
getInstance().register(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
|
137 |
FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
|
138 |
} |
|
139 |
|
|
140 |
public static void registerDefaultFileDialogChooserManager(Class clazz) { |
|
141 |
getInstance().registerDefault(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
|
142 |
FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
|
143 |
} |
|
144 |
|
|
145 |
//SVG support |
|
146 |
public static SVGSupportManager getSVGSupportManager() throws LocatorException { |
|
147 |
return (SVGSupportManager) getInstance().get(PLUGINS_SVGSUPPORT_MANAGER_NAME); |
|
148 |
} |
|
149 |
|
|
150 |
public static void registerSVGSupportManager(Class clazz) { |
|
151 |
getInstance().register(PLUGINS_SVGSUPPORT_MANAGER_NAME, PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, |
|
152 |
clazz); |
|
153 |
} |
|
154 |
|
|
155 |
public static void registerDefaultSVGSupportManager(Class clazz) { |
|
156 |
getInstance().registerDefault(PLUGINS_SVGSUPPORT_MANAGER_NAME, |
|
157 |
PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, clazz); |
|
158 |
} |
|
159 |
|
|
160 |
public static ImageViewerManager getImageViewerManager() throws LocatorException { |
|
161 |
return (ImageViewerManager) getInstance().get(PLUGINS_IMAGEVIEWER_MANAGER_NAME); |
|
162 |
} |
|
163 |
|
|
164 |
public static void registerImageViewertManager(Class clazz) { |
|
165 |
getInstance().register(PLUGINS_IMAGEVIEWER_MANAGER_NAME, PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION, |
|
166 |
clazz); |
|
167 |
} |
|
168 |
|
|
169 |
public static void registerDefaultImageViewerManager(Class clazz) { |
|
170 |
getInstance().registerDefault(PLUGINS_IMAGEVIEWER_MANAGER_NAME, |
|
171 |
PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION, clazz); |
|
172 |
} |
|
173 |
|
|
174 |
|
|
175 |
public static ConfigurableActionsMamager getConfigurableActionsMamager() throws LocatorException { |
|
176 |
return (ConfigurableActionsMamager) getInstance().get(CONFIGURABLE_ACTIONS_MANAGER_NAME); |
|
177 |
} |
|
178 |
|
|
179 |
public static void registerConfigurableActionsMamager(Class clazz) { |
|
180 |
getInstance().register(CONFIGURABLE_ACTIONS_MANAGER_NAME, CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION, |
|
181 |
clazz); |
|
182 |
} |
|
183 |
|
|
184 |
public static void registerDefaultConfigurableActionsMamager(Class clazz) { |
|
185 |
getInstance().registerDefault(CONFIGURABLE_ACTIONS_MANAGER_NAME, |
|
186 |
CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION, clazz); |
|
187 |
} |
|
188 |
|
|
189 |
|
|
190 |
public static PropertiesPageManager getPropertiesPageManager() throws LocatorException { |
|
191 |
return (PropertiesPageManager) getInstance().get(PROPERTIES_PAGE_MANAGER_NAME); |
|
192 |
} |
|
193 |
|
|
194 |
public static void registerPropertiesPageManager(Class clazz) { |
|
195 |
getInstance().register(PROPERTIES_PAGE_MANAGER_NAME, |
|
196 |
PROPERTIES_PAGE_MANAGER_DESCRIPTION, |
|
197 |
clazz); |
|
198 |
} |
|
199 |
|
|
200 |
public static void registerDefaultPropertiesPageManager(Class clazz) { |
|
201 |
getInstance().registerDefault( |
|
202 |
PROPERTIES_PAGE_MANAGER_NAME, |
|
203 |
PROPERTIES_PAGE_MANAGER_DESCRIPTION, clazz); |
|
204 |
} |
|
205 |
|
|
206 |
public static TextEditorManager getTextEditorManager() throws LocatorException { |
|
207 |
return (TextEditorManager) getInstance().get(TEXTEDITOR_MANAGER_NAME); |
|
208 |
} |
|
209 |
|
|
210 |
public static void registerTextEditorManager(Class clazz) { |
|
211 |
getInstance().register(TEXTEDITOR_MANAGER_NAME, |
|
212 |
TEXTEDITOR_MANAGER_DESCRIPTION, |
|
213 |
clazz); |
|
214 |
} |
|
215 |
|
|
216 |
public static void registerDefaultTextEditorManager(Class clazz) { |
|
217 |
getInstance().registerDefault( |
|
218 |
TEXTEDITOR_MANAGER_NAME, |
|
219 |
TEXTEDITOR_MANAGER_DESCRIPTION, clazz); |
|
220 |
} |
|
221 |
|
|
222 |
|
|
223 |
public static WebBrowserManager getWebBrowserManager() throws LocatorException { |
|
224 |
return (WebBrowserManager) getInstance().get(WEBBROWSER_MANAGER_NAME); |
|
225 |
} |
|
226 |
|
|
227 |
public static void registerWebBrowserManager(Class clazz) { |
|
228 |
getInstance().register(WEBBROWSER_MANAGER_NAME, |
|
229 |
WEBBROWSER_MANAGER_DESCRIPTION, |
|
230 |
clazz); |
|
231 |
} |
|
232 |
|
|
233 |
public static void registerDefaultWebBrowserManager(Class clazz) { |
|
234 |
getInstance().registerDefault( |
|
235 |
WEBBROWSER_MANAGER_NAME, |
|
236 |
WEBBROWSER_MANAGER_DESCRIPTION, clazz); |
|
237 |
} |
|
238 |
|
|
239 |
public static EuclideanManager getEuclideanManager() throws LocatorException { |
|
240 |
return (EuclideanManager) getInstance().get(EUCLIDEAN_MANAGER_NAME); |
|
241 |
} |
|
242 |
|
|
243 |
public static void registerEuclideanManager(Class clazz) { |
|
244 |
getInstance().register(EUCLIDEAN_MANAGER_NAME, |
|
245 |
EUCLIDEAN_MANAGER_DESCRIPTION, |
|
246 |
clazz); |
|
247 |
} |
|
248 |
|
|
249 |
public static void registerDefaultEuclideanManager(Class clazz) { |
|
250 |
getInstance().registerDefault( |
|
251 |
EUCLIDEAN_MANAGER_NAME, |
|
252 |
EUCLIDEAN_MANAGER_DESCRIPTION, clazz); |
|
253 |
} |
|
254 |
|
|
255 |
public static JsonManager getJsonManager() throws LocatorException { |
|
256 |
return (JsonManager) getInstance().get(JSON_MANAGER_NAME); |
|
257 |
} |
|
258 |
|
|
259 |
public static void registerJsonManager(Class clazz) { |
|
260 |
getInstance().register(JSON_MANAGER_NAME, |
|
261 |
JSON_MANAGER_DESCRIPTION, |
|
262 |
clazz); |
|
263 |
} |
|
264 |
|
|
265 |
public static void registerDefaultJsonManager(Class clazz) { |
|
266 |
getInstance().registerDefault( |
|
267 |
JSON_MANAGER_NAME, |
|
268 |
JSON_MANAGER_DESCRIPTION, clazz); |
|
269 |
} |
|
270 |
|
|
271 |
public static SimpleServerManager getSimpleServerManager() throws LocatorException { |
|
272 |
return (SimpleServerManager) getInstance().get(SIMPLEHTTPSERVER_MANAGER_NAME); |
|
273 |
} |
|
274 |
|
|
275 |
public static void registerSimpleServerManager(Class clazz) { |
|
276 |
getInstance().register(SIMPLEHTTPSERVER_MANAGER_NAME, |
|
277 |
SIMPLEHTTPSERVER_MANAGER_DESCRIPTION, |
|
278 |
clazz); |
|
279 |
} |
|
280 |
|
|
281 |
public static void registerDefaultSimpleServerManager(Class clazz) { |
|
282 |
getInstance().registerDefault( |
|
283 |
SIMPLEHTTPSERVER_MANAGER_NAME, |
|
284 |
SIMPLEHTTPSERVER_MANAGER_DESCRIPTION, clazz); |
|
285 |
} |
|
286 |
|
|
287 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/tools/util/ToolsUtilLibrary.java | ||
---|---|---|
1 |
package org.gvsig.tools.util; |
|
2 |
|
|
3 |
import org.gvsig.tools.ToolsLibrary; |
|
4 |
import org.gvsig.tools.library.AbstractLibrary; |
|
5 |
import org.gvsig.tools.library.LibraryException; |
|
6 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
7 |
|
|
8 |
/** |
|
9 |
* gvSIG. Desktop Geographic Information System. |
|
10 |
* |
|
11 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
12 |
* |
|
13 |
* This program is free software; you can redistribute it and/or |
|
14 |
* modify it under the terms of the GNU General Public License |
|
15 |
* as published by the Free Software Foundation; either version 3 |
|
16 |
* of the License, or (at your option) any later version. |
|
17 |
* |
|
18 |
* This program is distributed in the hope that it will be useful, |
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
* GNU General Public License for more details. |
|
22 |
* |
|
23 |
* You should have received a copy of the GNU General Public License |
|
24 |
* along with this program; if not, write to the Free Software |
|
25 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 |
* MA 02110-1301, USA. |
|
27 |
* |
|
28 |
* For any additional information, do not hesitate to contact us |
|
29 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
30 |
*/ |
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
@SuppressWarnings("unchecked") |
|
35 |
public class ToolsUtilLibrary extends AbstractLibrary { |
|
36 |
|
|
37 |
public void doRegistration() { |
|
38 |
super.doRegistration(); |
|
39 |
registerAsAPI(ToolsUtilLibrary.class); |
|
40 |
this.require(ToolsLibrary.class); |
|
41 |
} |
|
42 |
|
|
43 |
protected void doInitialize() throws LibraryException { |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
protected void doPostInitialize() throws LibraryException { |
|
48 |
// Validate there is any implementation registered. |
|
49 |
ToolsUtilManager manager = ToolsUtilLocator.getToolsUtilManager(); |
|
50 |
if (manager == null) { |
|
51 |
throw new ReferenceNotRegisteredException( |
|
52 |
ToolsUtilLocator.TOOLS_UTIL_MANAGER_NAME, ToolsUtilLocator |
|
53 |
.getInstance()); |
|
54 |
} |
|
55 |
|
|
56 |
} |
|
57 |
|
|
58 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/tools/util/ToolsUtilManager.java | ||
---|---|---|
1 |
package org.gvsig.tools.util; |
|
2 |
|
|
3 |
import org.gvsig.desktopopen.DesktopOpen; |
|
4 |
import org.gvsig.htmlbuilder.HTMLBuilder; |
|
5 |
|
|
6 |
/** |
|
7 |
* gvSIG. Desktop Geographic Information System. |
|
8 |
* |
|
9 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
10 |
* |
|
11 |
* This program is free software; you can redistribute it and/or modify it under |
|
12 |
* the terms of the GNU General Public License as published by the Free Software |
|
13 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
14 |
* version. |
|
15 |
* |
|
16 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
17 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
18 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
19 |
* details. |
|
20 |
* |
|
21 |
* You should have received a copy of the GNU General Public License along with |
|
22 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
23 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
24 |
* |
|
25 |
* For any additional information, do not hesitate to contact us at info AT |
|
26 |
* gvsig.com, or visit our website www.gvsig.com. |
|
27 |
*/ |
|
28 |
/** |
|
29 |
* @author fdiaz |
|
30 |
* |
|
31 |
*/ |
|
32 |
public interface ToolsUtilManager { |
|
33 |
|
|
34 |
/** |
|
35 |
* @return |
|
36 |
*/ |
|
37 |
public InformationBuilder createInformationBuilder(); |
|
38 |
|
|
39 |
public DesktopOpen createDesktopOpen(); |
|
40 |
|
|
41 |
public HTMLBuilder createHTMLBuilder(); |
|
42 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.325/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/tools/util/InformationBuilder.java | ||
---|---|---|
1 |
package org.gvsig.tools.util; |
|
2 |
|
|
3 |
public interface InformationBuilder { |
|
4 |
|
Also available in: Unified diff