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