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