Browse Source

REPORT-12854

设计器数据连接编码转换 交互修改 bug fix
bugfix/10.0
XiaXiang 6 years ago
parent
commit
de75ef5d1f
  1. 27
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

27
designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

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

Loading…
Cancel
Save