Statistics
| Revision:

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

History | View | Annotate | Download (3.84 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.edition.AfterRowEditEvent;
6
import com.iver.cit.gvsig.fmap.edition.BeforeRowEditEvent;
7
import com.iver.cit.gvsig.fmap.edition.EditionEvent;
8
import com.iver.cit.gvsig.fmap.edition.IEditionListener;
9
import com.iver.cit.gvsig.fmap.layers.FLayer;
10
import com.iver.cit.gvsig.fmap.layers.FLayers;
11
import com.iver.cit.gvsig.gui.Table;
12

    
13
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
14
 *
15
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
16
 *
17
 * This program is free software; you can redistribute it and/or
18
 * modify it under the terms of the GNU General Public License
19
 * as published by the Free Software Foundation; either version 2
20
 * of the License, or (at your option) any later version.
21
 *
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU General Public License
28
 * along with this program; if not, write to the Free Software
29
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
30
 *
31
 * For more information, contact:
32
 *
33
 *  Generalitat Valenciana
34
 *   Conselleria d'Infraestructures i Transport
35
 *   Av. Blasco Ib??ez, 50
36
 *   46010 VALENCIA
37
 *   SPAIN
38
 *
39
 *      +34 963862235
40
 *   gvsig@gva.es
41
 *      www.gvsig.gva.es
42
 *
43
 *    or
44
 *
45
 *   IVER T.I. S.A
46
 *   Salamanca 50
47
 *   46005 Valencia
48
 *   Spain
49
 *
50
 *   +34 963163400
51
 *   dac@iver.es
52
 */
53
/* CVS MESSAGES:
54
 *
55
 * $Id: EditionChangeManager.java 5117 2006-05-10 06:26:24Z caballero $
56
 * $Log$
57
 * Revision 1.3  2006-05-10 06:26:24  caballero
58
 * comprobar si tiene capa asociada
59
 *
60
 * Revision 1.2  2006/05/09 09:26:04  caballero
61
 * refrescar las vistas y tablas
62
 *
63
 * Revision 1.1  2006/05/05 09:06:09  jorpiell
64
 * 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.
65
 *
66
 *
67
 */
68
/**
69
 * Cuando un tema se pone en edici?n se le debe asociar
70
 * un listener de este tipo, que se dispar? cuando se produzca
71
 * un evento de edici?n (borrado, modificaci?n,... sobre la capa.
72
 *
73
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
74
 */
75
public class EditionChangeManager implements IEditionListener{
76
        private FLayer fLayer = null;
77

    
78
        /**
79
         * Constructor
80
         * @param fLayer
81
         * Tema que se est? editando
82
         */
83
        public EditionChangeManager(FLayer fLayer){
84
                this.fLayer = fLayer;
85
        }
86
        /*
87
         *  (non-Javadoc)
88
         * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#processEvent(com.iver.cit.gvsig.fmap.edition.EditionEvent)
89
         */
90
        public void processEvent(EditionEvent e) {
91
                // TODO Auto-generated method stub
92

    
93
        }
94

    
95
        /*
96
         *  (non-Javadoc)
97
         * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#beforeRowEditEvent(com.iver.cit.gvsig.fmap.edition.BeforeRowEditEvent)
98
         */
99
        public void beforeRowEditEvent(BeforeRowEditEvent e) {
100
                // TODO Auto-generated method stub
101

    
102
        }
103

    
104
        /*
105
         *  (non-Javadoc)
106
         * @see com.iver.cit.gvsig.fmap.edition.IEditionListener#afterRowEditEvent(com.iver.cit.gvsig.fmap.edition.AfterRowEditEvent)
107
         */
108
        public void afterRowEditEvent(AfterRowEditEvent e) {
109
                View[] views = (View[]) PluginServices.getMDIManager().getAllViews();
110

    
111
                for (int i=0 ; i<views.length ; i++){
112
                        if (views[i] instanceof Table){
113
                                Table table=(Table)views[i];
114
                                if (table.getModel().getAssociatedTable()!=null && table.getModel().getAssociatedTable().equals(fLayer))
115
                                        table.refresh();
116
                        }else if (views[i] instanceof com.iver.cit.gvsig.gui.View){
117
                                com.iver.cit.gvsig.gui.View view=(com.iver.cit.gvsig.gui.View)views[i];
118
                                FLayers layers=view.getMapControl().getMapContext().getLayers();
119
                                for (int j=0;j<layers.getLayersCount();j++){
120
                                        if (layers.getLayer(j).equals(fLayer)){
121
                                                view.repaintMap();
122
                                        }
123
                                }
124
                        }
125
                }
126

    
127
        }
128

    
129
}