Browse Source

Merge pull request #352 in DESIGN/design from ~YAOH.WU/design:release/10.0 to release/10.0

* commit '08d50e01bac8317003ce7aa3fa15db5a01bd184b':
  REPORT-10511 远程设计权限全选和未选问题
final/10.0
yaoh.wu 6 years ago
parent
commit
e023a43196
  1. 12
      designer-base/src/main/java/com/fr/design/remote/ui/AuthorityEditorPane.java
  2. 10
      designer-base/src/main/java/com/fr/design/remote/ui/tree/FileAuthorityTree.java

12
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.design.remote.ui.tree.FileAuthorityTree;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.IOFileNodeFilter; import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.report.DesignAuthority; import com.fr.report.DesignAuthority;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
@ -60,7 +60,12 @@ public class AuthorityEditorPane extends BasicBeanPane<DesignAuthority> {
} }
String[] paths = new String[items.length]; String[] paths = new String[items.length];
for (int i = 0; i < items.length; i++) { 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); tree.selectCheckBoxPaths(paths);
} }
@ -83,7 +88,8 @@ public class AuthorityEditorPane extends BasicBeanPane<DesignAuthority> {
type = type && fileNode.isDirectory(); type = type && fileNode.isDirectory();
tempSpot.append(fileNode.getName()); 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])); da.setItems(items.toArray(new DesignAuthority.Item[0]));
return da; return da;

10
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])); 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) { private TreePath getSelectingPath(ExpandMutableTreeNode currentTreeNode, String prefix, String filePath, DefaultTreeModel model) {
FileNode fileNode = (FileNode) currentTreeNode.getUserObject(); FileNode fileNode = (FileNode) currentTreeNode.getUserObject();

Loading…
Cancel
Save