From 08d50e01bac8317003ce7aa3fa15db5a01bd184b Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 9 Aug 2018 19:46:46 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-10511=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E6=9D=83=E9=99=90=E5=85=A8=E9=80=89=E5=92=8C=E6=9C=AA?= =?UTF-8?q?=E9=80=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/remote/ui/AuthorityEditorPane.java | 12 +++++++++--- .../fr/design/remote/ui/tree/FileAuthorityTree.java | 10 ++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java index cf81ba5d40..b85e49fcfd 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java @@ -8,9 +8,9 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.remote.ui.tree.FileAuthorityTree; import com.fr.file.filetree.FileNode; import com.fr.file.filetree.IOFileNodeFilter; - import com.fr.report.DesignAuthority; import com.fr.stable.CoreConstants; +import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.border.EmptyBorder; @@ -60,7 +60,12 @@ public class AuthorityEditorPane extends BasicBeanPane { } String[] paths = new String[items.length]; for (int i = 0; i < items.length; i++) { - paths[i] = items[i].getPath(); + String iPath = items[i].getPath(); + if (CoreConstants.SEPARATOR.equals(iPath)) { + tree.selectAllCheckBoxPaths(); + return; + } + paths[i] = iPath; } tree.selectCheckBoxPaths(paths); } @@ -83,7 +88,8 @@ public class AuthorityEditorPane extends BasicBeanPane { type = type && fileNode.isDirectory(); tempSpot.append(fileNode.getName()); } - items.add(new DesignAuthority.Item(tempSpot.toString(), type)); + String path = tempSpot.toString(); + items.add(new DesignAuthority.Item(StringUtils.isEmpty(path) ? CoreConstants.SEPARATOR : path, type)); } da.setItems(items.toArray(new DesignAuthority.Item[0])); return da; diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/tree/FileAuthorityTree.java b/designer-base/src/main/java/com/fr/design/remote/ui/tree/FileAuthorityTree.java index 2b22703f77..feb3895169 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/tree/FileAuthorityTree.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/tree/FileAuthorityTree.java @@ -42,6 +42,16 @@ public class FileAuthorityTree extends TemplateFileTree { this.getCheckBoxTreeSelectionModel().setSelectionPaths(res.toArray(new TreePath[0])); } + /** + * 全选 + */ + public void selectAllCheckBoxPaths() { + DefaultTreeModel model = (DefaultTreeModel) this.getModel(); + ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) model.getRoot(); + TreePath path = new TreePath(model.getPathToRoot(treeNode)); + getCheckBoxTreeSelectionModel().setSelectionPaths(new TreePath[]{path}); + } + private TreePath getSelectingPath(ExpandMutableTreeNode currentTreeNode, String prefix, String filePath, DefaultTreeModel model) { FileNode fileNode = (FileNode) currentTreeNode.getUserObject();