Revision 23543 branches/v2_0_0_prep/libraries/libFMap_dataFile/src/org/gvsig/fmap/data/feature/file/FileExplorerParameters.java

View differences:

FileExplorerParameters.java
1 1
package org.gvsig.fmap.data.feature.file;
2 2

  
3 3
import java.io.File;
4
import java.util.HashMap;
5
import java.util.Map;
4 6

  
5 7
import org.gvsig.fmap.data.AbstractDataExplorerParameters;
6 8
import org.gvsig.fmap.data.DataManager;
......
12 14

  
13 15
public abstract class FileExplorerParameters extends
14 16
		AbstractDataExplorerParameters {
17
	private Map internalMap;
18

  
15 19
	protected File source;
16 20

  
17 21
	public void setSource(File source){
18 22
		this.source = source;
23
		this.clearInternalMap();
19 24
	}
20 25

  
21 26
	public File getSource(){
......
44 49
				this.getXMLEntity());
45 50
	}
46 51

  
52
	public void clear() {
53
		this.source = null;
54
		this.clearInternalMap();
55
	}
56

  
57
	protected Map getInternalMap() {
58
		if (this.internalMap == null) {
59
			this.internalMap = new HashMap(1);
60
		}
61
		if (this.internalMap.size() == 0) {
62
			this.internalMap.put("source", this.source);
63
		}
64
		return this.internalMap;
65
	}
66

  
67
	public Object put(Object key, Object value) {
68
		if (!(key instanceof String)) {
69
			throw new ClassCastException("key must be String");
70

  
71
		}
72
		String sKey = (String) key;
73
		Object rValue = null;
74
		if (sKey.equalsIgnoreCase("source")) {
75
			rValue = this.source;
76
			this.source = (File) value;
77
		} else {
78
			throw new IllegalArgumentException("key:" + sKey);
79
		}
80
		this.clearInternalMap();
81
		return rValue;
82
	}
83

  
84
	protected void clearInternalMap() {
85
		if (this.internalMap != null) {
86
			this.internalMap.clear();
87
		}
88

  
89
	}
90

  
47 91
}

Also available in: Unified diff