Revision 44079 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/test/java/org/gvsig/fmap/dal/swing/impl/featuretype/Test.java
Test.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.swing.impl.featuretype; |
2 | 2 |
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import org.gvsig.fmap.crs.CRSFactory; |
|
6 |
import org.gvsig.fmap.dal.DALLocator; |
|
7 |
import org.gvsig.fmap.dal.DataManager; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
3 | 9 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
4 | 10 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
5 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureTypePanel; |
|
6 | 11 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
7 |
import org.gvsig.tools.swing.api.Component; |
|
8 | 12 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
9 | 13 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
10 | 14 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
... | ... | |
19 | 23 |
/** |
20 | 24 |
* @param args the command line arguments |
21 | 25 |
*/ |
22 |
public static void main(String[] args) { |
|
26 |
public static void main(String[] args) throws Exception {
|
|
23 | 27 |
Test test = new Test(); |
24 | 28 |
new DefaultLibrariesInitializer().fullInitialize(); |
25 | 29 |
test.run(); |
26 | 30 |
} |
27 | 31 |
|
28 |
public void run() { |
|
32 |
public void run() throws Exception {
|
|
29 | 33 |
WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
30 | 34 |
DataSwingManager manager = DALSwingLocator.getSwingManager(); |
31 | 35 |
|
32 |
Component panel = new DefaultFeatureTypePanel(); |
|
36 |
URL resource = this.getClass().getResource("/org/gvsig/esp_comaut/esp_comaut.dbf"); |
|
37 |
FeatureStore store = openShape(resource); |
|
38 |
FeatureTypePanel panel = new DefaultFeatureTypePanel(); |
|
39 |
panel.put(store.getDefaultFeatureType()); |
|
40 |
|
|
33 | 41 |
Dialog dialog = windowManager.createDialog( |
34 | 42 |
panel.asJComponent(), |
35 | 43 |
"Test", |
... | ... | |
38 | 46 |
); |
39 | 47 |
dialog.show(WindowManager.MODE.WINDOW); |
40 | 48 |
} |
41 |
|
|
49 |
|
|
50 |
public FeatureStore openShape(URL resource) throws Exception { |
|
51 |
DataManager dataManager = DALLocator.getDataManager(); |
|
52 |
FeatureStore store = (FeatureStore) dataManager.openStore( |
|
53 |
"DBF", |
|
54 |
"dbffile", new File(resource.toURI()) |
|
55 |
// "CRS", CRSFactory.getCRS("EPSG:23030") |
|
56 |
); |
|
57 |
return store; |
|
58 |
} |
|
42 | 59 |
} |
Also available in: Unified diff