Browse Source

Merge remote-tracking branch 'origin/final/11.0' into final/11.0

new-design
Leo.Qin 2 years ago
parent
commit
e221b188f5
  1. 13
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java
  2. 10
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java

13
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();
}

10
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<Tabl
private ActionListener chooseRuleListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// 重新获取一下本地规则缓存
refreshCustomRuleCache();
DesensitizationRulePane rulePane = new DesensitizationRulePane(latestRules);
TableDataDesensitizationItem desensitizationItem = getCurrentSelectBean();
int selectedRow = table.getSelectedRow();
@ -606,4 +608,12 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
DesensitizationRuleManager.getInstance().getRuleStatus(rule, latestRules) != DesensitizationRuleStatus.NORMAL;
}
/**
* 刷新当前页面的本地规则缓存查询最新本地规则的逻辑也是使用了缓存因此无需考虑耗时
*/
private void refreshCustomRuleCache() {
Map<String, DesensitizationRule> customRules = DesensitizationRuleManager.getInstance().getRulesBySource(DesensitizationRuleSource.CUSTOM);
latestRules.put(DesensitizationRuleSource.CUSTOM, customRules);
}
}

Loading…
Cancel
Save