Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / main / java / org / gvsig / fmap / mapcontext / layers / LayerEvent.java @ 44644

History | View | Annotate | Download (4.96 KB)

1 40559 jjdelcerro
/**
2
 * gvSIG. Desktop Geographic Information System.
3 40435 jjdelcerro
 *
4 40559 jjdelcerro
 * Copyright (C) 2007-2013 gvSIG Association.
5 40435 jjdelcerro
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8 40559 jjdelcerro
 * as published by the Free Software Foundation; either version 3
9 40435 jjdelcerro
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18 40559 jjdelcerro
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20 40435 jjdelcerro
 *
21 40559 jjdelcerro
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23 40435 jjdelcerro
 */
24
package org.gvsig.fmap.mapcontext.layers;
25
26 43253 fdiaz
import org.gvsig.fmap.mapcontext.events.FMapEventBase;
27 40435 jjdelcerro
28
29
/**
30
 * <p>Event produced when changes the visibility, activation, edition status, or the name of a layer.</p>
31
 *
32
 * @author Fernando Gonz?lez Cort?s
33
 */
34 43253 fdiaz
public class LayerEvent extends FMapEventBase {
35 40435 jjdelcerro
        /**
36
         * <p>String that identifies the property that has changed.</p>
37
         */
38
        private String property;
39
40
        /**
41
         * <p>Layer affected by the action.</p>
42
         */
43
        private FLayer source;
44
45
        /**
46
         * <p>Identifies this event as a action of change of the visibility status of a layer.</p>
47
         */
48
        public static final int VISIBILITY_CHANGED = 0;
49
50
        /**
51
         * <p>Identifies this event as a action of change of the activation status of a layer.</p>
52
         */
53
        public static final int ACTIVATION_CHANGED = 1;
54 43253 fdiaz
55 40435 jjdelcerro
        /**
56
         * <p>Identifies this event as a action of a change of the name of a layer.</p>
57
         */
58
        public static final int NAME_CHANGED = 2;
59 43253 fdiaz
60 40435 jjdelcerro
        /**
61
         * <p>Identifies this event as a action of change of the edition status of a layer.</p>
62
         */
63
        public static final int EDITION_CHANGED = 3;
64
65
        /**
66
         * <p>Identifies this event as a action of change of any property that affects to draw of the layer.</p>
67
         */
68
        public static final int DRAW_VALUES_CHANGED = 4;
69
70
        /**
71
         * <p>Creates a new layer event notifying a "visibility changed" action.</p>
72 43253 fdiaz
         *
73 40435 jjdelcerro
         * @param default1 layer affected by the action
74
         * @param property property that has changed
75 43253 fdiaz
         *
76 40435 jjdelcerro
         * @return a new layer event
77
         */
78
        public static LayerEvent createVisibilityChangedEvent(FLyrDefault default1, String property){
79
                return new LayerEvent(default1, property, VISIBILITY_CHANGED);
80
        }
81
82
        /**
83
         * <p>Creates a new layer event notifying an "activation changed" action.</p>
84 43253 fdiaz
         *
85 40435 jjdelcerro
         * @param default1 layer affected by the action
86
         * @param property property that has changed
87 43253 fdiaz
         *
88 40435 jjdelcerro
         * @return a new layer event
89
         */
90
        public static LayerEvent createActivationChangedEvent(FLyrDefault default1, String property){
91
                return new LayerEvent(default1, property, ACTIVATION_CHANGED);
92
        }
93 43253 fdiaz
94 40435 jjdelcerro
        public static LayerEvent createDrawValuesChangedEvent(FLyrDefault default1, String property){
95
                return new LayerEvent(default1, property, DRAW_VALUES_CHANGED);
96
        }
97
98
        /**
99
         * <p>Creates a new layer event notifying an action of "change of the name of a layer".</p>
100 43253 fdiaz
         *
101 40435 jjdelcerro
         * @param default1 layer affected by the action
102
         * @param property property that has changed
103 43253 fdiaz
         *
104 40435 jjdelcerro
         * @return a new layer event
105 43253 fdiaz
         */
106 40435 jjdelcerro
        public static LayerEvent createNameChangedEvent(FLyrDefault default1, String property){
107
                return new LayerEvent(default1, property, NAME_CHANGED);
108
        }
109 43253 fdiaz
110 40435 jjdelcerro
        /**
111
         * <p>Creates a new layer event notifying an "edition changed" action.</p>
112 43253 fdiaz
         *
113 40435 jjdelcerro
         * @param default1 layer affected by the action
114
         * @param property property that has changed
115 43253 fdiaz
         *
116 40435 jjdelcerro
         * @return a new layer event
117
         */
118
        public static LayerEvent createEditionChangedEvent(FLyrDefault default1, String property){
119
                return new LayerEvent(default1, property, EDITION_CHANGED);
120
        }
121 43253 fdiaz
122 40435 jjdelcerro
        /**
123
         * <p>Creates a new layer event of the specified type.</p>
124 43253 fdiaz
         *
125 40435 jjdelcerro
         * @param default1 layer affected by the action
126
         * @param property property that has changed
127
         * @param eventType type of layer collection event
128 43253 fdiaz
         *
129 40435 jjdelcerro
         * @return a new layer collection event
130
         */
131
        private LayerEvent(FLayer default1, String property, int eventType) {
132
                source = default1;
133
                this.property = property;
134
                setEventType(eventType);
135
        }
136
137
        /**
138
         * <p>Gets the layer affected.</p>
139
         *
140
         * @return the layer affected
141
         */
142
        public FLayer getSource() {
143
                return source;
144
        }
145
146
        /**
147
         * <p>Sets the layer affected.</p>
148
         *
149
         * @param the layer affected
150
         */
151
        public void setSource(FLayer source) {
152
                this.source = source;
153
        }
154
155
        /**
156
         * <p>Gets the property that has changed.</p>
157
         *
158
         * @return the property that has changed
159
         */
160
        public String getProperty() {
161
                return property;
162
        }
163
164
        /**
165
         * <p>Sets the property that has changed.</p>
166
         *
167
         * @param the property that has changed
168
         */
169
        public void setProperty(String property) {
170
                this.property = property;
171
        }
172
}