Revision 13980 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLayerStatus.java

View differences:

FLayerStatus.java
45 45
*
46 46
* $Id$
47 47
* $Log$
48
* Revision 1.1.2.3  2007-02-21 08:57:28  fjp
48
* Revision 1.1.2.4  2007-09-24 12:03:13  ppiqueras
49
* Translated comments to English language and add new ones.
50
*
51
* Revision 1.1.2.3  2007/02/21 08:57:28  fjp
49 52
* Bug con el driver loaded corregido. Afectaba a los eventos de capas
50 53
*
51 54
* Revision 1.1.2.2  2007/02/20 08:51:20  fjp
......
65 68
import java.util.List;
66 69

  
67 70
import com.iver.cit.gvsig.fmap.DriverException;
68
import com.iver.cit.gvsig.fmap.ErrorEvent;
69 71

  
70 72
/**
71
 * Default layer status implementation.
73
 * <p>All <i>fmap</i> layers can be in a set of states, that their combination represent the status of a layer.</p>
72 74
 * 
73
 * We are trying to model the status of a layer in an object,
74
 * to get more clarity.
75
 * <p>The <code>FLayerStatus</code> class supports the common status for all kind of {@link FLyrDefault FLyrDefault} layers.</p>
75 76
 * 
77
 * <p>This means that not necessarily all layers can stay in all possible status, it depends on its particular
78
 * constitution.</p>
79
 * 
80
 * <p>Layer status states defined:
81
 *  <ul>
82
 *  <li><i><b>Available</b></i>: the layer is available if the source of its data is on-line.</li>
83
 *  <li><i><b>Visible</b></i>: one layer is visible if it's selected its <i>check box</i> associated in TOC. This implies that 
84
 *  layer will tried to be painted unless the necessary data would be unavailable; this situation is more frequent with layers of
85
 *  remote services.</li>
86
 *  <li><i><b>Active</b></i>: the layer is active if it's selected at the TOC.</li>
87
 *  <li><i><b>Dirty</b></i>: one layer is dirty if needs to be refreshed.</li>
88
 *  <li><i><b>In TOC</b></i>: the layer is in TOC if it's at the view's TOC's tree of layers.</li>
89
 *  <li><i><b>Editing</b></i>: if the layer it's being edited now.</li>
90
 *  <li><i><b>Writable</b></i>: if can be modified and saved the changes.</li>
91
 *  <li><i><b>Cache drawn layers</b></i>: this state reports if the layer stores previous draws. This is useful to accelerate the draw of the layer.</li>
92
 *  <li><i><b>Driver loaded</b></i>: this state reports if the driver for managing the layer has been loaded successfully.</li>
93
 *  </ul>
94
 * </p>
95
 * 
96
 * @see IFLayerStatus
97
 * 
76 98
 * @author azabala
77
 *
78 99
 */
