root / trunk / extensions / extCAD / src / com / iver / cit / gvsig / EditionChangeManager.java @ 31488
History | View | Annotate | Download (6.56 KB)
1 | 5063 | jorpiell | package com.iver.cit.gvsig; |
---|---|---|---|
2 | |||
3 | 12293 | caballero | import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
4 | 5063 | jorpiell | import com.iver.andami.PluginServices; |
5 | 12293 | caballero | import com.iver.andami.messages.NotificationManager; |
6 | 6877 | cesar | import com.iver.andami.ui.mdiManager.IWindow; |
7 | 5196 | caballero | import com.iver.cit.gvsig.fmap.core.IRow; |
8 | 6338 | fjp | import com.iver.cit.gvsig.fmap.edition.AfterFieldEditEvent; |
9 | 5063 | jorpiell | import com.iver.cit.gvsig.fmap.edition.AfterRowEditEvent; |
10 | 6338 | fjp | import com.iver.cit.gvsig.fmap.edition.BeforeFieldEditEvent; |
11 | 5063 | jorpiell | 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 | 12293 | caballero | import com.iver.cit.gvsig.layers.VectorialLayerEdited; |
16 | 7304 | caballero | import com.iver.cit.gvsig.project.documents.table.gui.Table; |
17 | 5063 | jorpiell | |
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$
|
||
61 | * $Log$
|
||
62 | 13881 | jaume | * 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 | 12293 | caballero | * borrar selecci?n
|
67 | *
|
||
68 | * Revision 1.14 2007/03/21 12:25:41 caballero
|
||
69 | 10837 | caballero | * zoom remove cacheDrawing
|
70 | *
|
||
71 | * Revision 1.13 2007/02/13 17:10:06 caballero
|
||
72 | 10297 | caballero | * expresion
|
73 | *
|
||
74 | * Revision 1.12 2006/11/28 13:18:32 fjp
|
||
75 | 9064 | fjp | * 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 | 7304 | caballero | * extensibilidad de documentos
|
81 | *
|
||
82 | * Revision 1.10 2006/08/29 07:56:33 cesar
|
||
83 | 6880 | cesar | * 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 | 6877 | cesar | * 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 | 6689 | caballero | * afterRowEditEvent con IRow
|
90 | *
|
||
91 | * Revision 1.7 2006/07/20 11:03:27 fjp
|
||
92 | 6457 | fjp | * *** empty log message ***
|
93 | *
|
||
94 | * Revision 1.6 2006/07/13 12:36:01 fjp
|
||
95 | 6338 | fjp | * 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 | 5923 | fjp | * 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 | 5196 | caballero | * 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 | 5117 | caballero | * comprobar si tiene capa asociada
|
105 | *
|
||
106 | * Revision 1.2 2006/05/09 09:26:04 caballero
|
||
107 | 5110 | caballero | * refrescar las vistas y tablas
|
108 | *
|
||
109 | * Revision 1.1 2006/05/05 09:06:09 jorpiell
|
||
110 | 5063 | jorpiell | * 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 | 5110 | caballero | *
|
119 | 5063 | jorpiell | * @author Jorge Piera Llodr? (piera_jor@gva.es)
|
120 | */
|
||
121 | public class EditionChangeManager implements IEditionListener{ |
||
122 | private FLayer fLayer = null; |
||
123 | 5110 | caballero | |
124 | 5063 | jorpiell | /**
|
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 | 5110 | caballero | |
139 | 5063 | jorpiell | } |
140 | |||
141 | /*
|
||
142 | * (non-Javadoc)
|
||
143 | * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#beforeRowEditEvent(com.iver.cit.gvsig.fmap.edition.BeforeRowEditEvent)
|
||
144 | */
|
||
145 | 5196 | caballero | public void beforeRowEditEvent(IRow feat,BeforeRowEditEvent e) { |
146 | 5063 | jorpiell | // TODO Auto-generated method stub
|
147 | 5110 | caballero | |
148 | 5063 | jorpiell | } |
149 | |||
150 | /*
|
||
151 | * (non-Javadoc)
|
||
152 | * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#afterRowEditEvent(com.iver.cit.gvsig.fmap.edition.AfterRowEditEvent)
|
||
153 | */
|
||
154 | 6689 | caballero | public void afterRowEditEvent(IRow feat, AfterRowEditEvent e) { |
155 | 12293 | caballero | IWindow[] views = PluginServices.getMDIManager().getAllWindows();
|
156 | 5063 | jorpiell | |
157 | for (int i=0 ; i<views.length ; i++){ |
||
158 | if (views[i] instanceof Table){ |
||
159 | 12293 | caballero | // Table table=(Table)views[i];
|
160 | 10837 | caballero | ///VCN Creo que no hace falta refrescar la tabla aqu?
|
161 | 10297 | caballero | // if (table.getModel().getAssociatedTable()!=null && table.getModel().getAssociatedTable().equals(fLayer))
|
162 | // table.refresh();
|
||
163 | 10837 | caballero | }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 | 10297 | caballero | |
166 | 12293 | caballero | if (e.getChangeType() == EditionEvent.CHANGE_TYPE_ADD) {
|
167 | 9064 | fjp | // No redraw, just image paint
|
168 | view.getMapControl().repaint(); |
||
169 | 12293 | caballero | }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 | 24160 | jmvivo | // fLayer.setDirty(true);
|
181 | 9064 | fjp | view.getMapControl().rePaintDirtyLayers(); |
182 | } |
||
183 | 10837 | caballero | |
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 | 5063 | jorpiell | } |
191 | } |
||
192 | 5110 | caballero | |
193 | 5063 | jorpiell | } |
194 | 6338 | fjp | public void beforeFieldEditEvent(BeforeFieldEditEvent e) { |
195 | // TODO Auto-generated method stub
|
||
196 | 10297 | caballero | |
197 | 6338 | fjp | } |
198 | public void afterFieldEditEvent(AfterFieldEditEvent e) { |
||
199 | // TODO Auto-generated method stub
|
||
200 | 10297 | caballero | |
201 | 6338 | fjp | } |
202 | 5063 | jorpiell | |
203 | } |