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 / export / jdbc / swing / panels / IdentifiersOptionsPanel.java @ 46542
History | View | Annotate | Download (4.23 KB)
1 |
/*
|
---|---|
2 |
* To change this license header, choose License Headers in Project Properties.
|
3 |
* To change this template file, choose Tools | Templates
|
4 |
* and open the template in the editor.
|
5 |
*/
|
6 |
package org.gvsig.export.jdbc.swing.panels; |
7 |
|
8 |
import javax.swing.JComponent; |
9 |
import org.gvsig.export.jdbc.service.ExportJDBCParameters; |
10 |
import org.gvsig.export.swing.JExportProcessPanel; |
11 |
import org.gvsig.export.swing.spi.ExportPanel; |
12 |
import org.gvsig.export.swing.spi.ExportPanelValidationException; |
13 |
import static org.gvsig.fmap.dal.store.jdbc2.JDBCStoreProviderFactory.CASE_IDENTIFIERS_INDIFERENT; |
14 |
import static org.gvsig.fmap.dal.store.jdbc2.JDBCStoreProviderFactory.CASE_IDENTIFIERS_LOWERCASE; |
15 |
import static org.gvsig.fmap.dal.store.jdbc2.JDBCStoreProviderFactory.CASE_IDENTIFIERS_UPPERCASE; |
16 |
import org.gvsig.tools.ToolsLocator; |
17 |
import org.gvsig.tools.i18n.I18nManager; |
18 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
19 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
20 |
|
21 |
/**
|
22 |
*
|
23 |
* @author usuario
|
24 |
*/
|
25 |
public class IdentifiersOptionsPanel |
26 |
extends IdentifiersOptionsPanelView
|
27 |
implements ExportPanel {
|
28 |
|
29 |
private static final long serialVersionUID = -6390855050271511346L; |
30 |
|
31 |
private final ExportJDBCParameters parameters; |
32 |
private final JExportProcessPanel processPanel; |
33 |
|
34 |
public IdentifiersOptionsPanel(
|
35 |
JExportProcessPanel processPanel, |
36 |
ExportJDBCParameters parameters |
37 |
) { |
38 |
this.processPanel = processPanel;
|
39 |
this.parameters = parameters;
|
40 |
initComponents(); |
41 |
} |
42 |
|
43 |
private void initComponents() { |
44 |
this.chkRemoveSpaces.setSelected(true); |
45 |
|
46 |
this.translate();
|
47 |
} |
48 |
|
49 |
private void translate() { |
50 |
ToolsSwingManager swingManager = ToolsSwingLocator.getToolsSwingManager(); |
51 |
swingManager.translate(this.rdbIndiferentCase);
|
52 |
swingManager.translate(this.rdbLowerCase);
|
53 |
swingManager.translate(this.rdbUpperCase);
|
54 |
swingManager.translate(this.chkRemoveSpaces);
|
55 |
swingManager.translate(this.chkTraslateHyphens);
|
56 |
swingManager.translate(this.lblHeader,true); |
57 |
} |
58 |
|
59 |
@Override
|
60 |
public String getIdPanel() { |
61 |
return this.getClass().getCanonicalName(); |
62 |
} |
63 |
|
64 |
@Override
|
65 |
public String getTitlePanel() { |
66 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
67 |
return i18nManager.getTranslation("_Table_and_fields_name_options"); |
68 |
} |
69 |
|
70 |
@Override
|
71 |
public void previousPanel() { |
72 |
|
73 |
} |
74 |
|
75 |
@Override
|
76 |
public void nextPanel() { |
77 |
ExportJDBCParameters params = this.parameters;
|
78 |
params.setRemoveSpacesInIdentifiers(this.chkRemoveSpaces.isSelected());
|
79 |
// params.setTranslateIdentifiersToLowerCase(this.chkTraslateToLowerCase.isSelected());
|
80 |
params.setCaseIdentifiersMode(getCaseIndentifiersMode()); |
81 |
params.setTranslateHyphens(this.chkTraslateHyphens.isSelected());
|
82 |
} |
83 |
|
84 |
@Override
|
85 |
public boolean validatePanel() throws ExportPanelValidationException { |
86 |
return true; |
87 |
} |
88 |
|
89 |
@Override
|
90 |
public void enterPanel() { |
91 |
this.chkRemoveSpaces.setSelected(this.parameters.getRemoveSpacesInIdentifiers()); |
92 |
this.chkTraslateHyphens.setSelected(this.parameters.getTranslateHyphens()); |
93 |
switch(this.parameters.getCaseIdentifiersMode()){ |
94 |
case CASE_IDENTIFIERS_INDIFERENT:
|
95 |
rdbIndiferentCase.setSelected(true);
|
96 |
break;
|
97 |
case CASE_IDENTIFIERS_LOWERCASE:
|
98 |
rdbLowerCase.setSelected(true);
|
99 |
break;
|
100 |
case CASE_IDENTIFIERS_UPPERCASE:
|
101 |
default:
|
102 |
rdbUpperCase.setSelected(true);
|
103 |
break;
|
104 |
} |
105 |
|
106 |
} |
107 |
|
108 |
@Override
|
109 |
public JComponent asJComponent() { |
110 |
return this; |
111 |
} |
112 |
|
113 |
public int getCaseIndentifiersMode() { |
114 |
if(rdbIndiferentCase.isSelected()){
|
115 |
return CASE_IDENTIFIERS_INDIFERENT;
|
116 |
} |
117 |
if(rdbLowerCase.isSelected()){
|
118 |
return CASE_IDENTIFIERS_LOWERCASE;
|
119 |
} |
120 |
if(rdbUpperCase.isSelected()){
|
121 |
return CASE_IDENTIFIERS_UPPERCASE;
|
122 |
} |
123 |
return CASE_IDENTIFIERS_UPPERCASE;
|
124 |
} |
125 |
|
126 |
public boolean getRemoveSpacesInTableName() { |
127 |
return this.chkRemoveSpaces.isSelected(); |
128 |
} |
129 |
|
130 |
public boolean getTranslateHyphens() { |
131 |
return this.chkTraslateHyphens.isSelected(); |
132 |
} |
133 |
|
134 |
} |