79 100
public class FLayerStatus implements IFLayerStatus {
80

  
81
	 public boolean available;
82
	 public boolean visible;
83
	 public boolean active;
84
	 public boolean dirty;
85
	 public boolean inTOC;
86
	 public boolean editing;
87
	 public boolean writable;
88
	 public boolean cacheDrawnLayers;
89
	 private boolean driverLoaded;
90
	 public boolean enabled;
101
	/**
102
	 * <p>Layer's availability: the layer is available if the source of its data is on-line.</p>
103
	 */
104
	public boolean available;
91 105
	
92
	 private ArrayList layerErrors;
106
	/**
107
	 * <p>Layer's visibility: the layer is visible if it's selected its <i>check box</i> associated in TOC. This implies that 
108
	 *  layer will tried to be painted unless the necessary data would be unavailable; this situation is more frequent with layers of
109
	 *  remote services.</p>
110
	 */
111
	public boolean visible;
93 112
	
113
	/**
114
	 * <p>The layer is active if it's selected at the TOC.</p>
115
	 */
116
	public boolean active;
117
	
118
	/**
119
	 * <p>One layer is dirty if needs to be refreshed.</p>
120
	 */
121
	public boolean dirty;
122
	
123
	/**
124
	 * <p>The layer is in TOC if it's at the view's TOC's tree of layers.</p>
125
	 */
126
	public boolean inTOC;
127
	
128
	/**
129
	 * <p>This parameter reports if the layer it's being edited now.</p>
130
	 */
131
	public boolean editing;
132
	
133
	/**
134
	 * <p>This parameter reports if the layer can be modified and saved the changes.</p>
135
	 */
136
	public boolean writable;
137
	
138
	/**
139
	 * <p>This state reports if the layer stores previous draws. That's useful to accelerate the draw of the layer.</p>
140
	 */
141
	public boolean cacheDrawnLayers;
142
	
143
	/**
144
	 * <p>This state reports if the driver for managing the layer has been loaded successfully.</p>
145
	 */
146
	private boolean driverLoaded;
147
	
148
	/**
149
	 * 
150
	 */
151
	public boolean enabled;
152
	
153
	/**
154
	 * <p>List with the information of the driver errors produced working this layer.</p>
155
	 */
156
	private ArrayList layerErrors;
157

  
158
	/**
159
	 * <p>Creates an instance with the default status of a {@link FLyrDefault FLyrDefault} layer:
160
	 *  <ul>
161
	 *  <li><b><i>Visible</i></b>: <code>true</code> .</li>
162
	 *  <li><b><i>Active</i></b>: <code>false</code> .</li>
163
	 *  <li><b><i>In TOC</i></b>: <code>true</code> .</li>
164
	 *  <li><b><i>Editing</i></b>: <code>false</code> .</li>
165
	 *  <li><b><i>Cache drawn layers</i></b>: <code>false</code> .</li>
166
	 *  <li><b><i>Dirty</i></b>: <code>false</code> .</li>
167
	 *  <li><b><i>Available</i></b>: <code>true</code> .</li>
168
	 *  <li><b><i>Driver loaded</i></b>: <code>true</code> .</li>
169
	 *  <li><b><i>Writable</i></b>: <code>false</code> .</li>
170
	 *  <li>Without driver errors.</li>
171
	 *  </ul>
172
	 * </p>
173
	 */
94 174
	public FLayerStatus(){
95 175
		this.layerErrors = new ArrayList();
96 176
		visible = true;
......
104 184
		writable = false;
105 185
		
106 186
	}
107
	
187

  
188
	/**
189
	 * <p>Stores information of an exception produced working with a driver of the layer.</p>
190
	 * 
191
	 * @param error the driver exception
192
	 */
108 193
	public void addLayerError(DriverException error){
109 194
		layerErrors.add(error);
110 195
	}
111
	
196

  
197
	/**
198
	 * <p>Gets the number of driver exceptions produced working with the layer.</p>
199
	 * 
200
	 * @return number of driver exceptions produced
201
	 */
112 202
	public int getNumErrors(){
113 203
		return layerErrors.size();
114 204
	}
115
	
205

  
206
	/**
207
	 * <p>Gets the information of the <i>nth</i> layer driver exception registered in the status.</p>
208
	 * 
209
	 * @param i ith layer exception registered
210
	 * 
211
	 * @return the <i>nth</i> layer driver exception registered
212
	 */
116 213
	public DriverException getError(int i){
117 214
		return (DriverException) layerErrors.get(i);
118 215
	}
119
	
216

  
217
	/**
218
	 * <p>Returns if there have been driver errors working with the layer.</p>
219
	 * 
220
	 * @return <code>true</code> if there have driver errors working with the layer; <code>false</code> otherwise
221
	 */
120 222
	public boolean isOk(){
121 223
		return layerErrors.size() == 0;
122 224
	}
123 225

  
226
	/**
227
	 * <p>Returns a list with the driver errors produced in a layer.</p>
228
	 * 
229
	 * @return list with the driver errors produced in a layer
230
	 */
124 231
	public List getErrors() {
125 232
		return layerErrors;
126 233
	}
127 234

  
235
	/**
236
	 * <p>Returns if has been loaded successfully the driver for managing the layer.</p>
237
	 * 
238
	 * @return <code>true</code> if has been loaded successfully the driver for managing the layer; <code>false</code> otherwise
239
	 */
128 240
	public boolean isDriverLoaded() {
129 241
		return driverLoaded;
130 242
	}
131 243

  
244
	/**
245
	 * <p>Sets if has been loaded successfully the driver for managing the layer.</p>
246
	 * 
247
	 * @param driverLoaded <code>true</code> if has been loaded successfully the driver for managing the layer; <code>false</code> otherwise
248
	 */
132 249
	public void setDriverLoaded(boolean driverLoaded) {
133 250
		this.driverLoaded = driverLoaded;
134 251
	}
135
	
136
}
137

  
252
}

Also available in: Unified diff