root / trunk / extensions / extCatalogAndGazetteer / src / es / gva / cit / gvsig / gazetteer / DeleteSearchesExtension.java @ 29540
History | View | Annotate | Download (5.45 KB)
1 | 15717 | vcaballero | package es.gva.cit.gvsig.gazetteer; |
---|---|---|---|
2 | |||
3 | import java.util.Hashtable; |
||
4 | |||
5 | import com.iver.andami.PluginServices; |
||
6 | import com.iver.andami.plugins.Extension; |
||
7 | 29540 | jpiera | import com.iver.cit.gvsig.exceptions.layers.ReloadLayerException; |
8 | 15717 | vcaballero | import com.iver.cit.gvsig.fmap.layers.GraphicLayer; |
9 | 17174 | jcampos | import com.iver.cit.gvsig.project.documents.view.gui.BaseView; |
10 | 15717 | vcaballero | |
11 | |||
12 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
13 | *
|
||
14 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
15 | *
|
||
16 | * This program is free software; you can redistribute it and/or
|
||
17 | * modify it under the terms of the GNU General Public License
|
||
18 | * as published by the Free Software Foundation; either version 2
|
||
19 | * of the License, or (at your option) any later version.
|
||
20 | *
|
||
21 | * This program is distributed in the hope that it will be useful,
|
||
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
24 | * GNU General Public License for more details.
|
||
25 | *
|
||
26 | * You should have received a copy of the GNU General Public License
|
||
27 | * along with this program; if not, write to the Free Software
|
||
28 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
29 | *
|
||
30 | * For more information, contact:
|
||
31 | *
|
||
32 | * Generalitat Valenciana
|
||
33 | * Conselleria d'Infraestructures i Transport
|
||
34 | * Av. Blasco Ib??ez, 50
|
||
35 | * 46010 VALENCIA
|
||
36 | * SPAIN
|
||
37 | *
|
||
38 | * +34 963862235
|
||
39 | * gvsig@gva.es
|
||
40 | * www.gvsig.gva.es
|
||
41 | *
|
||
42 | * or
|
||
43 | *
|
||
44 | * IVER T.I. S.A
|
||
45 | * Salamanca 50
|
||
46 | * 46005 Valencia
|
||
47 | * Spain
|
||
48 | *
|
||
49 | * +34 963163400
|
||
50 | * dac@iver.es
|
||
51 | */
|
||
52 | /* CVS MESSAGES:
|
||
53 | *
|
||
54 | * $Id: DeleteSearchesExtension.java 499 2007-07-10 11:18:10 +0000 (Tue, 10 Jul 2007) jorpiell $
|
||
55 | * $Log$
|
||
56 | * Revision 1.1.2.1 2007/07/10 11:18:10 jorpiell
|
||
57 | * Added the registers
|
||
58 | *
|
||
59 | * Revision 1.7.2.4 2007/01/08 12:19:13 jcampos
|
||
60 | * Revert changes
|
||
61 | *
|
||
62 | * Revision 1.7.2.2 2006/11/15 00:08:16 jjdelcerro
|
||
63 | * *** empty log message ***
|
||
64 | *
|
||
65 | * Revision 1.9 2006/10/02 08:29:06 jorpiell
|
||
66 | * Modificados los cambios del Branch 10 al head
|
||
67 | *
|
||
68 | * Revision 1.7.2.1 2006/09/20 12:01:47 jorpiell
|
||
69 | * Se ha cambiado la versi?n de la jzkit, se ha incorporado la funcionalidad de cargar arcims
|
||
70 | *
|
||
71 | * Revision 1.8 2006/09/20 11:23:50 jorpiell
|
||
72 | * Se ha cambiado la versi?n de la librer?a jzkit de la 1 a la 2.0. Adem?s se ha modificado lo del document
|
||
73 | *
|
||
74 | * Revision 1.7 2006/08/29 07:56:34 cesar
|
||
75 | * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
|
||
76 | *
|
||
77 | * Revision 1.6 2006/08/29 07:13:58 cesar
|
||
78 | * Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow
|
||
79 | *
|
||
80 | * Revision 1.5 2006/07/24 10:10:06 jorpiell
|
||
81 | * Se ha a?adido una hashtable de vistas activas para asociar la goma de borrar con la vista activa
|
||
82 | *
|
||
83 | * Revision 1.4 2006/06/19 11:19:35 jorpiell
|
||
84 | * Cambiadas las comprobaciones de una clase con == por instanceof.
|
||
85 | *
|
||
86 | * Revision 1.3 2006/05/02 15:53:59 jorpiell
|
||
87 | * Se ha cambiado la interfaz Extension por dos clases: una interfaz (IExtension) y una clase abstract(Extension). A partir de ahora todas las extensiones deben heredar de Extension
|
||
88 | *
|
||
89 | * Revision 1.2 2006/03/10 12:40:20 jorpiell
|
||
90 | * Ahora la goma de borrar los resultados del gazetteer ya aparece y desaparece en lugar de habilitarse/deshabilitarse
|
||
91 | *
|
||
92 | * Revision 1.1 2006/03/10 11:59:31 jorpiell
|
||
93 | * Se habilita la gomita para borrar los resultados de la busqueda del gazetteer en funcion de si hay o no resultados para borrar.
|
||
94 | *
|
||
95 | *
|
||
96 | */
|
||
97 | /**
|
||
98 | * @autor Jorge Piera Llodr? (piera_jor@gva.es)
|
||
99 | */
|
||
100 | public class DeleteSearchesExtension extends Extension{ |
||
101 | private static Hashtable views = new Hashtable(); |
||
102 | |||
103 | /*
|
||
104 | * (non-Javadoc)
|
||
105 | * @see com.iver.andami.plugins.Extension#inicializar()
|
||
106 | */
|
||
107 | public void initialize() { |
||
108 | // TODO Auto-generated method stub
|
||
109 | registerIcons(); |
||
110 | } |
||
111 | |||
112 | private void registerIcons(){ |
||
113 | PluginServices.getIconTheme().registerDefault( |
||
114 | "catalog-clear-point",
|
||
115 | this.getClass().getClassLoader().getResource("images/delone.png") |
||
116 | ); |
||
117 | } |
||
118 | |||
119 | /*
|
||
120 | * (non-Javadoc)
|
||
121 | * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
||
122 | */
|
||
123 | public void execute(String actionCommand) { |
||
124 | deteleAllFeatures(); |
||
125 | } |
||
126 | |||
127 | /*
|
||
128 | * (non-Javadoc)
|
||
129 | * @see com.iver.andami.plugins.Extension#isEnabled()
|
||
130 | */
|
||
131 | public boolean isEnabled() { |
||
132 | return true; |
||
133 | } |
||
134 | |||
135 | /*
|
||
136 | * (non-Javadoc)
|
||
137 | * @see com.iver.andami.plugins.Extension#isVisible()
|
||
138 | */
|
||
139 | public boolean isVisible() { |
||
140 | com.iver.andami.ui.mdiManager.IWindow activeView = PluginServices.getMDIManager() |
||
141 | .getActiveWindow(); |
||
142 | |||
143 | if (activeView == null) { |
||
144 | return false; |
||
145 | } |
||
146 | |||
147 | 17174 | jcampos | if (activeView instanceof BaseView){ |
148 | 15717 | vcaballero | Boolean bool = (Boolean)views.get(activeView); |
149 | if (bool == null){ |
||
150 | return false; |
||
151 | }else{
|
||
152 | return bool.booleanValue();
|
||
153 | } |
||
154 | }else{
|
||
155 | return false; |
||
156 | } |
||
157 | |||
158 | |||
159 | } |
||
160 | |||
161 | /**
|
||
162 | * Delete all the current view searches
|
||
163 | *
|
||
164 | */
|
||
165 | public static void deteleAllFeatures(){ |
||
166 | 17174 | jcampos | BaseView activeView = |
167 | (BaseView) PluginServices.getMDIManager().getActiveWindow(); |
||
168 | 15717 | vcaballero | GraphicLayer lyr = activeView.getMapControl().getMapContext().getGraphicsLayer(); |
169 | lyr.clearAllGraphics(); |
||
170 | 29540 | jpiera | activeView.getMapControl().drawMap(false);
|
171 | views.put(activeView,new Boolean(false)); |
||
172 | 15717 | vcaballero | } |
173 | |||
174 | /**
|
||
175 | * Sets the extension enabled
|
||
176 | *
|
||
177 | */
|
||
178 | public static void setVisible(){ |
||
179 | 17174 | jcampos | BaseView activeView = |
180 | (BaseView) PluginServices.getMDIManager().getActiveWindow(); |
||
181 | 15717 | vcaballero | views.put(activeView,new Boolean(true)); |
182 | } |
||
183 | |||
184 | } |