svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extGeocoding / src / org / gvsig / geocoding / extension / GeocodingExtension.java @ 27140
History | View | Annotate | Download (3.38 KB)
1 | 26843 | vsanjaime | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
4 | * of the Valencian Government (CIT)
|
||
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 2
|
||
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 | */
|
||
22 | |||
23 | /*
|
||
24 | * AUTHORS (In addition to CIT):
|
||
25 | * 2008 Prodevelop S.L. main development
|
||
26 | */
|
||
27 | |||
28 | package org.gvsig.geocoding.extension; |
||
29 | |||
30 | import org.gvsig.geocoding.preferences.GeocoPreferences; |
||
31 | 27140 | csanchez | import org.slf4j.Logger; |
32 | import org.slf4j.LoggerFactory; |
||
33 | 26843 | vsanjaime | |
34 | import com.iver.andami.PluginServices; |
||
35 | import com.iver.andami.plugins.Extension; |
||
36 | 26893 | vsanjaime | import com.iver.andami.preferences.IPreference; |
37 | import com.iver.andami.preferences.IPreferenceExtension; |
||
38 | 26843 | vsanjaime | import com.iver.andami.ui.mdiManager.IWindow; |
39 | import com.iver.cit.gvsig.About; |
||
40 | import com.iver.cit.gvsig.gui.panels.FPanelAbout; |
||
41 | import com.iver.cit.gvsig.project.documents.view.gui.View; |
||
42 | |||
43 | 26893 | vsanjaime | |
44 | 26843 | vsanjaime | /**
|
45 | * Geocoding Extension. This extension geoposition in the map one postal
|
||
46 | * address.
|
||
47 | *
|
||
48 | * @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
|
||
49 | * @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
|
||
50 | */
|
||
51 | |||
52 | 26893 | vsanjaime | public class GeocodingExtension extends Extension implements IPreferenceExtension { |
53 | 26843 | vsanjaime | |
54 | private static final String GEOCODING = "GEOCODING"; |
||
55 | |||
56 | 27140 | csanchez | private static final Logger log = LoggerFactory.getLogger(GeocodingExtension.class); |
57 | 26893 | vsanjaime | |
58 | private static final IPreference preferencePage = new GeocoPreferences(); |
||
59 | |||
60 | 26843 | vsanjaime | |
61 | /**
|
||
62 | * execute
|
||
63 | */
|
||
64 | public void execute(String actionCommand) { |
||
65 | |||
66 | if (actionCommand.equalsIgnoreCase(GEOCODING)) {
|
||
67 | /* make controller */
|
||
68 | new GeocoController();
|
||
69 | } |
||
70 | } |
||
71 | |||
72 | /**
|
||
73 | * This method initializes some parameters of the extension
|
||
74 | */
|
||
75 | public void initialize() { |
||
76 | |||
77 | About about = (About) PluginServices.getExtension(About.class); |
||
78 | FPanelAbout panelAbout = about.getAboutPanel(); |
||
79 | java.net.URL aboutURL = getClass().getClassLoader().getResource( |
||
80 | "about/extGeocoding-about.html");
|
||
81 | 26851 | vsanjaime | panelAbout.addAboutUrl(PluginServices.getText(this, "geocoding"), |
82 | aboutURL); |
||
83 | 26843 | vsanjaime | } |
84 | |||
85 | /**
|
||
86 | * This method puts available the extension
|
||
87 | */
|
||
88 | public boolean isEnabled() { |
||
89 | |||
90 | IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
||
91 | if (window instanceof View) { |
||
92 | return true; |
||
93 | } |
||
94 | return true; |
||
95 | } |
||
96 | |||
97 | /**
|
||
98 | * This method puts visible the extension
|
||
99 | */
|
||
100 | public boolean isVisible() { |
||
101 | IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
||
102 | // Visible when there are tables or views in the window
|
||
103 | if (window instanceof View) { |
||
104 | return true; |
||
105 | } |
||
106 | return false; |
||
107 | |||
108 | } |
||
109 | |||
110 | 26893 | vsanjaime | |
111 | |||
112 | public IPreference[] getPreferencesPages() { |
||
113 | IPreference[] preferences=new IPreference[1]; |
||
114 | preferences[0]=preferencePage;
|
||
115 | return preferences;
|
||
116 | 26843 | vsanjaime | } |
117 | |||
118 | } |