Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / LayerEvent.java @ 20100

History | View | Annotate | Download (4.74 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.fmap.layers;
42

    
43
import com.iver.cit.gvsig.fmap.FMapEvent;
44

    
45

    
46
/**
47
 * <p>Event produced when changes the visibility, activation, edition status, or the name of a layer.</p>
48
 *
49
 * @author Fernando Gonz?lez Cort?s
50
 */
51
public class LayerEvent extends FMapEvent {
52
        /**
53
         * <p>String that identifies the property that has changed.</p>
54
         */
55
        private String property;
56

    
57
        /**
58
         * <p>Layer affected by the action.</p>
59
         */
60
        private FLayer source;
61

    
62
        /**
63
         * <p>Identifies this event as a action of change of the visibility status of a layer.</p>
64
         */
65
        private static final int VISIBILITY_CHANGED = 0;
66

    
67
        /**
68
         * <p>Identifies this event as a action of change of the activation status of a layer.</p>
69
         */
70
        private static final int ACTIVATION_CHANGED = 1;
71
        
72
        /**
73
         * <p>Identifies this event as a action of a change of the name of a layer.</p>
74
         */
75
        private static final int NAME_CHANGED = 2;
76
        
77
        /**
78
         * <p>Identifies this event as a action of change of the edition status of a layer.</p>
79
         */
80
        private static final int EDITION_CHANGED = 3;
81

    
82
        /**
83
         * <p>Creates a new layer event notifying a "visibility changed" action.</p>
84
         * 
85
         * @param default1 layer affected by the action
86
         * @param property property that has changed
87
         * 
88
         * @return a new layer event
89
         */
90
        public static LayerEvent createVisibilityChangedEvent(FLyrDefault default1, String property){
91
                return new LayerEvent(default1, property, VISIBILITY_CHANGED);
92
        }
93
        
94
        /**
95
         * <p>Creates a new layer event notifying an "activation changed" action.</p>
96
         * 
97
         * @param default1 layer affected by the action
98
         * @param property property that has changed
99
         * 
100
         * @return a new layer event
101
         */
102
        public static LayerEvent createActivationChangedEvent(FLyrDefault default1, String property){
103
                return new LayerEvent(default1, property, ACTIVATION_CHANGED);
104
        }
105
        
106
        /**
107
         * <p>Creates a new layer event notifying an action of "change of the name of a layer".</p>
108
         * 
109
         * @param default1 layer affected by the action
110
         * @param property property that has changed
111
         * 
112
         * @return a new layer event
113
         */
114
        public static LayerEvent createNameChangedEvent(FLyrDefault default1, String property){
115
                return new LayerEvent(default1, property, NAME_CHANGED);
116
        }
117
        
118
        /**
119
         * <p>Creates a new layer event notifying an "edition changed" action.</p>
120
         * 
121
         * @param default1 layer affected by the action
122
         * @param property property that has changed
123
         * 
124
         * @return a new layer event
125
         */
126
        public static LayerEvent createEditionChangedEvent(FLyrDefault default1, String property){
127
                return new LayerEvent(default1, property, EDITION_CHANGED);
128
        }
129
        
130
        /**
131
         * <p>Creates a new layer event of the specified type.</p>
132
         * 
133
         * @param default1 layer affected by the action
134
         * @param property property that has changed
135
         * @param eventType type of layer collection event
136
         * 
137
         * @return a new layer collection event
138
         */
139
        private LayerEvent(FLayer default1, String property, int eventType) {
140
                source = default1;
141
                this.property = property;
142
                setEventType(eventType);
143
        }
144

    
145
        /**
146
         * <p>Gets the layer affected.</p>
147
         *
148
         * @return the layer affected
149
         */
150
        public FLayer getSource() {
151
                return source;
152
        }
153

    
154
        /**
155
         * <p>Sets the layer affected.</p>
156
         *
157
         * @param the layer affected
158
         */
159
        public void setSource(FLayer source) {
160
                this.source = source;
161
        }
162

    
163
        /**
164
         * <p>Gets the property that has changed.</p>
165
         *
166
         * @return the property that has changed
167
         */
168
        public String getProperty() {
169
                return property;
170
        }
171

    
172
        /**
173
         * <p>Sets the property that has changed.</p>
174
         *
175
         * @param the property that has changed
176
         */
177
        public void setProperty(String property) {
178
                this.property = property;
179
        }
180
}