From 867012b3b1c16abeb4d2641ed5968bd9cd837c6f Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 28 Nov 2019 10:28:04 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-24085=20=E7=A8=B3=E5=AE=9A=E5=85=B1?= =?UTF-8?q?=E5=88=9B=EF=BC=9A=E5=9C=A8=E6=96=87=E4=BB=B6=E6=A0=91=E4=BA=8C?= =?UTF-8?q?=E7=BA=A7=E7=9B=AE=E5=BD=95=E4=B8=8B=E5=88=A0=E9=99=A4=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E4=BC=9A=E7=9B=B4=E6=8E=A5=E8=B7=B3=E5=88=B0?= =?UTF-8?q?=E4=B8=8A=E4=B8=80=E7=BA=A7=E7=9B=AE=E5=BD=95=20by=20joe.jiang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/TemplateTreePane.java | 14 +++++++++++++- .../itree/refreshabletree/RefreshableJTree.java | 5 +++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index ed63b06cef..1708c07533 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -44,6 +44,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; +import java.util.Objects; import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.YES_NO_OPTION; @@ -299,7 +300,18 @@ public class TemplateTreePane extends JPanel implements FileOperations { } } } - reportletsTree.refresh(); + refreshAfterDelete(); + } + + private void refreshAfterDelete() { + TreePath[] paths = reportletsTree.getSelectionPaths(); + if (paths == null) { + reportletsTree.refresh(); + } else { + for (TreePath path : Objects.requireNonNull(reportletsTree.getSelectionPaths())) { + reportletsTree.refreshParent(path); + } + } } private boolean deleteNodes(Collection nodes) { diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java index b2008f3867..a22f2a302a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java @@ -145,6 +145,11 @@ public abstract class RefreshableJTree extends CheckBoxTree { refresh((ExpandMutableTreeNode) this.getModel().getRoot(), StringUtils.EMPTY); } + //REPORT-24085,只刷新父节点 + public void refreshParent(TreePath path) { + refresh((ExpandMutableTreeNode) path.getParentPath().getLastPathComponent(), StringUtils.EMPTY); + } + public void refreshChildByName(String childName) { refresh((ExpandMutableTreeNode) this.getModel().getRoot(), childName); }