root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / LayerEvent.java @ 24160
History | View | Annotate | Download (4.95 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 |
private static final int DRAW_VALUES_CHANGED = 4; |
82 |
|
83 |
/**
|
84 |
* <p>Creates a new layer event notifying a "visibility changed" action.</p>
|
85 |
*
|
86 |
* @param default1 layer affected by the action
|
87 |
* @param property property that has changed
|
88 |
*
|
89 |
* @return a new layer event
|
90 |
*/
|
91 |
public static LayerEvent createVisibilityChangedEvent(FLyrDefault default1, String property){ |
92 |
return new LayerEvent(default1, property, VISIBILITY_CHANGED); |
93 |
} |
94 |
|
95 |
/**
|
96 |
* <p>Creates a new layer event notifying an "activation changed" action.</p>
|
97 |
*
|
98 |
* @param default1 layer affected by the action
|
99 |
* @param property property that has changed
|
100 |
*
|
101 |
* @return a new layer event
|
102 |
*/
|
103 |
public static LayerEvent createActivationChangedEvent(FLyrDefault default1, String property){ |
104 |
return new LayerEvent(default1, property, ACTIVATION_CHANGED); |
105 |
} |
106 |
|
107 |
public static LayerEvent createDrawValuesChangedEvent(FLyrDefault default1, String property){ |
108 |
return new LayerEvent(default1, property, DRAW_VALUES_CHANGED); |
109 |
} |
110 |
|
111 |
/**
|
112 |
* <p>Creates a new layer event notifying an action of "change of the name of a layer".</p>
|
113 |
*
|
114 |
* @param default1 layer affected by the action
|
115 |
* @param property property that has changed
|
116 |
*
|
117 |
* @return a new layer event
|
118 |
*/
|
119 |
public static LayerEvent createNameChangedEvent(FLyrDefault default1, String property){ |
120 |
return new LayerEvent(default1, property, NAME_CHANGED); |
121 |
} |
122 |
|
123 |
/**
|
124 |
* <p>Creates a new layer event notifying an "edition changed" action.</p>
|
125 |
*
|
126 |
* @param default1 layer affected by the action
|
127 |
* @param property property that has changed
|
128 |
*
|
129 |
* @return a new layer event
|
130 |
*/
|
131 |
public static LayerEvent createEditionChangedEvent(FLyrDefault default1, String property){ |
132 |
return new LayerEvent(default1, property, EDITION_CHANGED); |
133 |
} |
134 |
|
135 |
/**
|
136 |
* <p>Creates a new layer event of the specified type.</p>
|
137 |
*
|
138 |
* @param default1 layer affected by the action
|
139 |
* @param property property that has changed
|
140 |
* @param eventType type of layer collection event
|
141 |
*
|
142 |
* @return a new layer collection event
|
143 |
*/
|
144 |
private LayerEvent(FLayer default1, String property, int eventType) { |
145 |
source = default1; |
146 |
this.property = property;
|
147 |
setEventType(eventType); |
148 |
} |
149 |
|
150 |
/**
|
151 |
* <p>Gets the layer affected.</p>
|
152 |
*
|
153 |
* @return the layer affected
|
154 |
*/
|
155 |
public FLayer getSource() {
|
156 |
return source;
|
157 |
} |
158 |
|
159 |
/**
|
160 |
* <p>Sets the layer affected.</p>
|
161 |
*
|
162 |
* @param the layer affected
|
163 |
*/
|
164 |
public void setSource(FLayer source) { |
165 |
this.source = source;
|
166 |
} |
167 |
|
168 |
/**
|
169 |
* <p>Gets the property that has changed.</p>
|
170 |
*
|
171 |
* @return the property that has changed
|
172 |
*/
|
173 |
public String getProperty() { |
174 |
return property;
|
175 |
} |
176 |
|
177 |
/**
|
178 |
* <p>Sets the property that has changed.</p>
|
179 |
*
|
180 |
* @param the property that has changed
|
181 |
*/
|
182 |
public void setProperty(String property) { |
183 |
this.property = property;
|
184 |
} |
185 |
} |