svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dataFile / src / org / gvsig / fmap / data / feature / file / FileExplorerParameters.java @ 23602
History | View | Annotate | Download (1.14 KB)
1 |
package org.gvsig.fmap.data.feature.file; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.util.HashMap; |
5 |
import java.util.Map; |
6 |
|
7 |
import org.gvsig.fmap.data.DataExplorerParameters; |
8 |
import org.gvsig.fmap.data.InitializeException; |
9 |
|
10 |
import com.iver.utiles.NotExistInXMLEntity; |
11 |
import com.iver.utiles.XMLEntity; |
12 |
|
13 |
public abstract class FileExplorerParameters extends |
14 |
DataExplorerParameters { |
15 |
|
16 |
|
17 |
protected Map createDefaultValuesMap() { |
18 |
Map defaultValues = new HashMap(1); |
19 |
defaultValues.put("source", null); |
20 |
return defaultValues;
|
21 |
} |
22 |
|
23 |
public void setSource(File source){ |
24 |
this.put("source", source); |
25 |
} |
26 |
|
27 |
public File getSource(){ |
28 |
return (File) this.get("source"); |
29 |
} |
30 |
|
31 |
public XMLEntity getXMLEntity() {
|
32 |
XMLEntity entity = super.getXMLEntity();
|
33 |
entity.putProperty("source", this.getSource().getPath()); |
34 |
return entity;
|
35 |
} |
36 |
|
37 |
public void loadFromXMLEntity(XMLEntity xmlEntity) |
38 |
throws InitializeException {
|
39 |
try {
|
40 |
this.setSource(new File(xmlEntity.getStringProperty("source"))); |
41 |
} catch (NotExistInXMLEntity e) {
|
42 |
throw new InitializeException("source property not set", this |
43 |
.getDataExplorerName()); |
44 |
} |
45 |
|
46 |
} |
47 |
|
48 |
} |