From 47ede11f3ab281eed498ddf550c8627350ad84c9 Mon Sep 17 00:00:00 2001 From: xiqiu Date: Fri, 27 Aug 2021 10:20:52 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-58222=20=20=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5jdbc=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/JDBCDefPane.java | 477 ++++++------------ 1 file changed, 159 insertions(+), 318 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index 5a8c138892..0da46965b1 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -1,13 +1,10 @@ package com.fr.design.data.datapane.connect; import com.fr.base.GraphHelper; -import com.fr.data.driver.DriverLoader; -import com.fr.data.driver.config.DriverLoaderConfig; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.design.border.UITitledBorder; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icombobox.UIComboBoxUI; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; @@ -24,8 +21,6 @@ import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; -import com.fr.third.guava.collect.HashBiMap; -import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; import javax.swing.JFileChooser; @@ -33,8 +28,6 @@ import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.event.DocumentEvent; 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; @@ -52,7 +45,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -105,167 +97,12 @@ public class JDBCDefPane extends JPanel { private Component[][] partComponents; // 请不要改动dbtype,只应该最后添加 private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB}; - private JDBCDatabaseConnection jdbcDatabase; - private boolean needRefresh = true; - private UIComboBox driverManageBox; - private ActionLabel driverManageLabel; - private UIComboBox driverLoaderBox; - private HashBiMap nameAndRepresent; - - ActionListener driverListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) { - return; - } - odbcTipsLink.setVisible(ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); // 选择的如果是ODBC就显示提示 - Iterator> jdbc = jdbcMap.entrySet().iterator(); - while (jdbc.hasNext()) { - Entry entry = jdbc.next(); - DriverURLName[] dus = entry.getValue(); - for (int i = 0, len = dus.length; i < len; i++) { - if (ComparatorUtils.equals(dus[i].getDriver(), (driverComboBox.getSelectedItem()))) { - urlTextField.setText(dus[i].getURL()); - return; - } - } - } - } - }; - ActionListener dbtypeButtonActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent evt) { - if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) { - return; - } - DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem()); - for (int i = 0, len = dus.length; i < len; i++) { - if (ComparatorUtils.equals(driverComboBox.getSelectedItem(), (dus[i].getDriver()))) { - urlTextField.setText(dus[i].getURL()); - if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), ("Access"))) { - // ben:这个能不能换种处理方案- - - JFileChooser filechooser = new JFileChooser(); - filechooser.setDialogTitle(Toolkit.i18nText("Fine-Design_Basic_Open")); - filechooser.setMultiSelectionEnabled(false); - filechooser.addChoosableFileFilter(new ChooseFileFilter(new String[]{"accdb", "mdb"}, "Microsoft Office Access")); - int result = filechooser.showOpenDialog(DesignerContext.getDesignerFrame()); - File selectedfile = null; - - if (result == JFileChooser.APPROVE_OPTION) { - selectedfile = filechooser.getSelectedFile(); - if (selectedfile != null) { - String selectedName = selectedfile.getPath().substring(selectedfile.getPath().lastIndexOf('.') + 1); - if (selectedName.equalsIgnoreCase("mdb") || selectedName.equalsIgnoreCase("accdb")) { - urlTextField.setText(urlTextField.getText() + selectedfile.getPath()); - } - } - } - } - break; - } - } - } - }; - KeyListener portKeyListener = new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - String port = portTextField.getText(); - if (isPortValid(port)) { - updateURL(); - } else { - portTextField.setText(port.replaceAll(getCharNeedReplace(e.getKeyChar()), "")); - if (!isPortValid(portTextField.getText())) { - portTextField.setText(StringUtils.EMPTY); - updateURL(); - } - } - } - }; - ActionListener driverManageListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - boolean selectSelfDefine = isSelfDefine(); - driverManageLabel.setVisible(selectSelfDefine); - driverLoaderBox.setVisible(selectSelfDefine); - driverComboBox.setVisible(!selectSelfDefine); - // 选中自定义的话,将odbc的屏蔽,选中默认的话,重新触发一次driverComboBox的事件 - if (selectSelfDefine) { - odbcTipsLink.setVisible(false); - } else { - driverComboBox.setSelectedItem(driverComboBox.getSelectedItem()); - } - } - }; - ActionListener dbtypeActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent evt) { - urlTextField.setText(StringUtils.EMPTY); - driverComboBox.removeAllItems(); - driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default")); - if (driverLoaderBox.getItemCount() > 0) { - driverLoaderBox.setSelectedIndex(0); - } - if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) { - driverComboBox.setSelectedItem(StringUtils.EMPTY); - return; - } - DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem()); - for (int i = 0, len = dus.length; i < len; i++) { - driverComboBox.addItem(dus[i].getDriver()); - if (i == 0) { - driverComboBox.setSelectedItem(dus[i].getDriver()); - urlTextField.setText(dus[i].getURL()); - } - } - // 更改数据库类型后 数据库名称置空和之前逻辑保持一致 - if (needRefresh) { - jdbcDatabase.setDatabase(StringUtils.EMPTY); - } - changePane(dbtypeComboBox.getSelectedItem()); - JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase); - DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase); - } - }; - - InputMethodListener portInputMethodListener = new InputMethodListener() { - @Override - public void inputMethodTextChanged(InputMethodEvent event) { - if (null == event.getText()) { - return; - } - char ch = event.getText().current(); - if (!(ch >= '0' && ch <= '9')) { - event.consume(); - } - } - - @Override - public void caretPositionChanged(InputMethodEvent event) { - - } - }; - - DocumentListener updateParaListener = new DocumentListener() { - @Override - public void insertUpdate(DocumentEvent e) { - updatePara(); - } - - @Override - public void removeUpdate(DocumentEvent e) { - updatePara(); - } - - @Override - public void changedUpdate(DocumentEvent e) { - updatePara(); - } - }; + private JDBCDatabaseConnection jdbcDatabase; + private boolean needRefresh = true; public JDBCDefPane() { - initMap(); this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":")); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); JPanel innerthis = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); @@ -278,15 +115,7 @@ public class JDBCDefPane extends JPanel { } 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); @@ -326,39 +155,17 @@ public class JDBCDefPane extends JPanel { _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() { - @Override 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")) { - @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); - } - }); - 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(driverComboBox, BorderLayout.WEST); driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER); JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); @@ -418,70 +225,7 @@ public class JDBCDefPane extends JPanel { innerthis.add(centerPanel); } - private void initMap() { - Map driverLoaders = DriverLoaderConfig.getInstance().getDriverLoaders(); - nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders); - } - - private HashBiMap getDriverLoaderAndRepresent(Map driverLoaders) { - HashBiMap driverHashBiMap = HashBiMap.create(); - if (WorkContext.getCurrent().isWarDeploy()) { - return driverHashBiMap; - } - // name 是唯一的,name+driver自然也是唯一的 - for (DriverLoader driverLoader : driverLoaders.values()) { - driverHashBiMap.put(driverLoader.getName(), getRepresent(driverLoader.getDriverClass(), driverLoader.getName())); - } - return driverHashBiMap; - } - - protected JDBCDatabaseConnection getJDBCDatabase() { - return this.jdbcDatabase; - } - - 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); - } - } - - private String getRepresent(String driverClass, String driverName) { - return driverClass + "(" + driverName + ")"; - } - - private boolean isSelfDefine() { - return ComparatorUtils.equals(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define"), driverManageBox.getSelectedItem()); - } - - private void refreshDriverLoader() { - Set representSet = nameAndRepresent.values(); - driverLoaderBox.clearBoxItems(); - for (String represent : representSet) { - driverLoaderBox.addItem(represent); - } - } - - private void refreshDriverManage(boolean addSelfDefine) { - driverManageBox.clearBoxItems(); - driverManageBox.addItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default")); - if (addSelfDefine) { - driverManageBox.addItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define")); - } - } - public void populate(JDBCDatabaseConnection jdbcDatabase) { - // 单例对象,重新打开的时候并不会新建,但是由于driverloaderbox里面需要是动态内容,因此需要进行刷新动作 - initMap(); - refreshDriverLoader(); needRefresh = false; if (jdbcDatabase == null) { jdbcDatabase = new JDBCDatabaseConnection(); @@ -511,24 +255,7 @@ public class JDBCDefPane extends JPanel { this.dbtypeComboBox.setSelectedItem(OTHER_DB); } } - // jdbcDatabase.getDriverSource() 只会是空或者是有值,但是为了保险起见,还是应该做个处理 - String driverSource = jdbcDatabase.getDriverSource(); - if (driverSource == null) { - driverSource = StringUtils.EMPTY; - } - if (driverSource.isEmpty()) { - refreshDriverManage(!nameAndRepresent.isEmpty()); - this.driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default")); - this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); - } else { - refreshDriverManage(true); - this.driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define")); - String represent = getRepresent(jdbcDatabase.getDriver(), jdbcDatabase.getDriverSource()); - if (!nameAndRepresent.containsValue(represent)) { - this.driverLoaderBox.addItem(represent); - } - this.driverLoaderBox.setSelectedItem(represent); - } + this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); this.urlTextField.setText(jdbcDatabase.getURL()); this.userNameTextField.setText(jdbcDatabase.getUser()); this.passwordTextField.setText(jdbcDatabase.getPassword()); @@ -541,10 +268,31 @@ public class JDBCDefPane extends JPanel { needRefresh = false; } + protected JDBCDatabaseConnection getJDBCDatabase() { + return this.jdbcDatabase; + } + + 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); + } + } + public JDBCDatabaseConnection update() { if (jdbcDatabase == null) { jdbcDatabase = new JDBCDatabaseConnection(); } + Object driveItem = this.driverComboBox.getSelectedItem(); + jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim()); jdbcDatabase.setURL(this.urlTextField.getText().trim()); jdbcDatabase.setUser(this.userNameTextField.getText().trim()); jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim()); @@ -556,30 +304,126 @@ public class JDBCDefPane extends JPanel { jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK); jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem())); } - String driverLoader = (String) this.driverLoaderBox.getSelectedItem(); - if (driverLoader == null) { - driverLoader = StringUtils.EMPTY; + return jdbcDatabase; + } + + ActionListener dbtypeActionListener = new ActionListener() { + public void actionPerformed(ActionEvent evt) { + + urlTextField.setText(StringUtils.EMPTY); + driverComboBox.removeAllItems(); + if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) { + driverComboBox.setSelectedItem(StringUtils.EMPTY); + return; + } + + DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem()); + for (int i = 0, len = dus.length; i < len; i++) { + driverComboBox.addItem(dus[i].getDriver()); + if (i == 0) { + driverComboBox.setSelectedItem(dus[i].getDriver()); + urlTextField.setText(dus[i].getURL()); + } + } + // 更改数据库类型后 数据库名称置空和之前逻辑保持一致 + if (needRefresh) { + jdbcDatabase.setDatabase(StringUtils.EMPTY); + } + changePane(dbtypeComboBox.getSelectedItem()); + JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase); + DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase); } - if (isSelfDefine()) { - String[] split = driverLoader.split("\\("); - if (split.length > 1) { - String name = split[1]; - if (name.length() > 0) { - jdbcDatabase.setDriverSource(name.substring(0, name.length() - 1)); - } else { - jdbcDatabase.setDriverSource(StringUtils.EMPTY); + }; + + ActionListener driverListener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) { + return; + } + odbcTipsLink.setVisible(ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); // 选择的如果是ODBC就显示提示 + Iterator> jdbc = jdbcMap.entrySet().iterator(); + while (jdbc.hasNext()) { + Entry entry = jdbc.next(); + DriverURLName[] dus = entry.getValue(); + for (int i = 0, len = dus.length; i < len; i++) { + if (ComparatorUtils.equals(dus[i].getDriver(), (driverComboBox.getSelectedItem()))) { + urlTextField.setText(dus[i].getURL()); + return; + } } - } else { - jdbcDatabase.setDriverSource(StringUtils.EMPTY); } - jdbcDatabase.setDriver(split[0]); - } else { - Object driveItem = this.driverComboBox.getSelectedItem(); - jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim()); - jdbcDatabase.setDriverSource(StringUtils.EMPTY); } - return jdbcDatabase; - } + + }; + + ActionListener dbtypeButtonActionListener = new ActionListener() { + public void actionPerformed(ActionEvent evt) { + if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) { + return; + } + DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem()); + for (int i = 0, len = dus.length; i < len; i++) { + if (ComparatorUtils.equals(driverComboBox.getSelectedItem(), (dus[i].getDriver()))) { + urlTextField.setText(dus[i].getURL()); + if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), ("Access"))) { + // ben:这个能不能换种处理方案- - + JFileChooser filechooser = new JFileChooser(); + filechooser.setDialogTitle(Toolkit.i18nText("Fine-Design_Basic_Open")); + filechooser.setMultiSelectionEnabled(false); + filechooser.addChoosableFileFilter(new ChooseFileFilter(new String[]{"accdb", "mdb"}, "Microsoft Office Access")); + int result = filechooser.showOpenDialog(DesignerContext.getDesignerFrame()); + File selectedfile = null; + + if (result == JFileChooser.APPROVE_OPTION) { + selectedfile = filechooser.getSelectedFile(); + if (selectedfile != null) { + String selectedName = selectedfile.getPath().substring(selectedfile.getPath().lastIndexOf('.') + 1); + if (selectedName.equalsIgnoreCase("mdb") || selectedName.equalsIgnoreCase("accdb")) { + urlTextField.setText(urlTextField.getText() + selectedfile.getPath()); + } + } + } + } + break; + } + } + } + }; + + InputMethodListener portInputMethodListener = new InputMethodListener() { + @Override + public void inputMethodTextChanged(InputMethodEvent event) { + if (null == event.getText()) { + return; + } + char ch = event.getText().current(); + if (!(ch >= '0' && ch <= '9')) { + event.consume(); + } + } + + @Override + public void caretPositionChanged(InputMethodEvent event) { + + } + }; + + DocumentListener updateParaListener = new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + updatePara(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + updatePara(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + updatePara(); + } + }; private void updatePara() { String dbType = dbtypeComboBox.getSelectedItem().toString(); @@ -644,6 +488,21 @@ public class JDBCDefPane extends JPanel { this.hostTextField.getDocument().removeDocumentListener(updateURLListener); } + KeyListener portKeyListener = new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + String port = portTextField.getText(); + if (isPortValid(port)) { + updateURL(); + } else { + portTextField.setText(port.replaceAll(getCharNeedReplace(e.getKeyChar()), "")); + if (!isPortValid(portTextField.getText())) { + portTextField.setText(StringUtils.EMPTY); + updateURL(); + } + } + } + }; private boolean isPortValid(String port) { return PORT.matcher(port).find(); @@ -720,22 +579,4 @@ public class JDBCDefPane extends JPanel { private String driver; private String url; } - - private static class SpecialUIComboBox extends UIComboBox { - - @Override - public ComboBoxUI getUIComboBoxUI() { - return new SpecialUIComboBoxUI(); - } - } - - private static class SpecialUIComboBoxUI extends UIComboBoxUI { - - @Override - public ComboPopup createPopup() { - return createHorizontalNeverUIComboPopUp(); - } - - } - } From a1ddd989400c2c469207e8634321e138dddb51f6 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 27 Aug 2021 11:19:32 +0800 Subject: [PATCH 2/5] =?UTF-8?q?REPORT-58136=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E6=97=A0=E6=B3=95=E6=96=B0=E5=BB=BA=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/JTemplateNameHelper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java index 4e201a5efa..22d5985ba9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -53,6 +53,9 @@ public class JTemplateNameHelper { * @Date 2021/4/9 11:13 **/ private static Integer getFileNameIndex(String prefix, String fileName) { + if (fileName.length() <= prefix.length()) { + return null; + } char[] chars = new char[fileName.length()]; int i = 0; for (; i < fileName.length(); i++) { From 278e09dd39d2f059b032d6f4e3634e6d809ae0b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 27 Aug 2021 13:52:21 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-58081=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8-=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E9=80=89=E4=B8=AD=E5=A4=9A=E4=B8=AA=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=EF=BC=8C=E7=B2=98=E8=B4=B4=E5=88=B0=E5=8F=A6?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E4=B8=AD=EF=BC=8C=E7=8E=B0=E5=9C=A8=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E7=B2=98=E8=B4=B4=E5=BE=97=E5=88=B0=E6=89=80=E6=9C=89=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E7=9A=84=E7=BB=84=E4=BB=B6=E4=BA=86=EF=BC=8C=E5=8F=AA?= =?UTF-8?q?=E5=BE=97=E5=88=B0=E4=B8=80=E4=B8=AA=E7=BB=84=E4=BB=B6=EF=BC=9B?= =?UTF-8?q?8.2=E7=9A=84persist=E8=BF=98=E5=8F=AF=E4=BB=A5=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/FormSelectionUtils.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java index 84b8f6bf38..7d3b17f5b7 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java @@ -84,24 +84,22 @@ public class FormSelectionUtils { } private static FormSelection filterFormSelection(FormSelection clipboard, XLayoutContainer parent) { - FormSelection newSelection = new FormSelection(); for (XCreator xCreator : clipboard.getSelectedCreators()) { if (parent.acceptType(XWParameterLayout.class)) { - if (xCreator.canEnterIntoParaPane()) { - newSelection.addSelectedCreator(xCreator); + if (!xCreator.canEnterIntoParaPane()) { + clipboard.removeCreator(xCreator); } } else if (parent.acceptType(XWAbsoluteLayout.class)) { - if (xCreator.canEnterIntoAbsolutePane()) { - newSelection.addSelectedCreator(xCreator); + if (!xCreator.canEnterIntoAbsolutePane()) { + clipboard.removeCreator(xCreator); } } else if (parent.acceptType(XWFitLayout.class)) { - if (xCreator.canEnterIntoAdaptPane()) { - newSelection.addSelectedCreator(xCreator); + if (!xCreator.canEnterIntoAdaptPane()) { + clipboard.removeCreator(xCreator); } } - } - return newSelection; + return clipboard; } private static boolean isExtraContainer(XLayoutContainer parent) { From ab761bb2f39d2efa1ad4ab51a96299b7d787e213 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 27 Aug 2021 14:59:28 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-58250=20=E6=96=87=E4=BB=B6=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=99=A8=E5=BC=B9=E7=AA=97-=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=BC=B9=E7=AA=97=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=EF=BC=8C=E9=9C=80=E8=A6=81=E6=9C=89zip?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/share/action/InstallComponentAction.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java index fd03dc72a1..05780a6b09 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java @@ -52,7 +52,8 @@ public class InstallComponentAction extends UpdateAction { title(Toolkit.i18nText("Fine-Design_Basic_Select")). filters(new FileChooser.ExtensionFilter[]{ new FileChooser.ExtensionFilter("reu", "*.reu"), - new FileChooser.ExtensionFilter("reus", "*.reus")}). + new FileChooser.ExtensionFilter("reus", "*.reus"), + new FileChooser.ExtensionFilter("zip", "*.zip")}). build(); int returnValue = fileChooserProvider.showDialog(null); installComponent(returnValue, fileChooserProvider.getSelectedFiles()); From 9174570f938aacb78bc75238a32876cc7f14fdfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 27 Aug 2021 16:16:08 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-58267=20=E3=80=90FRM=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E6=8E=A8=E8=8D=90=E3=80=91=E7=BB=84=E4=BB=B6=E5=A4=8D?= =?UTF-8?q?=E7=94=A8-=E6=89=8B=E5=8A=A8=E9=97=B4=E8=B7=9D=E5=90=8E?= =?UTF-8?q?=E6=9C=9F=E9=9C=80=E8=A6=81=E4=BC=98=E5=8C=96=EF=BC=8C=E6=9A=82?= =?UTF-8?q?=E6=97=B6=E5=85=88=E5=B1=8F=E8=94=BD=E6=8E=89=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E4=B8=8A=E7=9A=84=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java index 0263df5bf9..ffd2a0f74e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java @@ -62,9 +62,6 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { }, new Component[] { createAutoSpacingPane() - }, - new Component[] { - createManualSpacingPane() } }; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 16);