svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / EditionChangeManager.java @ 39212
History | View | Annotate | Download (6.9 KB)
1 |
package org.gvsig.editing; |
---|---|
2 |
|
3 |
import org.gvsig.andami.PluginServices; |
4 |
import org.gvsig.andami.messages.NotificationManager; |
5 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
6 |
import org.gvsig.editing.layers.VectorialLayerEdited; |
7 |
import org.gvsig.fmap.dal.exception.DataException; |
8 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStoreNotification; |
9 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
10 |
import org.gvsig.tools.observer.Observable; |
11 |
import org.gvsig.tools.observer.Observer; |
12 |
|
13 |
|
14 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
15 |
*
|
16 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
17 |
*
|
18 |
* This program is free software; you can redistribute it and/or
|
19 |
* modify it under the terms of the GNU General Public License
|
20 |
* as published by the Free Software Foundation; either version 2
|
21 |
* of the License, or (at your option) any later version.
|
22 |
*
|
23 |
* This program is distributed in the hope that it will be useful,
|
24 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
* GNU General Public License for more details.
|
27 |
*
|
28 |
* You should have received a copy of the GNU General Public License
|
29 |
* along with this program; if not, write to the Free Software
|
30 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
31 |
*
|
32 |
* For more information, contact:
|
33 |
*
|
34 |
* Generalitat Valenciana
|
35 |
* Conselleria d'Infraestructures i Transport
|
36 |
* Av. Blasco Ib??ez, 50
|
37 |
* 46010 VALENCIA
|
38 |
* SPAIN
|
39 |
*
|
40 |
* +34 963862235
|
41 |
* gvsig@gva.es
|
42 |
* www.gvsig.gva.es
|
43 |
*
|
44 |
* or
|
45 |
*
|
46 |
* IVER T.I. S.A
|
47 |
* Salamanca 50
|
48 |
* 46005 Valencia
|
49 |
* Spain
|
50 |
*
|
51 |
* +34 963163400
|
52 |
* dac@iver.es
|
53 |
*/
|
54 |
/* CVS MESSAGES:
|
55 |
*
|
56 |
* $Id: EditionChangeManager.java 39212 2012-11-12 10:01:47Z jldominguez $
|
57 |
* $Log$
|
58 |
* Revision 1.16 2007-09-19 15:55:42 jaume
|
59 |
* removed unnecessary imports
|
60 |
*
|
61 |
* Revision 1.15 2007/06/22 10:48:00 caballero
|
62 |
* borrar selecci?n
|
63 |
*
|
64 |
* Revision 1.14 2007/03/21 12:25:41 caballero
|
65 |
* zoom remove cacheDrawing
|
66 |
*
|
67 |
* Revision 1.13 2007/02/13 17:10:06 caballero
|
68 |
* expresion
|
69 |
*
|
70 |
* Revision 1.12 2006/11/28 13:18:32 fjp
|
71 |
* No redibujar cuando se a?ade algo.
|
72 |
* Para que se dibuje con el s?mbolo por defecto del layer, habr? que tocar
|
73 |
* en los CADTool
|
74 |
*
|
75 |
* Revision 1.11 2006/09/15 10:42:17 caballero
|
76 |
* extensibilidad de documentos
|
77 |
*
|
78 |
* Revision 1.10 2006/08/29 07:56:33 cesar
|
79 |
* Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
|
80 |
*
|
81 |
* Revision 1.9 2006/08/29 07:13:57 cesar
|
82 |
* Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow
|
83 |
*
|
84 |
* Revision 1.8 2006/08/08 07:19:05 caballero
|
85 |
* afterRowEditEvent con IRow
|
86 |
*
|
87 |
* Revision 1.7 2006/07/20 11:03:27 fjp
|
88 |
* *** empty log message ***
|
89 |
*
|
90 |
* Revision 1.6 2006/07/13 12:36:01 fjp
|
91 |
* Revisar bien lo de a?adir campos y gestionar un campo gris
|
92 |
*
|
93 |
* Revision 1.5 2006/06/21 07:22:48 fjp
|
94 |
* Posibilidad de marcar capas como "dirty" y tener una que guarde lo que se ha dibujado antes que ella. Al hacer un MapControl.rePaintDirtyLayers(), eso se tiene en cuenta en el redibujado.
|
95 |
*
|
96 |
* Revision 1.4 2006/05/16 07:06:02 caballero
|
97 |
* Saber si se realiza una operaci?n desde la vista o desde la tabla.
|
98 |
*
|
99 |
* Revision 1.3 2006/05/10 06:26:24 caballero
|
100 |
* comprobar si tiene capa asociada
|
101 |
*
|
102 |
* Revision 1.2 2006/05/09 09:26:04 caballero
|
103 |
* refrescar las vistas y tablas
|
104 |
*
|
105 |
* Revision 1.1 2006/05/05 09:06:09 jorpiell
|
106 |
* Se a a?adido la clase EditionChangeManager, que no es m?s que un listener que se ejecuta cuando se produce un evento de edici?n.
|
107 |
*
|
108 |
*
|
109 |
*/
|
110 |
/**
|
111 |
* Cuando un tema se pone en edici?n se le debe asociar
|
112 |
* un listener de este tipo, que se dispar? cuando se produzca
|
113 |
* un evento de edici?n (borrado, modificaci?n,... sobre la capa.
|
114 |
*
|
115 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
116 |
*/
|
117 |
public class EditionChangeManager implements Observer{ |
118 |
private FLayer fLayer = null; |
119 |
|
120 |
/**
|
121 |
* Constructor
|
122 |
* @param fLayer
|
123 |
* Tema que se est? editando
|
124 |
*/
|
125 |
public EditionChangeManager(FLayer fLayer){
|
126 |
this.fLayer = fLayer;
|
127 |
} |
128 |
/*
|
129 |
* (non-Javadoc)
|
130 |
* @see com.iver.cit.gvsig.fmap.edition.IEditionListener#afterRowEditEvent(com.iver.cit.gvsig.fmap.edition.AfterRowEditEvent)
|
131 |
*/
|
132 |
// public void afterRowEditEvent(IRow feat, AfterRowEditEvent e) {
|
133 |
// IWindow[] views = PluginServices.getMDIManager().getAllWindows();
|
134 |
//
|
135 |
// for (int i=0 ; i<views.length ; i++){
|
136 |
// if (views[i] instanceof Table){
|
137 |
//// Table table=(Table)views[i];
|
138 |
// ///VCN Creo que no hace falta refrescar la tabla aqu?
|
139 |
//// if (table.getModel().getAssociatedTable()!=null && table.getModel().getAssociatedTable().equals(fLayer))
|
140 |
//// table.refresh();
|
141 |
// }else if (views[i] instanceof com.iver.cit.gvsig.project.documents.view.gui.View){
|
142 |
// com.iver.cit.gvsig.project.documents.view.gui.View view=(com.iver.cit.gvsig.project.documents.view.gui.View)views[i];
|
143 |
//
|
144 |
// if (e.getChangeType() == EditionEvent.CHANGE_TYPE_ADD) {
|
145 |
// // No redraw, just image paint
|
146 |
// view.getMapControl().repaint();
|
147 |
// }else if (e.getChangeType() == EditionEvent.CHANGE_TYPE_DELETE){
|
148 |
// EditionManager em=CADExtension.getEditionManager();
|
149 |
// if (em.getActiveLayerEdited()!=null){
|
150 |
// VectorialLayerEdited vle=(VectorialLayerEdited)em.getActiveLayerEdited();
|
151 |
// try {
|
152 |
// vle.clearSelection(false);
|
153 |
// } catch (ReadException e1) {
|
154 |
// NotificationManager.addError(e1);
|
155 |
// }
|
156 |
// }
|
157 |
// }else{
|
158 |
// fLayer.setDirty(true);
|
159 |
// view.getMapControl().rePaintDirtyLayers();
|
160 |
// }
|
161 |
//
|
162 |
// /* FLayers layers=view.getMapControl().getMapContext().getLayers();
|
163 |
// for (int j=0;j<layers.getLayersCount();j++){
|
164 |
// if (layers.getLayer(j).equals(fLayer)){
|
165 |
// view.repaintMap();
|
166 |
// }
|
167 |
// } */
|
168 |
// }
|
169 |
// }
|
170 |
//
|
171 |
// }
|
172 |
public void update(Observable observable, Object notification) { |
173 |
DefaultFeatureStoreNotification dfsn=(DefaultFeatureStoreNotification)notification; |
174 |
String type=dfsn.getType();
|
175 |
IWindow[] views = PluginServices.getMDIManager().getAllWindows();
|
176 |
|
177 |
for (int i=0 ; i<views.length ; i++){ |
178 |
if (views[i] instanceof org.gvsig.app.project.documents.view.gui.DefaultViewPanel){ |
179 |
org.gvsig.app.project.documents.view.gui.DefaultViewPanel view=(org.gvsig.app.project.documents.view.gui.DefaultViewPanel)views[i]; |
180 |
if (type.equals(DefaultFeatureStoreNotification.AFTER_DELETE)){
|
181 |
EditionManager em=CADExtension.getEditionManager(); |
182 |
if (em.getActiveLayerEdited()!=null){ |
183 |
VectorialLayerEdited vle=(VectorialLayerEdited)em.getActiveLayerEdited(); |
184 |
try {
|
185 |
vle.clearSelection(); |
186 |
} catch (DataException e1) {
|
187 |
NotificationManager.addError(e1); |
188 |
} |
189 |
} |
190 |
} |
191 |
if (type.equals(DefaultFeatureStoreNotification.AFTER_INSERT)){
|
192 |
view.getMapControl().repaint(); |
193 |
} |
194 |
if (type.equals(DefaultFeatureStoreNotification.AFTER_UPDATE)
|
195 |
|| type.equals(DefaultFeatureStoreNotification.AFTER_REDO) |
196 |
|| type.equals(DefaultFeatureStoreNotification.AFTER_UNDO)) { |
197 |
view.getMapControl().rePaintDirtyLayers(); |
198 |
} |
199 |
} |
200 |
} |
201 |
} |
202 |
|
203 |
} |