Revision 21743 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/addlayer/fileopen/vectorial/VectorialFileFilter.java
VectorialFileFilter.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
import javax.swing.filechooser.FileFilter; |
24 | 24 |
|
25 |
import org.gvsig.fmap.drivers.reading.VectorialFileDriver; |
|
25 |
import org.gvsig.data.DataManager; |
|
26 |
import org.gvsig.data.DataStoreParameters; |
|
27 |
import org.gvsig.data.InitializeException; |
|
28 |
import org.gvsig.data.datastores.vectorial.file.FileStoreParameters; |
|
29 |
import org.gvsig.data.vectorial.FeatureStore; |
|
26 | 30 |
import org.gvsig.fmap.mapcontext.layers.LayerFactory; |
27 | 31 |
|
28 |
import com.hardcode.driverManager.Driver; |
|
29 |
import com.hardcode.driverManager.DriverLoadException; |
|
30 |
import com.hardcode.gdbms.engine.data.driver.FileDriver; |
|
31 | 32 |
/** |
32 | 33 |
* Clase para definir que ficheros aceptara la extension vectorial, es necesario |
33 | 34 |
* para el JFileChooser |
34 |
*
|
|
35 |
* |
|
35 | 36 |
* @version 05/09/2007 |
36 | 37 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
37 | 38 |
*/ |
38 | 39 |
public class VectorialFileFilter extends FileFilter { |
39 |
public Driver driver = null;
|
|
40 |
public FeatureStore featureStore = null;
|
|
40 | 41 |
|
41 |
public VectorialFileFilter(String driverName) throws DriverLoadException { |
|
42 |
driver = LayerFactory.getDM().getDriver(driverName); |
|
42 |
public VectorialFileFilter(String name) throws InitializeException { |
|
43 |
DataManager dm=DataManager.getManager(); |
|
44 |
DataStoreParameters params=dm.createDataStoreParameters(name); |
|
45 |
featureStore = (FeatureStore)dm.createDataStore(params); |
|
43 | 46 |
} |
44 | 47 |
|
45 | 48 |
/** |
... | ... | |
49 | 52 |
if (f.isDirectory()) |
50 | 53 |
return true; |
51 | 54 |
|
52 |
if (driver instanceof VectorialFileDriver)
|
|
53 |
return ((VectorialFileDriver) driver).accept(f);
|
|
55 |
if (featureStore.getParameters() instanceof FileStoreParameters)
|
|
56 |
return ((FileStoreParameters)featureStore.getParameters()).fileAccept(f);
|
|
54 | 57 |
|
55 |
if (driver instanceof FileDriver) |
|
56 |
return ((FileDriver) driver).fileAccepted(f); |
|
58 |
// if (driver instanceof FileDriver)
|
|
59 |
// return ((FileDriver) driver).fileAccepted(f);
|
|
57 | 60 |
|
58 | 61 |
throw new RuntimeException("Tipo no reconocido"); |
59 | 62 |
} |
... | ... | |
62 | 65 |
* @see javax.swing.filechooser.FileFilter#getDescription() |
63 | 66 |
*/ |
64 | 67 |
public String getDescription() { |
65 |
return ((Driver) driver).getName();
|
|
68 |
return featureStore.getName();
|
|
66 | 69 |
} |
67 | 70 |
} |
Also available in: Unified diff