svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_data_dwg / src / org / gvsig / fmap / data / feature / file / dwg / DWGStoreParameters.java @ 23233
History | View | Annotate | Download (1.53 KB)
1 |
package org.gvsig.fmap.data.feature.file.dwg; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
|
5 |
import org.gvsig.fmap.data.AbstractDataStoreParameters; |
6 |
import org.gvsig.fmap.data.InitializeException; |
7 |
import org.gvsig.fmap.data.feature.file.FileStoreParameters; |
8 |
|
9 |
import com.iver.utiles.NotExistInXMLEntity; |
10 |
import com.iver.utiles.XMLEntity; |
11 |
|
12 |
|
13 |
public class DWGStoreParameters extends AbstractDataStoreParameters implements |
14 |
FileStoreParameters { |
15 |
private File dwgfile; |
16 |
public String getDataStoreName() { |
17 |
return DWGStore.DATASTORE_NAME;
|
18 |
} |
19 |
public boolean isValid() { |
20 |
return dwgfile != null; |
21 |
} |
22 |
/* (non-Javadoc)
|
23 |
* @see org.gvsig.fmap.data.feature.file.FileStoreParameters#getFile()
|
24 |
*/
|
25 |
public File getFile() { |
26 |
return dwgfile;
|
27 |
} |
28 |
/* (non-Javadoc)
|
29 |
* @see org.gvsig.fmap.data.feature.file.FileStoreParameters#setFile(java.io.File)
|
30 |
*/
|
31 |
public void setFile(File aFile) { |
32 |
this.dwgfile = aFile;
|
33 |
} |
34 |
public boolean fileAccept(File f) { |
35 |
return f.getAbsolutePath().toLowerCase().endsWith(".dwg"); |
36 |
} |
37 |
|
38 |
public String getDescription() { |
39 |
return "DWG File"; |
40 |
} |
41 |
|
42 |
|
43 |
public XMLEntity getXMLEntity() {
|
44 |
XMLEntity xmlEntity = super.getXMLEntity();
|
45 |
xmlEntity.putProperty("dwgfile", this.dwgfile.getPath()); |
46 |
return xmlEntity;
|
47 |
} |
48 |
|
49 |
public void loadFromXMLEntity(XMLEntity xmlEntity) |
50 |
throws InitializeException {
|
51 |
try {
|
52 |
this.dwgfile = new File(xmlEntity.getStringProperty("dwgfile")); |
53 |
} catch (NotExistInXMLEntity e) {
|
54 |
throw new InitializeException("dwnfile property not found", this |
55 |
.getDataStoreName()); |
56 |
} |
57 |
} |
58 |
|
59 |
} |