|
|
@ -1,12 +1,14 @@ |
|
|
|
package com.fr.design.data.datapane.connect; |
|
|
|
package com.fr.design.data.datapane.connect; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
import com.fine.swing.ui.layout.Layouts; |
|
|
|
|
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
|
|
|
|
import com.fine.theme.utils.FineUIUtils; |
|
|
|
import com.fr.data.driver.DriverLoader; |
|
|
|
import com.fr.data.driver.DriverLoader; |
|
|
|
import com.fr.data.driver.config.DriverLoaderConfig; |
|
|
|
import com.fr.data.driver.config.DriverLoaderConfig; |
|
|
|
import com.fr.data.impl.JDBCDatabaseConnection; |
|
|
|
import com.fr.data.impl.JDBCDatabaseConnection; |
|
|
|
import com.fr.data.solution.entity.DriverClasses; |
|
|
|
import com.fr.data.solution.entity.DriverClasses; |
|
|
|
import com.fr.design.border.UITitledBorder; |
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.gui.core.ReactiveCardPane; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBoxUI; |
|
|
|
import com.fr.design.gui.icombobox.UIComboBoxUI; |
|
|
@ -15,9 +17,6 @@ import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; |
|
|
|
import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.utils.BrowseUtils; |
|
|
|
import com.fr.design.utils.BrowseUtils; |
|
|
|
import com.fr.file.filter.ChooseFileFilter; |
|
|
|
import com.fr.file.filter.ChooseFileFilter; |
|
|
@ -29,8 +28,6 @@ import com.fr.stable.StringUtils; |
|
|
|
import com.fr.third.guava.collect.HashBiMap; |
|
|
|
import com.fr.third.guava.collect.HashBiMap; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
|
|
|
import javax.swing.ImageIcon; |
|
|
|
|
|
|
|
import javax.swing.JFileChooser; |
|
|
|
import javax.swing.JFileChooser; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPasswordField; |
|
|
|
import javax.swing.JPasswordField; |
|
|
@ -39,10 +36,6 @@ import javax.swing.event.DocumentListener; |
|
|
|
import javax.swing.plaf.ComboBoxUI; |
|
|
|
import javax.swing.plaf.ComboBoxUI; |
|
|
|
import javax.swing.plaf.basic.ComboPopup; |
|
|
|
import javax.swing.plaf.basic.ComboPopup; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.Graphics; |
|
|
|
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.InputMethodEvent; |
|
|
|
import java.awt.event.InputMethodEvent; |
|
|
@ -59,6 +52,10 @@ import java.util.Set; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
|
|
|
|
import static com.fine.swing.ui.layout.Layouts.flex; |
|
|
|
|
|
|
|
|
|
|
|
public class JDBCDefPane extends JPanel { |
|
|
|
public class JDBCDefPane extends JPanel { |
|
|
|
public static final String DRIVER_TYPE = "driver_type"; |
|
|
|
public static final String DRIVER_TYPE = "driver_type"; |
|
|
|
public static final String USER_NAME = "user_name"; |
|
|
|
public static final String USER_NAME = "user_name"; |
|
|
@ -104,9 +101,8 @@ public class JDBCDefPane extends JPanel { |
|
|
|
private JPasswordField passwordTextField; |
|
|
|
private JPasswordField passwordTextField; |
|
|
|
private UIComboBox charSetComboBox; |
|
|
|
private UIComboBox charSetComboBox; |
|
|
|
private ActionLabel odbcTipsLink; |
|
|
|
private ActionLabel odbcTipsLink; |
|
|
|
private JPanel centerPanel; |
|
|
|
private ReactiveCardPane centerPanel; |
|
|
|
private Component[][] allComponents; |
|
|
|
private ReactiveCardPane driverSelectRow; |
|
|
|
private Component[][] partComponents; |
|
|
|
|
|
|
|
// 请不要改动dbtype,只应该最后添加
|
|
|
|
// 请不要改动dbtype,只应该最后添加
|
|
|
|
private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB}; |
|
|
|
private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB}; |
|
|
|
|
|
|
|
|
|
|
@ -116,16 +112,18 @@ public class JDBCDefPane extends JPanel { |
|
|
|
private UIComboBox driverManageBox; |
|
|
|
private UIComboBox driverManageBox; |
|
|
|
private ActionLabel driverManageLabel; |
|
|
|
private ActionLabel driverManageLabel; |
|
|
|
private UIComboBox driverLoaderBox; |
|
|
|
private UIComboBox driverLoaderBox; |
|
|
|
ActionListener driverManageListener = new ActionListener() { |
|
|
|
ActionListener driverManageListener = e -> changeDriverRow(); |
|
|
|
@Override |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
private void changeDriverRow() { |
|
|
|
boolean selectSelfDefine = isSelfDefine(); |
|
|
|
if (isSelfDefine()) { |
|
|
|
driverManageLabel.setVisible(selectSelfDefine); |
|
|
|
driverSelectRow.select("define").populate(); |
|
|
|
driverLoaderBox.setVisible(selectSelfDefine); |
|
|
|
} else if (ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())) { |
|
|
|
driverComboBox.setVisible(!selectSelfDefine); |
|
|
|
driverSelectRow.select("odbc").populate(); |
|
|
|
odbcTipsLink.setVisible(driverComboBox.isVisible() && ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); |
|
|
|
} else { |
|
|
|
|
|
|
|
driverSelectRow.select("normal").populate(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ActionListener dbtypeActionListener = new ActionListener() { |
|
|
|
ActionListener dbtypeActionListener = new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
@ -162,27 +160,24 @@ public class JDBCDefPane extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
public JDBCDefPane() { |
|
|
|
public JDBCDefPane() { |
|
|
|
initMap(); |
|
|
|
initMap(); |
|
|
|
this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":")); |
|
|
|
this.setLayout(new BorderLayout()); |
|
|
|
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); |
|
|
|
|
|
|
|
JPanel innerthis = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
|
|
|
|
innerthis.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
|
|
|
|
|
|
|
this.add(innerthis); |
|
|
|
|
|
|
|
dbtypeComboBox = new UIComboBox(); |
|
|
|
dbtypeComboBox = new UIComboBox(); |
|
|
|
dbtypeComboBox.setName(DRIVER_TYPE); |
|
|
|
dbtypeComboBox.setName(DRIVER_TYPE); |
|
|
|
for (int i = 0; i < dbtype.length; i++) { |
|
|
|
for (String s : dbtype) { |
|
|
|
dbtypeComboBox.addItem(dbtype[i]); |
|
|
|
dbtypeComboBox.addItem(s); |
|
|
|
} |
|
|
|
} |
|
|
|
dbtypeComboBox.addActionListener(dbtypeActionListener); |
|
|
|
dbtypeComboBox.addActionListener(dbtypeActionListener); |
|
|
|
dbtypeComboBox.setMaximumRowCount(10); |
|
|
|
dbtypeComboBox.setMaximumRowCount(10); |
|
|
|
|
|
|
|
|
|
|
|
driverLoaderBox = new SpecialUIComboBox(); |
|
|
|
driverLoaderBox = new SpecialUIComboBox(); |
|
|
|
refreshDriverLoader(); |
|
|
|
refreshDriverLoader(); |
|
|
|
driverLoaderBox.setPreferredSize(new Dimension(200, driverLoaderBox.getPreferredSize().height)); |
|
|
|
|
|
|
|
driverLoaderBox.setEditable(false); |
|
|
|
driverLoaderBox.setEditable(false); |
|
|
|
|
|
|
|
|
|
|
|
driverManageBox = new UIComboBox(); |
|
|
|
driverManageBox = new UIComboBox(); |
|
|
|
refreshDriverManage(true); |
|
|
|
refreshDriverManage(true); |
|
|
|
driverManageBox.setEditable(false); |
|
|
|
driverManageBox.setEditable(false); |
|
|
|
driverManageBox.addActionListener(driverManageListener); |
|
|
|
driverManageBox.addActionListener(driverManageListener); |
|
|
|
driverLoaderBox.setVisible(isSelfDefine()); |
|
|
|
|
|
|
|
driverComboBox = new UIComboBox(); |
|
|
|
driverComboBox = new UIComboBox(); |
|
|
|
driverComboBox.setEditable(true); |
|
|
|
driverComboBox.setEditable(true); |
|
|
|
driverComboBox.addActionListener(driverListener); |
|
|
|
driverComboBox.addActionListener(driverListener); |
|
|
@ -198,124 +193,117 @@ public class JDBCDefPane extends JPanel { |
|
|
|
userNameTextField.setName(USER_NAME); |
|
|
|
userNameTextField.setName(USER_NAME); |
|
|
|
passwordTextField = new UIPasswordFieldWithFixedLength(15); |
|
|
|
passwordTextField = new UIPasswordFieldWithFixedLength(15); |
|
|
|
dbtypeButton = new UIButton(); |
|
|
|
dbtypeButton = new UIButton(); |
|
|
|
dbtypeButton.setIcon(new ImageIcon(UIConstants.ACCESSIBLE_EDITOR_DOT)); |
|
|
|
dbtypeButton.setIcon(new LazyIcon("dot")); |
|
|
|
dbtypeButton.setPreferredSize(new Dimension(20, 20)); |
|
|
|
|
|
|
|
dbtypeButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Click_Get_Default_URL")); |
|
|
|
dbtypeButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Click_Get_Default_URL")); |
|
|
|
dbtypeButton.addActionListener(dbtypeButtonActionListener); |
|
|
|
dbtypeButton.addActionListener(dbtypeButtonActionListener); |
|
|
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
JPanel dbTypeRow = row( |
|
|
|
double f = TableLayout.FILL; |
|
|
|
cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Database")))).weight(1.2), |
|
|
|
JPanel dbtypePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
cell(dbtypeComboBox).weight(2), |
|
|
|
dbtypePane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Database") + ":"))); |
|
|
|
flex(5.8) |
|
|
|
Component[][] dbtypeComComponents = {{dbtypeComboBox}}; |
|
|
|
).getComponent(); |
|
|
|
double[] dbtypeRowSize = {p}; |
|
|
|
|
|
|
|
double[] dbtypeColumnSize = {p}; |
|
|
|
|
|
|
|
JPanel dbtypeComPane = TableLayoutHelper.createTableLayoutPane(dbtypeComComponents, dbtypeRowSize, dbtypeColumnSize); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel driverPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
|
|
|
|
driverPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Driver") + ":")); |
|
|
|
|
|
|
|
// 选择ODBC数据源的时候的提示链接
|
|
|
|
// 选择ODBC数据源的时候的提示链接
|
|
|
|
JPanel odbcTipsPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
odbcTipsLink = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")); |
|
|
|
odbcTipsLink = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")) { |
|
|
|
odbcTipsLink.addActionListener(evt -> { |
|
|
|
@Override |
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help"); |
|
|
|
public void paintComponent(Graphics _gfx) { |
|
|
|
BrowseUtils.browser(url); |
|
|
|
super.paintComponent(_gfx); |
|
|
|
|
|
|
|
_gfx.setColor(Color.blue); |
|
|
|
|
|
|
|
_gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
odbcTipsPane.add(odbcTipsLink); |
|
|
|
|
|
|
|
odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height)); |
|
|
|
|
|
|
|
odbcTipsLink.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help"); |
|
|
|
|
|
|
|
BrowseUtils.browser(url); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
driverManageLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")) { |
|
|
|
driverManageLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")); |
|
|
|
@Override |
|
|
|
driverManageLabel.addActionListener(evt -> { |
|
|
|
public void paintComponent(Graphics _gfx) { |
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind("driver.add.help"); |
|
|
|
super.paintComponent(_gfx); |
|
|
|
BrowseUtils.browser(url); |
|
|
|
_gfx.setColor(Color.blue); |
|
|
|
|
|
|
|
_gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
driverManageLabel.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")), driverManageLabel.getPreferredSize().height)); |
|
|
|
|
|
|
|
driverManageLabel.setVisible(isSelfDefine()); |
|
|
|
|
|
|
|
driverManageLabel.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind("driver.add.help"); |
|
|
|
|
|
|
|
BrowseUtils.browser(url); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
odbcTipsPane.add(driverManageLabel); |
|
|
|
driverSelectRow = ReactiveCardPane.create() |
|
|
|
odbcTipsPane.add(odbcTipsLink); |
|
|
|
.addSupplier("normal", () -> row( |
|
|
|
|
|
|
|
cell(driverComboBox).weight(3), flex(2) |
|
|
|
JPanel driverComboBoxAndTips = new JPanel(new BorderLayout()); |
|
|
|
).getComponent()) |
|
|
|
JPanel normalFlowInnerContainer_s_pane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 5, 0); |
|
|
|
.addSupplier("odbc", () -> row( |
|
|
|
normalFlowInnerContainer_s_pane.add(driverManageBox); |
|
|
|
cell(driverComboBox).weight(3), flex(0.2), cell(odbcTipsLink).weight(1.8) |
|
|
|
normalFlowInnerContainer_s_pane.add(driverComboBox); |
|
|
|
).getComponent()) |
|
|
|
normalFlowInnerContainer_s_pane.add(driverLoaderBox); |
|
|
|
.addSupplier("define", () -> row( |
|
|
|
driverComboBoxAndTips.add(normalFlowInnerContainer_s_pane, BorderLayout.WEST); |
|
|
|
cell(driverLoaderBox).weight(3), cell(driverManageLabel).weight(2) |
|
|
|
driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER); |
|
|
|
).getComponent()); |
|
|
|
|
|
|
|
changeDriverRow(); |
|
|
|
JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
|
|
|
|
hostPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host") + ":")); |
|
|
|
JPanel driverRow = row( |
|
|
|
Component[][] hostComComponents = {{hostTextField}}; |
|
|
|
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Driver"))).weight(1.2), |
|
|
|
double[] hostRowSize = {p}; |
|
|
|
cell(driverManageBox).weight(1.2), |
|
|
|
double[] hostColumnSize = {p}; |
|
|
|
flex(0.2), |
|
|
|
JPanel hostComPane = TableLayoutHelper.createTableLayoutPane(hostComComponents, hostRowSize, hostColumnSize); |
|
|
|
cell(driverSelectRow).weight(4.6), |
|
|
|
|
|
|
|
flex(1.8) |
|
|
|
JPanel portPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
).getComponent(); |
|
|
|
portPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Port") + ":")); |
|
|
|
|
|
|
|
Component[][] portComComponents = {{portTextField}}; |
|
|
|
// 以下布局比例为对齐计算而出
|
|
|
|
double[] portRowSize = {p}; |
|
|
|
JPanel hostRow = row( |
|
|
|
double[] portColumnSize = {p}; |
|
|
|
cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Host")))).weight(1.2), |
|
|
|
JPanel portComPane = TableLayoutHelper.createTableLayoutPane(portComComponents, portRowSize, portColumnSize); |
|
|
|
cell(hostTextField).weight(4.16), |
|
|
|
|
|
|
|
flex(3.64) |
|
|
|
JPanel dbNamePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
).getComponent(); |
|
|
|
dbNamePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_DatabaseName") + ":")); |
|
|
|
|
|
|
|
Component[][] dbNameComComponents = {{dbNameTextField}}; |
|
|
|
JPanel portRow = row( |
|
|
|
double[] dbNameRowSize = {p}; |
|
|
|
cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Port")))).weight(1.2), |
|
|
|
double[] dbNameColumnSize = {p}; |
|
|
|
cell(portTextField).weight(4.16), |
|
|
|
JPanel dbNameComPane = TableLayoutHelper.createTableLayoutPane(dbNameComComponents, dbNameRowSize, dbNameColumnSize); |
|
|
|
flex(3.64) |
|
|
|
|
|
|
|
).getComponent(); |
|
|
|
JPanel urlPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
|
|
|
|
urlPane.add(new UILabel("URL:")); |
|
|
|
JPanel dbNameRow = row( |
|
|
|
Component[][] urlComComponents = {{urlTextField, dbtypeButton}}; |
|
|
|
cell(new UILabel((Toolkit.i18nText("Fine-Design_Basic_DatabaseName")))).weight(1.2), |
|
|
|
double[] urlRowSize = {p}; |
|
|
|
cell(dbNameTextField).weight(4.16), |
|
|
|
double[] urlColumnSize = {f, 21}; |
|
|
|
flex(3.64) |
|
|
|
JPanel urlComPane = TableLayoutHelper.createCommonTableLayoutPane(urlComComponents, urlRowSize, urlColumnSize, 4); |
|
|
|
).getComponent(); |
|
|
|
|
|
|
|
|
|
|
|
JPanel userPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
JPanel urlRow = row( |
|
|
|
userPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName") + ":")); |
|
|
|
cell(new UILabel("URL")).weight(1.2), |
|
|
|
Component[][] userComComponents = {{userNameTextField, new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":"), passwordTextField}}; |
|
|
|
cell(urlTextField).weight(5.6), |
|
|
|
double[] userRowSize = {p}; |
|
|
|
flex(0.1), |
|
|
|
double[] userColumnSize = {f, p, f}; |
|
|
|
cell(dbtypeButton).weight(0.3), |
|
|
|
JPanel userComPane = TableLayoutHelper.createCommonTableLayoutPane(userComComponents, userRowSize, userColumnSize, 4); |
|
|
|
flex(1.8) |
|
|
|
|
|
|
|
).getComponent(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel userRow = row( |
|
|
|
|
|
|
|
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName"))).weight(1.2), |
|
|
|
|
|
|
|
cell(userNameTextField).weight(2.3), |
|
|
|
|
|
|
|
flex(0.2), |
|
|
|
|
|
|
|
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password"))).weight(1.2), |
|
|
|
|
|
|
|
cell(passwordTextField).weight(2.3), |
|
|
|
|
|
|
|
flex(1.8) |
|
|
|
|
|
|
|
).getComponent(); |
|
|
|
|
|
|
|
|
|
|
|
String[] defaultEncode = new String[]{Toolkit.i18nText("Fine-Design_Encode_Auto")}; |
|
|
|
String[] defaultEncode = new String[]{Toolkit.i18nText("Fine-Design_Encode_Auto")}; |
|
|
|
charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY)); |
|
|
|
charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY)); |
|
|
|
JPanel chartSetPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); |
|
|
|
JPanel charSetRow = row( |
|
|
|
chartSetPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":")); |
|
|
|
cell(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset"))).weight(1.2), |
|
|
|
Component[][] charSetComComponents = {{charSetComboBox}}; |
|
|
|
cell(charSetComboBox).weight(6), |
|
|
|
double[] charSetRowSize = {p}; |
|
|
|
flex(1.8) |
|
|
|
double[] charSetColumnSize = {f}; |
|
|
|
).getComponent(); |
|
|
|
JPanel charSetComPane = TableLayoutHelper.createTableLayoutPane(charSetComComponents, charSetRowSize, charSetColumnSize); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//这边调整的话注意下面的changePane
|
|
|
|
//这边调整的话注意下面的changePane
|
|
|
|
allComponents = new Component[][]{{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {hostPane, hostComPane}, |
|
|
|
centerPanel = ReactiveCardPane.create() |
|
|
|
{portPane, portComPane}, {dbNamePane, dbNameComPane}, {userPane, userComPane}, |
|
|
|
.addSupplier("all", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, |
|
|
|
{chartSetPane, charSetComPane}, {urlPane, urlComPane}}; |
|
|
|
cell(dbTypeRow), |
|
|
|
partComponents = new Component[][]{{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane}, |
|
|
|
cell(driverRow), |
|
|
|
{userPane, userComPane}, {chartSetPane, charSetComPane}}; |
|
|
|
cell(hostRow), |
|
|
|
double[] rowSize = {p, p, p, p, p, p, p, p}; |
|
|
|
cell(portRow), |
|
|
|
double[] columnSize = {p, f, 22}; |
|
|
|
cell(dbNameRow), |
|
|
|
// REPORT-41450 Windows环境的jdk11下dpi为125%时会因为缩放导致显示问题,因此加个水平gap值
|
|
|
|
cell(userRow), |
|
|
|
centerPanel = TableLayoutHelper.createGapTableLayoutPane(allComponents, rowSize, columnSize, 6, 6); |
|
|
|
cell(charSetRow), |
|
|
|
innerthis.add(centerPanel); |
|
|
|
cell(urlRow) |
|
|
|
|
|
|
|
).getComponent()) |
|
|
|
|
|
|
|
.addSupplier("part", () -> Layouts.column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
|
|
|
cell(dbTypeRow), |
|
|
|
|
|
|
|
cell(driverRow), |
|
|
|
|
|
|
|
cell(urlRow), |
|
|
|
|
|
|
|
cell(userRow), |
|
|
|
|
|
|
|
cell(charSetRow) |
|
|
|
|
|
|
|
).getComponent()); |
|
|
|
|
|
|
|
centerPanel.select("all").populate(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, |
|
|
|
|
|
|
|
cell(new UILabel("JDBC")).with(FineUIUtils::wrapBoldLabelWithUnderline), |
|
|
|
|
|
|
|
cell(centerPanel) |
|
|
|
|
|
|
|
).getComponent()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void refreshDriverLoader() { |
|
|
|
private void refreshDriverLoader() { |
|
|
@ -365,17 +353,10 @@ public class JDBCDefPane extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void changePane(Object dbType) { |
|
|
|
private void changePane(Object dbType) { |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
|
|
|
double[] columnSize = {p, f, 22}; |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) { |
|
|
|
if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) { |
|
|
|
if (this.centerPanel.getComponentCount() != partComponents.length * 2) { |
|
|
|
centerPanel.select("part").populate(); |
|
|
|
centerPanel.removeAll(); |
|
|
|
} else { |
|
|
|
TableLayoutHelper.addComponent2ResultPane(partComponents, new double[]{p, p, p, p, p}, columnSize, centerPanel); |
|
|
|
centerPanel.select("all").populate(); |
|
|
|
} |
|
|
|
|
|
|
|
} else if (this.centerPanel.getComponentCount() != allComponents.length * 2) { |
|
|
|
|
|
|
|
centerPanel.removeAll(); |
|
|
|
|
|
|
|
TableLayoutHelper.addComponent2ResultPane(allComponents, new double[]{p, p, p, p, p, p, p, p}, columnSize, centerPanel); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -488,8 +469,13 @@ public class JDBCDefPane extends JPanel { |
|
|
|
linkPanel.setVisible(DriverClasses.MYSQL.toString().equalsIgnoreCase((String) dbtypeComboBox.getSelectedItem()) |
|
|
|
linkPanel.setVisible(DriverClasses.MYSQL.toString().equalsIgnoreCase((String) dbtypeComboBox.getSelectedItem()) |
|
|
|
&& driverComboBox.getSelectedItem() != null |
|
|
|
&& driverComboBox.getSelectedItem() != null |
|
|
|
&& ComparatorUtils.equals(DriverClasses.MYSQL.getDriverClass(), driverComboBox.getSelectedItem().toString().trim())); |
|
|
|
&& ComparatorUtils.equals(DriverClasses.MYSQL.getDriverClass(), driverComboBox.getSelectedItem().toString().trim())); |
|
|
|
odbcTipsLink.setVisible(driverComboBox.getSelectedItem() != null |
|
|
|
if (driverComboBox.getSelectedItem() != null |
|
|
|
&& ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem().toString().trim())); // 选择的如果是ODBC就显示提示
|
|
|
|
&& ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem().toString().trim())) { |
|
|
|
|
|
|
|
driverSelectRow.select("odbc").populate(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
driverSelectRow.select("normal").populate(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) { |
|
|
|
if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|