Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / extGeocoding / src / org / gvsig / geocoding / extension / ResultsGeocodingExtension.java @ 27756

History | View | Annotate | Download (3.48 KB)

1
/* 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.gui.results.ResultsPanel;
31
import org.gvsig.geocoding.preferences.GeocoPreferences;
32
import org.gvsig.gui.beans.table.Table;
33
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel;
34
import org.slf4j.Logger;
35
import org.slf4j.LoggerFactory;
36

    
37
import com.iver.andami.PluginServices;
38
import com.iver.andami.plugins.Extension;
39
import com.iver.andami.preferences.IPreference;
40
import com.iver.andami.preferences.IPreferenceExtension;
41
import com.iver.andami.ui.mdiManager.IWindow;
42

    
43
/**
44
 * Geocoding Extension. This extension geoposition in the map one postal
45
 * address.
46
 * 
47
 * @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
48
 * @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
49
 */
50

    
51
public class ResultsGeocodingExtension extends Extension implements
52
                IPreferenceExtension {
53

    
54
        private static final String RESULTSGEOCODING = "RESULTSGEOCODING";
55

    
56
        private static final Logger log = LoggerFactory
57
                        .getLogger(ResultsGeocodingExtension.class);
58

    
59
        private static final IPreference preferencePage = new GeocoPreferences();
60
        
61
        private GeocoController control = null;
62

    
63
        
64
        
65
        /**
66
         * execute
67
         */
68
        public void execute(String actionCommand) {
69

    
70
                if (actionCommand.equalsIgnoreCase(RESULTSGEOCODING)) {
71
                         
72
                        GeocodingExtension mainExt = (GeocodingExtension) PluginServices
73
                         .getExtension(GeocodingExtension.class);
74
                         control = mainExt.getControl();
75
                        // ahow panel extension
76
                        ResultsPanel rpanel = new ResultsPanel(control);
77
                        PluginServices.getMDIManager().addWindow(rpanel);
78
                        rpanel.setVisible(true);
79
                }
80
        }
81

    
82
        /**
83
         * This method initializes some parameters of the extension
84
         */
85
        public void initialize() {
86

    
87
        }
88

    
89
        /**
90
         * This method puts available the extension
91
         * 
92
         * @return true or false
93
         */
94
        public boolean isEnabled() {
95

    
96
                IWindow window = PluginServices.getMDIManager().getActiveWindow();
97
                if (window instanceof FeatureTableDocumentPanel) {
98
                        return true;
99
                }
100
                return false;
101
        }
102

    
103
        /**
104
         * This method puts visible the extension
105
         * 
106
         * @return true or false
107
         */
108
        public boolean isVisible() {
109
                IWindow window = PluginServices.getMDIManager().getActiveWindow();
110
                if (window instanceof FeatureTableDocumentPanel) {
111
                        return true;
112
                }
113
                return false;
114
        }
115

    
116
        /**
117
         * Get array of extension preferences pages
118
         * 
119
         * @return
120
         */
121
        public IPreference[] getPreferencesPages() {
122
                return null;
123
        }
124

    
125
}