Revision 43215 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/FLayerStatus.java

View differences:

FLayerStatus.java
106 106
	 */
107 107
	public boolean cacheDrawnLayers;
108 108

  
109
	private boolean temporal = false;
109
//	private boolean temporal = false;
110 110
	/**
111 111
	 * <p>List with the information of the driver errors produced working this layer.</p>
112 112
	 */
113
	private List layerErrors;
113
	private final List<Throwable> layerErrors;
114 114
		
115 115
	/**
116 116
	 * <p>This state reports if the driver for managing the layer has been loaded successfully.</p>
......
135 135
	 * </p>
136 136
	 */
137 137
	public FLayerStatus(){
138
		this.layerErrors = new ArrayList();
138
		this.layerErrors = new ArrayList<>();
139 139
		visible = true;
140 140
		active = false;
141 141
		inTOC = true;
......
153 153
	 * 
154 154
	 * @param error the driver exception
155 155
	 */
156
	public void addLayerError(BaseException error){
156
	public void addLayerError(Throwable error){
157 157
		layerErrors.add(error);
158 158
	}
159 159

  
160
        public void setLayerError(Exception ex) {
160
        public void setLayerError(Throwable ex) {
161 161
            layerErrors.clear();
162 162
            layerErrors.add(ex);
163 163
        }
......
177 177
	
178 178
		return newStatus;
179 179
	}
180
	
181
	
182 180

  
181
	@Override
183 182
	public boolean equals(Object obj) {
184 183
		FLayerStatus other;
185 184
		if (obj instanceof FLayerStatus) {
......
223 222
	 * 
224 223
	 * @return the <i>nth</i> layer driver exception registered
225 224
	 */
226
	public BaseException getError(int i){
227
		return (BaseException) layerErrors.get(i);
225
	public Throwable getError(int i){
226
		return layerErrors.get(i);
228 227
	}
229 228

  
230 229
	/**
......
233 232
	 * @return <code>true</code> if there have driver errors working with the layer; otherwise <code>false</code>
234 233
	 */
235 234
	public boolean isOk(){
236
		return layerErrors.size() == 0;
235
		return layerErrors.isEmpty();
237 236
	}
238 237

  
239 238
	/**
......
241 240
	 * 
242 241
	 * @return list errors produced in a layer working with its driver
243 242
	 */
244
	public List getErrors() {
243
	public List<Throwable> getErrors() {
245 244
		return layerErrors;
246 245
	}
247 246
        
......
263 262
		this.driverLoaded = driverLoaded;
264 263
	}
265 264

  
265
	@Override
266 266
	public void loadFromState(PersistentState state)
267 267
			throws PersistenceException {
268 268

  
......
277 277
		driverLoaded = state.getBoolean("driverLoaded");
278 278
	}
279 279

  
280
	@Override
280 281
	public void saveToState(PersistentState state) throws PersistenceException {
281 282
		
282 283
		state.set("visible", visible);
......
292 293
	
293 294
    public static class RegisterPersistence implements Callable {
294 295

  
296
		@Override
295 297
        public Object call() {
296
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
297
		DynStruct definition = manager.addDefinition(
298
			PersistenceManager manager = ToolsLocator.getPersistenceManager();
299
			DynStruct definition = manager.addDefinition(
298 300
				FLayerStatus.class,
299 301
				"FLayerStatus",
300 302
				"FLayerStatus Persistence definition",
301
				null, 
303
				null,
302 304
				null
303
		);
304
		definition.addDynFieldBoolean("visible").setMandatory(true);
305
		definition.addDynFieldBoolean("active").setMandatory(true);
306
		definition.addDynFieldBoolean("inTOC").setMandatory(true);
307
		definition.addDynFieldBoolean("editing").setMandatory(true);
308
		definition.addDynFieldBoolean("cacheDrawnLayers").setMandatory(true);
309
		definition.addDynFieldBoolean("dirty").setMandatory(true);
310
		definition.addDynFieldBoolean("available").setMandatory(true);
311
		definition.addDynFieldBoolean("writable").setMandatory(true);
312
		definition.addDynFieldBoolean("driverLoaded").setMandatory(true);
313
		//definition.addDynFieldBoolean("locked").setMandatory(true);
314
            
315
            return Boolean.TRUE;
316
        }
305
			);
306
			definition.addDynFieldBoolean("visible").setMandatory(true);
307
			definition.addDynFieldBoolean("active").setMandatory(true);
308
			definition.addDynFieldBoolean("inTOC").setMandatory(true);
309
			definition.addDynFieldBoolean("editing").setMandatory(true);
310
			definition.addDynFieldBoolean("cacheDrawnLayers").setMandatory(true);
311
			definition.addDynFieldBoolean("dirty").setMandatory(true);
312
			definition.addDynFieldBoolean("available").setMandatory(true);
313
			definition.addDynFieldBoolean("writable").setMandatory(true);
314
			definition.addDynFieldBoolean("driverLoaded").setMandatory(true);
315
			//definition.addDynFieldBoolean("locked").setMandatory(true);
316

  
317
			return Boolean.TRUE;
318
		}
317 319
    }
318 320
}
319 321

  

Also available in: Unified diff