Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extCAD / src / com / iver / cit / gvsig / EditionChangeManager.java @ 5923

History | View | Annotate | Download (4.33 KB)

1
package com.iver.cit.gvsig;
2

    
3
import com.iver.andami.PluginServices;
4
import com.iver.andami.ui.mdiManager.View;
5
import com.iver.cit.gvsig.fmap.core.IRow;
6
import com.iver.cit.gvsig.fmap.edition.AfterRowEditEvent;
7
import com.iver.cit.gvsig.fmap.edition.BeforeRowEditEvent;
8
import com.iver.cit.gvsig.fmap.edition.EditionEvent;
9
import com.iver.cit.gvsig.fmap.edition.IEditionListener;
10
import com.iver.cit.gvsig.fmap.layers.FLayer;
11
import com.iver.cit.gvsig.fmap.layers.FLayers;
12
import com.iver.cit.gvsig.gui.Table;
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 5923 2006-06-21 07:22:48Z fjp $
57
 * $Log$
58
 * Revision 1.5  2006-06-21 07:22:48  fjp
59
 * 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.
60
 *
61
 * Revision 1.4  2006/05/16 07:06:02  caballero
62
 * Saber si se realiza una operaci?n desde la vista o desde la tabla.
63
 *
64
 * Revision 1.3  2006/05/10 06:26:24  caballero
65
 * comprobar si tiene capa asociada
66
 *
67
 * Revision 1.2  2006/05/09 09:26:04  caballero
68
 * refrescar las vistas y tablas
69
 *
70
 * Revision 1.1  2006/05/05 09:06:09  jorpiell
71
 * 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.
72
 *
73
 *
74
 */
75
/**
76
 * Cuando un tema se pone en edici?n se le debe asociar
77
 * un listener de este tipo, que se dispar? cuando se produzca
78
 * un evento de edici?n (borrado, modificaci?n,... sobre la capa.
79
 *
80
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
81
 */
82
public class EditionChangeManager implements IEditionListener{
83
        private FLayer fLayer = null;
84

    
85
        /**
86
         * Constructor
87
         * @param fLayer
88
         * Tema que se est? editando
89
         */
90
        public EditionChangeManager(FLayer fLayer){
91
                this.fLayer = fLayer;
92
        }
93
        /*
94
         *  (non-Javadoc)
95
         * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#processEvent(com.iver.cit.gvsig.fmap.edition.EditionEvent)
96
         */
97
        public void processEvent(EditionEvent e) {
98
                // TODO Auto-generated method stub
99

    
100
        }
101

    
102
        /*
103
         *  (non-Javadoc)
104
         * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#beforeRowEditEvent(com.iver.cit.gvsig.fmap.edition.BeforeRowEditEvent)
105
         */
106
        public void beforeRowEditEvent(IRow feat,BeforeRowEditEvent e) {
107
                // TODO Auto-generated method stub
108

    
109
        }
110

    
111
        /*
112
         *  (non-Javadoc)
113
         * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#afterRowEditEvent(com.iver.cit.gvsig.fmap.edition.AfterRowEditEvent)
114
         */
115
        public void afterRowEditEvent(AfterRowEditEvent e) {
116
                View[] views = (View[]) PluginServices.getMDIManager().getAllViews();
117

    
118
                for (int i=0 ; i<views.length ; i++){
119
                        if (views[i] instanceof Table){
120
                                Table table=(Table)views[i];
121
                                if (table.getModel().getAssociatedTable()!=null && table.getModel().getAssociatedTable().equals(fLayer))
122
                                        table.refresh();
123
                        }else if (views[i] instanceof com.iver.cit.gvsig.gui.View){
124
                                com.iver.cit.gvsig.gui.View view=(com.iver.cit.gvsig.gui.View)views[i];
125
                                
126
                                fLayer.setDirty(true);
127
                                view.getMapControl().rePaintDirtyLayers();
128
                                /* FLayers layers=view.getMapControl().getMapContext().getLayers();
129
                                for (int j=0;j<layers.getLayersCount();j++){
130
                                        if (layers.getLayer(j).equals(fLayer)){
131
                                                view.repaintMap();
132
                                        }
133
                                } */
134
                        }
135
                }
136

    
137
        }
138

    
139
}