Statistics
| Revision:

root / trunk / extensions / extCAD / src / com / iver / cit / gvsig / EditionChangeManager.java @ 9243

History | View | Annotate | Download (5.47 KB)

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