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