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 @ 40559
History | View | Annotate | Download (4.97 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 | import org.gvsig.fmap.mapcontext.events.FMapEvent; |
||
27 | |||
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 | public class LayerEvent extends FMapEvent { |
||
35 | /**
|
||
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 | |||
55 | /**
|
||
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 | |||
60 | /**
|
||
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 | *
|
||
73 | * @param default1 layer affected by the action
|
||
74 | * @param property property that has changed
|
||
75 | *
|
||
76 | * @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 | *
|
||
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 createActivationChangedEvent(FLyrDefault default1, String property){ |
||
91 | return new LayerEvent(default1, property, ACTIVATION_CHANGED); |
||
92 | } |
||
93 | |||
94 | 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 | *
|
||
101 | * @param default1 layer affected by the action
|
||
102 | * @param property property that has changed
|
||
103 | *
|
||
104 | * @return a new layer event
|
||
105 | */
|
||
106 | public static LayerEvent createNameChangedEvent(FLyrDefault default1, String property){ |
||
107 | return new LayerEvent(default1, property, NAME_CHANGED); |
||
108 | } |
||
109 | |||
110 | /**
|
||
111 | * <p>Creates a new layer event notifying an "edition changed" action.</p>
|
||
112 | *
|
||
113 | * @param default1 layer affected by the action
|
||
114 | * @param property property that has changed
|
||
115 | *
|
||
116 | * @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 | |||
122 | /**
|
||
123 | * <p>Creates a new layer event of the specified type.</p>
|
||
124 | *
|
||
125 | * @param default1 layer affected by the action
|
||
126 | * @param property property that has changed
|
||
127 | * @param eventType type of layer collection event
|
||
128 | *
|
||
129 | * @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 | } |