|
|
|
@ -17,6 +17,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import java.awt.*; |
|
|
|
@ -36,8 +37,8 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
|
|
|
|
|
private JDialog dialog; |
|
|
|
|
private UILabel uiLabel; |
|
|
|
|
// 编码转换.
|
|
|
|
|
private UIComboBox newCharSetComboBox; |
|
|
|
|
private String oirginalCharSet = null; |
|
|
|
|
private UIComboBox charSetComboBox; |
|
|
|
|
private String originalCharSet = null; |
|
|
|
|
|
|
|
|
|
// Database pane
|
|
|
|
|
public DatabaseConnectionPane() { |
|
|
|
@ -50,7 +51,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
|
|
|
|
|
okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")); |
|
|
|
|
cancelButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel")); |
|
|
|
|
String[] defaultEncode = new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encode_Auto")}; |
|
|
|
|
newCharSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY)); |
|
|
|
|
charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY)); |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
|
this.add(northPane, BorderLayout.NORTH); |
|
|
|
@ -72,7 +73,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
|
|
|
|
|
new ModLineBorder(ModLineBorder.TOP), |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced") |
|
|
|
|
)); |
|
|
|
|
chartSetPane.add(GUICoreUtils.createNamedPane(newCharSetComboBox, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_New_Charset") + ":")); |
|
|
|
|
chartSetPane.add(GUICoreUtils.createNamedPane(charSetComboBox, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected abstract JPanel mainPanel(); |
|
|
|
@ -81,8 +82,12 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void populateBean(com.fr.data.impl.Connection ob) { |
|
|
|
|
this.oirginalCharSet = ob.getOriginalCharsetName(); |
|
|
|
|
this.newCharSetComboBox.setSelectedItem(ob.getNewCharsetName()); |
|
|
|
|
this.originalCharSet = ob.getOriginalCharsetName(); |
|
|
|
|
if (StringUtils.isBlank(originalCharSet)) { |
|
|
|
|
this.charSetComboBox.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encode_Auto")); |
|
|
|
|
} else { |
|
|
|
|
this.charSetComboBox.setSelectedItem(ob.getOriginalCharsetName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
populateSubDatabaseConnectionBean((E) ob); |
|
|
|
|
} |
|
|
|
@ -93,11 +98,14 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
|
|
|
|
|
public com.fr.data.impl.Connection updateBean() { |
|
|
|
|
E ob = updateSubDatabaseConnectionBean(); |
|
|
|
|
|
|
|
|
|
ob.setOriginalCharsetName(this.oirginalCharSet); |
|
|
|
|
if (this.newCharSetComboBox.getSelectedIndex() == 0) { |
|
|
|
|
ob.setOriginalCharsetName(this.originalCharSet); |
|
|
|
|
if (this.charSetComboBox.getSelectedIndex() == 0) { |
|
|
|
|
ob.setNewCharsetName(null); |
|
|
|
|
ob.setOriginalCharsetName(null); |
|
|
|
|
} else { |
|
|
|
|
ob.setNewCharsetName((String) this.newCharSetComboBox.getSelectedItem()); |
|
|
|
|
ob.setNewCharsetName(EncodeConstants.ENCODING_GBK); |
|
|
|
|
ob.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem())); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ob; |
|
|
|
|