svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.exportto / org.gvsig.exportto.swing / org.gvsig.exportto.swing.prov / org.gvsig.exportto.swing.prov.jdbc / src / main / java / org / gvsig / exportto / swing / prov / jdbc / panel / GeometryIndexPanel.java @ 41638
History | View | Annotate | Download (2.02 KB)
1 | 41638 | jjdelcerro | |
---|---|---|---|
2 | package org.gvsig.exportto.swing.prov.jdbc.panel; |
||
3 | |||
4 | import javax.swing.JComponent; |
||
5 | import org.gvsig.exportto.swing.prov.jdbc.ExporttoJDBCOptions; |
||
6 | import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
||
7 | import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
||
8 | import org.gvsig.fmap.dal.exception.DataException; |
||
9 | import org.gvsig.tools.ToolsLocator; |
||
10 | import org.gvsig.tools.i18n.I18nManager; |
||
11 | import org.slf4j.Logger; |
||
12 | import org.slf4j.LoggerFactory; |
||
13 | |||
14 | |||
15 | public class GeometryIndexPanel extends GeometryIndexPanelLayout implements ExporttoSwingProviderPanel { |
||
16 | private static final long serialVersionUID = -3995015914295698209L; |
||
17 | |||
18 | private static final Logger logger = LoggerFactory.getLogger(GeometryIndexPanel.class); |
||
19 | |||
20 | private ExporttoJDBCOptions provider;
|
||
21 | |||
22 | public GeometryIndexPanel(ExporttoJDBCOptions provider) {
|
||
23 | this.provider = provider;
|
||
24 | initComponents(); |
||
25 | } |
||
26 | |||
27 | private void initComponents() { |
||
28 | int index = -1; |
||
29 | try {
|
||
30 | index = this.provider.getSource().getDefaultFeatureType().getDefaultGeometryAttributeIndex();
|
||
31 | } catch (DataException ex) {
|
||
32 | logger.warn("Problems determining if the tabla has a geometry column",ex);
|
||
33 | } |
||
34 | if( index <0 ) { |
||
35 | this.chkCreateGeometryIndex.setEnabled(false); |
||
36 | this.chkCreateGeometryIndex.setSelected(false); |
||
37 | } else {
|
||
38 | this.chkCreateGeometryIndex.setEnabled(true); |
||
39 | this.chkCreateGeometryIndex.setSelected(true); |
||
40 | } |
||
41 | } |
||
42 | |||
43 | public String getPanelTitle() { |
||
44 | I18nManager i18nManager = ToolsLocator.getI18nManager(); |
||
45 | return i18nManager.getTranslation("Create_geometry_index"); |
||
46 | } |
||
47 | |||
48 | public boolean isValidPanel() throws ExporttoPanelValidationException { |
||
49 | return true; |
||
50 | } |
||
51 | |||
52 | public void enterPanel() { |
||
53 | // Default do nothing
|
||
54 | } |
||
55 | |||
56 | public JComponent asJComponent() { |
||
57 | return this; |
||
58 | } |
||
59 | |||
60 | public boolean getCreateIndexInGeometryRow() { |
||
61 | return this.chkCreateGeometryIndex.isSelected(); |
||
62 | } |
||
63 | } |