Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_895 / extensions / extCAD / src / com / iver / cit / gvsig / EditionChangeManager.java @ 10328

History | View | Annotate | Download (5.91 KB)

1
package com.iver.cit.gvsig;
2

    
3
import com.iver.andami.PluginServices;
4
import com.iver.andami.ui.mdiManager.IWindow;
5
import com.iver.cit.gvsig.fmap.core.IRow;
6
import com.iver.cit.gvsig.fmap.edition.AfterFieldEditEvent;
7
import com.iver.cit.gvsig.fmap.edition.AfterRowEditEvent;
8
import com.iver.cit.gvsig.fmap.edition.BeforeFieldEditEvent;
9
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
import com.iver.cit.gvsig.fmap.layers.FLayers;
14
import com.iver.cit.gvsig.project.documents.table.gui.Table;
15

    
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: EditionChangeManager.java 10328 2007-02-14 16:44:47Z  $
59
 * $Log$
60
 * Revision 1.10.2.3  2007-02-13 17:04:43  caballero
61
 * Creo que no hace falta refrescar la tabla aqu?
62
 *
63
 * Revision 1.10.2.2  2006/11/28 12:44:09  fjp
64
 * refrescar solo en las modificaciones y borrados, no en las entidades a?adidas
65
 *
66
 * Revision 1.10.2.1  2006/11/15 00:08:11  jjdelcerro
67
 * *** empty log message ***
68
 *
69
 * Revision 1.11  2006/09/15 10:42:17  caballero
70
 * extensibilidad de documentos
71
 *
72
 * Revision 1.10  2006/08/29 07:56:33  cesar
73
 * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
74
 *
75
 * Revision 1.9  2006/08/29 07:13:57  cesar
76
 * Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow
77
 *
78
 * Revision 1.8  2006/08/08 07:19:05  caballero
79
 * afterRowEditEvent con IRow
80
 *
81
 * Revision 1.7  2006/07/20 11:03:27  fjp
82
 * *** empty log message ***
83
 *
84
 * Revision 1.6  2006/07/13 12:36:01  fjp
85
 * Revisar bien lo de a?adir campos y gestionar un campo gris
86
 *
87
 * Revision 1.5  2006/06/21 07:22:48  fjp
88
 * 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.
89
 *
90
 * Revision 1.4  2006/05/16 07:06:02  caballero
91
 * Saber si se realiza una operaci?n desde la vista o desde la tabla.
92
 *
93
 * Revision 1.3  2006/05/10 06:26:24  caballero
94
 * comprobar si tiene capa asociada
95
 *
96
 * Revision 1.2  2006/05/09 09:26:04  caballero
97
 * refrescar las vistas y tablas
98
 *
99
 * Revision 1.1  2006/05/05 09:06:09  jorpiell
100
 * 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.
101
 *
102
 *
103
 */
104
/**
105
 * Cuando un tema se pone en edici?n se le debe asociar
106
 * un listener de este tipo, que se dispar? cuando se produzca
107
 * un evento de edici?n (borrado, modificaci?n,... sobre la capa.
108
 *
109
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
110
 */
111
public class EditionChangeManager implements IEditionListener{
112
        private FLayer fLayer = null;
113

    
114
        /**
115
         * Constructor
116
         * @param fLayer
117
         * Tema que se est? editando
118
         */
119
        public EditionChangeManager(FLayer fLayer){
120
                this.fLayer = fLayer;
121
        }
122
        /*
123
         *  (non-Javadoc)
124
         * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#processEvent(com.iver.cit.gvsig.fmap.edition.EditionEvent)
125
         */
126
        public void processEvent(EditionEvent e) {
127
                // TODO Auto-generated method stub
128

    
129
        }
130

    
131
        /*
132
         *  (non-Javadoc)
133
         * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#beforeRowEditEvent(com.iver.cit.gvsig.fmap.edition.BeforeRowEditEvent)
134
         */
135
        public void beforeRowEditEvent(IRow feat,BeforeRowEditEvent e) {
136
                // TODO Auto-generated method stub
137

    
138
        }
139

    
140
        /*
141
         *  (non-Javadoc)
142
         * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#afterRowEditEvent(com.iver.cit.gvsig.fmap.edition.AfterRowEditEvent)
143
         */
144
        public void afterRowEditEvent(IRow feat, AfterRowEditEvent e) {
145
                IWindow[] views = (IWindow[]) PluginServices.getMDIManager().getAllWindows();
146

    
147
                for (int i=0 ; i<views.length ; i++){
148
                        if (views[i] instanceof Table){
149
                                Table table=(Table)views[i];
150
                                ///VCN Creo que no hace falta refrescar la tabla aqu?
151
//                                if (table.getModel().getAssociatedTable()!=null && table.getModel().getAssociatedTable().equals(fLayer))
152
//                                        table.refresh();
153
                        }else if (views[i] instanceof com.iver.cit.gvsig.project.documents.view.gui.View){
154
                                com.iver.cit.gvsig.project.documents.view.gui.View view=(com.iver.cit.gvsig.project.documents.view.gui.View)views[i];
155

    
156
                                if (e.getChangeType() == EditionEvent.CHANGE_TYPE_ADD)
157
                                        // No redraw, just image paint
158
                                        view.getMapControl().repaint();
159
                                else
160
                                {
161
                                        fLayer.setDirty(true);
162
                                        view.getMapControl().rePaintDirtyLayers();
163
                                }
164

    
165
                                /* FLayers layers=view.getMapControl().getMapContext().getLayers();
166
                                for (int j=0;j<layers.getLayersCount();j++){
167
                                        if (layers.getLayer(j).equals(fLayer)){
168
                                                view.repaintMap();
169
                                        }
170
                                } */
171
                        }
172
                }
173

    
174
        }
175
        public void beforeFieldEditEvent(BeforeFieldEditEvent e) {
176
                // TODO Auto-generated method stub
177

    
178
        }
179
        public void afterFieldEditEvent(AfterFieldEditEvent e) {
180
                // TODO Auto-generated method stub
181

    
182
        }
183

    
184
}