svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / layers / LayerEvent.java @ 26438
History | View | Annotate | Download (5.24 KB)
1 | 21200 | vcaballero | /* 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 org.gvsig.fmap.mapcontext.layers; |
||
42 | |||
43 | import org.gvsig.fmap.mapcontext.events.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 | 26225 | jmvivo | public static final int VISIBILITY_CHANGED = 0; |
66 | 21200 | vcaballero | |
67 | /**
|
||
68 | * <p>Identifies this event as a action of change of the activation status of a layer.</p>
|
||
69 | */
|
||
70 | 26225 | jmvivo | public static final int ACTIVATION_CHANGED = 1; |
71 | 21200 | vcaballero | |
72 | /**
|
||
73 | * <p>Identifies this event as a action of a change of the name of a layer.</p>
|
||
74 | */
|
||
75 | 26225 | jmvivo | public static final int NAME_CHANGED = 2; |
76 | 21200 | vcaballero | |
77 | /**
|
||
78 | * <p>Identifies this event as a action of change of the edition status of a layer.</p>
|
||
79 | */
|
||
80 | 26225 | jmvivo | public static final int EDITION_CHANGED = 3; |
81 | |||
82 | /**
|
||
83 | * <p>Identifies this event as a action of change of any property that affects to draw of the layer.</p>
|
||
84 | */
|
||
85 | public static final int DRAW_VALUES_CHANGED = 4; |
||
86 | 21200 | vcaballero | |
87 | /**
|
||
88 | * <p>Creates a new layer event notifying a "visibility changed" action.</p>
|
||
89 | *
|
||
90 | * @param default1 layer affected by the action
|
||
91 | * @param property property that has changed
|
||
92 | *
|
||
93 | * @return a new layer event
|
||
94 | */
|
||
95 | public static LayerEvent createVisibilityChangedEvent(FLyrDefault default1, String property){ |
||
96 | return new LayerEvent(default1, property, VISIBILITY_CHANGED); |
||
97 | } |
||
98 | |||
99 | /**
|
||
100 | * <p>Creates a new layer event notifying an "activation changed" action.</p>
|
||
101 | *
|
||
102 | * @param default1 layer affected by the action
|
||
103 | * @param property property that has changed
|
||
104 | *
|
||
105 | * @return a new layer event
|
||
106 | */
|
||
107 | public static LayerEvent createActivationChangedEvent(FLyrDefault default1, String property){ |
||
108 | return new LayerEvent(default1, property, ACTIVATION_CHANGED); |
||
109 | } |
||
110 | |||
111 | 26225 | jmvivo | public static LayerEvent createDrawValuesChangedEvent(FLyrDefault default1, String property){ |
112 | return new LayerEvent(default1, property, DRAW_VALUES_CHANGED); |
||
113 | } |
||
114 | |||
115 | 21200 | vcaballero | /**
|
116 | * <p>Creates a new layer event notifying an action of "change of the name of a layer".</p>
|
||
117 | *
|
||
118 | * @param default1 layer affected by the action
|
||
119 | * @param property property that has changed
|
||
120 | *
|
||
121 | * @return a new layer event
|
||
122 | */
|
||
123 | public static LayerEvent createNameChangedEvent(FLyrDefault default1, String property){ |
||
124 | return new LayerEvent(default1, property, NAME_CHANGED); |
||
125 | } |
||
126 | |||
127 | /**
|
||
128 | * <p>Creates a new layer event notifying an "edition changed" action.</p>
|
||
129 | *
|
||
130 | * @param default1 layer affected by the action
|
||
131 | * @param property property that has changed
|
||
132 | *
|
||
133 | * @return a new layer event
|
||
134 | */
|
||
135 | public static LayerEvent createEditionChangedEvent(FLyrDefault default1, String property){ |
||
136 | return new LayerEvent(default1, property, EDITION_CHANGED); |
||
137 | } |
||
138 | |||
139 | /**
|
||
140 | * <p>Creates a new layer event of the specified type.</p>
|
||
141 | *
|
||
142 | * @param default1 layer affected by the action
|
||
143 | * @param property property that has changed
|
||
144 | * @param eventType type of layer collection event
|
||
145 | *
|
||
146 | * @return a new layer collection event
|
||
147 | */
|
||
148 | private LayerEvent(FLayer default1, String property, int eventType) { |
||
149 | source = default1; |
||
150 | this.property = property;
|
||
151 | setEventType(eventType); |
||
152 | } |
||
153 | |||
154 | /**
|
||
155 | * <p>Gets the layer affected.</p>
|
||
156 | *
|
||
157 | * @return the layer affected
|
||
158 | */
|
||
159 | public FLayer getSource() {
|
||
160 | return source;
|
||
161 | } |
||
162 | |||
163 | /**
|
||
164 | * <p>Sets the layer affected.</p>
|
||
165 | *
|
||
166 | * @param the layer affected
|
||
167 | */
|
||
168 | public void setSource(FLayer source) { |
||
169 | this.source = source;
|
||
170 | } |
||
171 | |||
172 | /**
|
||
173 | * <p>Gets the property that has changed.</p>
|
||
174 | *
|
||
175 | * @return the property that has changed
|
||
176 | */
|
||
177 | public String getProperty() { |
||
178 | return property;
|
||
179 | } |
||
180 | |||
181 | /**
|
||
182 | * <p>Sets the property that has changed.</p>
|
||
183 | *
|
||
184 | * @param the property that has changed
|
||
185 | */
|
||
186 | public void setProperty(String property) { |
||
187 | this.property = property;
|
||
188 | } |
||
189 | } |