svn-gvsig-desktop / 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 / TestEditable.java @ 44096
History | View | Annotate | Download (2.09 KB)
1 | 44077 | jjdelcerro | package org.gvsig.fmap.dal.swing.impl.featuretype; |
---|---|---|---|
2 | |||
3 | 44096 | jjdelcerro | import org.gvsig.fmap.dal.swing.featuretype.FeatureTypePanel; |
4 | 44079 | jjdelcerro | import java.io.File; |
5 | import java.net.URL; |
||
6 | import org.gvsig.fmap.dal.DALLocator; |
||
7 | import org.gvsig.fmap.dal.DataManager; |
||
8 | import org.gvsig.fmap.dal.feature.FeatureStore; |
||
9 | 44077 | jjdelcerro | import org.gvsig.fmap.dal.swing.DALSwingLocator; |
10 | import org.gvsig.fmap.dal.swing.DataSwingManager; |
||
11 | import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
||
12 | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
||
13 | import org.gvsig.tools.swing.api.windowmanager.Dialog; |
||
14 | import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
||
15 | import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
||
16 | |||
17 | /**
|
||
18 | *
|
||
19 | * @author jjdelcerro
|
||
20 | */
|
||
21 | 44085 | jjdelcerro | public class TestEditable { |
22 | 44077 | jjdelcerro | |
23 | /**
|
||
24 | * @param args the command line arguments
|
||
25 | */
|
||
26 | 44079 | jjdelcerro | public static void main(String[] args) throws Exception { |
27 | 44085 | jjdelcerro | TestEditable test = new TestEditable();
|
28 | 44077 | jjdelcerro | new DefaultLibrariesInitializer().fullInitialize();
|
29 | test.run(); |
||
30 | } |
||
31 | |||
32 | 44079 | jjdelcerro | public void run() throws Exception { |
33 | 44077 | jjdelcerro | WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
34 | DataSwingManager manager = DALSwingLocator.getSwingManager(); |
||
35 | |||
36 | 44079 | jjdelcerro | URL resource = this.getClass().getResource("/org/gvsig/esp_comaut/esp_comaut.dbf"); |
37 | FeatureStore store = openShape(resource); |
||
38 | FeatureTypePanel panel = new DefaultFeatureTypePanel();
|
||
39 | 44085 | jjdelcerro | panel.put(store.getDefaultFeatureType().getEditable()); |
40 | 44079 | jjdelcerro | |
41 | 44077 | jjdelcerro | Dialog dialog = windowManager.createDialog(
|
42 | panel.asJComponent(), |
||
43 | "Test",
|
||
44 | null,
|
||
45 | WindowManager_v2.BUTTONS_OK_CANCEL |
||
46 | ); |
||
47 | dialog.show(WindowManager.MODE.WINDOW); |
||
48 | } |
||
49 | 44079 | jjdelcerro | |
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 | } |
||
59 | 44077 | jjdelcerro | } |