From 2185496cb52d7a101ea66adde1a34b20229fc835 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 12 Apr 2022 11:23:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-68987=20=E6=8A=8A=E9=AB=98=E7=BA=A7?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=BD=93=E4=BD=9C=E5=8F=AF=E9=80=89=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/javascript/JSContentPane.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java index 65bec03a8..c9344f5ca 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java @@ -63,7 +63,9 @@ public class JSContentPane extends BasicPane { initFunctionTitle(args); JPanel jsParaPane = createJSParaPane(); - addNewPaneLabel(); + if (needAdvancedEditor()) { + addNewPaneLabel(); + } this.add(jsParaPane, BorderLayout.NORTH); UIScrollPane sp = createContentTextAreaPanel(); @@ -323,4 +325,8 @@ public class JSContentPane extends BasicPane { return provider; } + + protected boolean needAdvancedEditor() { + return true; + } } \ No newline at end of file From bb4279b19c0d109f6e96d87d0b82c3326e0d46c8 Mon Sep 17 00:00:00 2001 From: wtianye <10320502+wtianye@user.noreply.gitee.com> Date: Tue, 10 May 2022 15:37:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-71207=20=E5=9C=BA=E6=99=AF=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E5=88=A0=E9=99=A4=E8=B6=85=E9=93=BE=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E7=9A=84=E2=80=9C=E5=8F=96=E6=B6=88=E2=80=9D=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/designer/component/VanChartUIListControlPane.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java index bfa8b43e9..ba66c0392 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java @@ -173,12 +173,8 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem JPanel buttonsPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0)); controlPane.add(buttonsPane, BorderLayout.EAST); - //确定 addOkButton(buttonsPane); - //取消 - addCancelButton(buttonsPane); - controlPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); return controlPane; From 04435927b963c0fd63af039fd671a5aa59431fd5 Mon Sep 17 00:00:00 2001 From: rinoux Date: Tue, 10 May 2022 16:45:14 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-69285=20=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=AE=89=E5=85=A8=E5=85=B3=E9=94=AE=E5=AD=97=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=8B=A6=E6=88=AA=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConnectionListDialogActionAdapter.java | 12 +++++++++- .../datapane/connect/ConnectionListPane.java | 23 +++++++++++++++++-- .../connect/ConnectionManagerPane.java | 7 +++--- .../datapane/connect/ConnectionShowPane.java | 2 +- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java index 2428c9a00..947cb6e75 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListDialogActionAdapter.java @@ -2,11 +2,15 @@ package com.fr.design.data.datapane.connect; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.editlock.EditLockUtils; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.file.ConnectionConfig; import com.fr.report.LockItem; +import javax.swing.JOptionPane; + /** * @author hades * @version 11.0 @@ -32,7 +36,13 @@ public class ConnectionListDialogActionAdapter extends DialogActionAdapter { connectionListDialog.setDoOKSucceed(false); return; } - connectionManagerPane.update(connectionConfig); + try { + connectionManagerPane.update(connectionConfig); + } catch (Exception e) { + connectionListDialog.setDoOKSucceed(false); + FineJOptionPane.showMessageDialog(connectionManagerPane, e.getMessage(), Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); + return; + } DesignerContext.getDesignerBean("databasename").refreshBeanElement(); // 关闭定义数据连接页面,为其解锁 EditLockUtils.unlock(LockItem.CONNECTION); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 12c62b435..e4deae04b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -1,6 +1,7 @@ package com.fr.design.data.datapane.connect; import com.fr.config.RemoteConfigEvent; +import com.fr.data.core.db.JDBCSecurityChecker; import com.fr.data.impl.Connection; import com.fr.data.impl.ConnectionBean; import com.fr.data.impl.JDBCDatabaseConnection; @@ -28,6 +29,7 @@ import com.fr.transaction.WorkerFacade; import com.fr.workspace.WorkContext; import java.awt.Window; +import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -166,7 +168,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh /** * Update. */ - public void update(ConnectionConfig connectionConfig) { + public void update(ConnectionConfig connectionConfig) throws Exception { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); Map updatedMap = new LinkedHashMap<>(); @@ -188,10 +190,27 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } }); - + this.checkSecurity(addedOrUpdatedConnections); this.alterConnections(removedConnNames, addedOrUpdatedConnections); } + + private void checkSecurity(List addedOrUpdatedConnections) throws Exception { + + for (ConnectionBean connectionBean : addedOrUpdatedConnections) { + Connection connection = connectionBean.getConnection(); + if (connection instanceof JDBCDatabaseConnection) { + try { + JDBCSecurityChecker.checkURL(((JDBCDatabaseConnection) connection).getURL()); + JDBCSecurityChecker.checkValidationQuery(((JDBCDatabaseConnection) connection).getDbcpAttr().getValidationQuery()); + } catch (SQLException e) { + throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", connectionBean.getName()) + ", " + e.getMessage(), e.getCause()); + } + } + } + + } + private void alterConnections(List removedConnNames, List addedOrUpdatedConnections) { try { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java index 6c768145f..eadf456e0 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java @@ -4,9 +4,8 @@ import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.file.ConnectionConfig; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; import java.util.HashMap; public class ConnectionManagerPane extends LoadingBasicPane implements ConnectionShowPane { @@ -39,7 +38,7 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio this.connectionListPane.populate(datasourceManager); } - public void update(ConnectionConfig datasourceManager) { + public void update(ConnectionConfig datasourceManager) throws Exception { this.connectionListPane.update(datasourceManager); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java index b5ae09be8..2b74ddcf9 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionShowPane.java @@ -7,7 +7,7 @@ import com.fr.file.ConnectionConfig; * 数据链接显示面板 */ public interface ConnectionShowPane { - void update(ConnectionConfig connectionConfig); + void update(ConnectionConfig connectionConfig) throws Exception; void populate(ConnectionConfig connectionConfig);