From 9eb4939bac4a6f276415158abcf53e8fd35f99c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvan-=E6=AC=A7=E9=98=B3=E5=B8=86?= Date: Thu, 16 Feb 2023 18:49:33 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-89957=20=E6=95=B0=E6=8D=AE=E8=84=B1?= =?UTF-8?q?=E6=95=8F-=E6=9C=AC=E5=9C=B0=E8=A7=84=E5=88=99=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BF=9D=E5=AD=98=20=E3=80=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E3=80=91=E8=BF=98=E6=98=AF=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E8=A7=84=E5=88=99=E8=BF=99=E8=BE=B9=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E6=9C=89=E5=A5=BD=E5=87=A0=E4=B8=AA=201.=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=A7=84=E5=88=99=E8=A7=A6=E5=8F=91=E7=9A=84updateRul?= =?UTF-8?q?e=E6=96=B9=E6=B3=95=EF=BC=8C=E5=8F=AA=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E4=BA=86=E4=BF=AE=E6=94=B9=E5=90=8E=E7=9A=84=E8=A7=84=E5=88=99?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=89=8D=E7=9A=84=E8=A7=84=E5=88=99?= =?UTF-8?q?=E6=9C=AA=E8=A2=AB=E7=A7=BB=E9=99=A4=202.=20=E8=A7=84=E5=88=99?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98=EF=BC=8CResourceIOUtils.tr?= =?UTF-8?q?yWrite=E6=8E=A5=E5=8F=A3=E5=9C=A8=E8=BF=9C=E7=A8=8B=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=8B=E6=9C=89=E9=97=AE=E9=A2=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6=96=B0=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A7=E8=A7=84=E5=88=99=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=96=B0=E8=A7=84=E5=88=99=202.=20ResourceIOUtils.try?= =?UTF-8?q?Write=E6=8D=A2=E6=88=90=E6=9C=AC=E5=9C=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=9A=84IO=E6=96=B9=E6=B3=95=203.=20?= =?UTF-8?q?=E6=AF=8F=E6=AC=A1=E6=89=93=E5=BC=80=E6=89=80=E6=9C=89=E8=A7=84?= =?UTF-8?q?=E5=88=99=E5=B1=95=E7=A4=BA=E7=9A=84=E9=A1=B5=E9=9D=A2=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=EF=BC=8C=E5=88=B7=E6=96=B0=E4=B8=80=E4=B8=8B=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E8=A7=84=E5=88=99=E7=BC=93=E5=AD=98=20=E3=80=90review?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/rule/DesensitizationRuleChoosePane.java | 13 ++++++++++--- .../setting/TableDataDesensitizationTableModel.java | 10 ++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java index 419299336e..11e30a2e9f 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java @@ -275,18 +275,25 @@ public class DesensitizationRuleChoosePane extends JPanel { @Override public void actionPerformed(ActionEvent e) { - // 获取当前选中规则 - DesensitizationRule selectedValue = getSelectedValue(); + // 获取当前选中规则的副本 + DesensitizationRule selectedValue = null; + try { + selectedValue = (DesensitizationRule) getSelectedValue().clone(); + } catch (CloneNotSupportedException ex) { + throw new RuntimeException(ex); + } DesensitizationRuleEditPane editPane = new DesensitizationRuleEditPane(getCurrentExistRuleNames(selectedValue.getRuleName())); editPane.populateBean(selectedValue); + final DesensitizationRule finalRule = selectedValue; BasicDialog basicDialog = editPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(parent), new DialogActionAdapter() { @Override public void doOk() { DesensitizationRule rule = editPane.updateBean(); // 修改同步到RuleManager中 if (DesensitizationRule.valid(rule)) { - DesensitizationRuleManager.getInstance().updateRule(rule); + DesensitizationRuleManager.getInstance().updateRule(finalRule, rule); } + setSelectedValue(rule); fireTableDataChanged(); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java index f050e4b0cd..52b7e5b19b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java @@ -250,6 +250,8 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter customRules = DesensitizationRuleManager.getInstance().getRulesBySource(DesensitizationRuleSource.CUSTOM); + latestRules.put(DesensitizationRuleSource.CUSTOM, customRules); + } + }