svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.exportto.app / org.gvsig.exportto.app.mainplugin / src / main / java / org / gvsig / export / app / extension / FeatureStoreSearchExportAction.java @ 46104
History | View | Annotate | Download (2.77 KB)
1 | 44263 | jjdelcerro | package org.gvsig.export.app.extension; |
---|---|---|---|
2 | |||
3 | import java.awt.event.ActionEvent; |
||
4 | import javax.swing.AbstractAction; |
||
5 | import javax.swing.Action; |
||
6 | 44281 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureStore; |
7 | import org.gvsig.fmap.dal.swing.AbstractDALActionFactory; |
||
8 | 44263 | jjdelcerro | import org.gvsig.fmap.dal.swing.DALSwingLocator; |
9 | import org.gvsig.fmap.dal.swing.DataSwingManager; |
||
10 | import org.gvsig.tools.ToolsLocator; |
||
11 | import org.gvsig.tools.i18n.I18nManager; |
||
12 | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
||
13 | import org.slf4j.Logger; |
||
14 | import org.slf4j.LoggerFactory; |
||
15 | 44281 | jjdelcerro | import org.gvsig.fmap.dal.swing.DALActionFactory.DALActionContext; |
16 | 44263 | jjdelcerro | |
17 | /**
|
||
18 | *
|
||
19 | * @author jjdelcerro
|
||
20 | */
|
||
21 | public class FeatureStoreSearchExportAction |
||
22 | extends AbstractAction |
||
23 | { |
||
24 | |||
25 | 44281 | jjdelcerro | public static class FeatureStoreSearchExportActionFactory extends AbstractDALActionFactory { |
26 | 44263 | jjdelcerro | |
27 | 44281 | jjdelcerro | public static final String ACTION_NAME = "Export"; |
28 | |||
29 | public FeatureStoreSearchExportActionFactory() {
|
||
30 | super(ACTION_NAME);
|
||
31 | 44263 | jjdelcerro | } |
32 | 44281 | jjdelcerro | |
33 | 44263 | jjdelcerro | @Override
|
34 | 44281 | jjdelcerro | public Action createAction(DALActionContext context) { |
35 | return new FeatureStoreSearchExportAction(context); |
||
36 | 44263 | jjdelcerro | } |
37 | |||
38 | public static void selfRegister() { |
||
39 | DataSwingManager dalSwingManager = DALSwingLocator.getSwingManager(); |
||
40 | 44281 | jjdelcerro | dalSwingManager.registerStoreAction(new FeatureStoreSearchExportActionFactory());
|
41 | 44263 | jjdelcerro | } |
42 | |||
43 | } |
||
44 | |||
45 | private static final Logger LOGGER = LoggerFactory.getLogger(FeatureStoreSearchExportAction.class); |
||
46 | |||
47 | 44281 | jjdelcerro | private final DALActionContext context; |
48 | 44263 | jjdelcerro | |
49 | 44281 | jjdelcerro | public FeatureStoreSearchExportAction(DALActionContext context) {
|
50 | this.context = context;
|
||
51 | 44263 | jjdelcerro | I18nManager i18n = ToolsLocator.getI18nManager(); |
52 | this.putValue(
|
||
53 | 44281 | jjdelcerro | Action.ACTION_COMMAND_KEY,
|
54 | FeatureStoreSearchExportActionFactory.ACTION_NAME |
||
55 | ); |
||
56 | this.putValue(
|
||
57 | 44263 | jjdelcerro | Action.SHORT_DESCRIPTION,
|
58 | i18n.getTranslation("_Export")
|
||
59 | ); |
||
60 | this.putValue(
|
||
61 | Action.SMALL_ICON,
|
||
62 | ToolsSwingLocator.getIconThemeManager().getCurrent().get("table-export")
|
||
63 | ); |
||
64 | } |
||
65 | |||
66 | @Override
|
||
67 | public void actionPerformed(ActionEvent e) { |
||
68 | 44281 | jjdelcerro | if( !(this.context.getStore() instanceof FeatureStore) ) { |
69 | return;
|
||
70 | 46104 | omartinez | } |
71 | 44263 | jjdelcerro | ExportTable exportTable = new ExportTable();
|
72 | 46104 | omartinez | // FeatureQuery query = this.context.getQuery();
|
73 | // if (this.context.getFilterForSelecteds()!=null) {
|
||
74 | // query.addFilter(this.context.getFilterForSelecteds().toString());
|
||
75 | // }
|
||
76 | |||
77 | // exportTable.showExport(
|
||
78 | // (FeatureStore) this.context.getStore(),
|
||
79 | // query
|
||
80 | // );
|
||
81 | 44263 | jjdelcerro | exportTable.showExport( |
82 | 44281 | jjdelcerro | (FeatureStore) this.context.getStore(),
|
83 | 44712 | jjdelcerro | this.context.getQuery()
|
84 | 44263 | jjdelcerro | ); |
85 | } |
||
86 | |||
87 | |||
88 | } |