Browse Source

Merge pull request #1320 in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit '867012b3b1c16abeb4d2641ed5968bd9cd837c6f':
  REPORT-24085 稳定共创:在文件树二级目录下删除模板,会直接跳到上一级目录 by joe.jiang
feature/big-screen
Hades 5 years ago
parent
commit
66cdc4947b
  1. 14
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  2. 5
      designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java

14
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<ExpandMutableTreeNode> nodes) {

5
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);
}

Loading…
Cancel
Save