Browse Source

REPORT-9652 优化一下,减少RPC和数据库访问次数

【10.0二轮回归】部署集成-集群-大数据量模板加载时文件夹显示异常
research/10.0
ju 6 years ago
parent
commit
2ae7e2a073
  1. 9
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

9
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -179,8 +179,9 @@ public class TemplateFileTree extends EnvFileTree {
@Override @Override
protected ExpandMutableTreeNode[] loadChildTreeNodes(ExpandMutableTreeNode treeNode) { protected ExpandMutableTreeNode[] loadChildTreeNodes(ExpandMutableTreeNode treeNode) {
FileNode[] fnArray = listFileNodes(treeNode); FileNode[] fnArray = listFileNodes(treeNode);
return fileNodeArray2TreeNodeArray(fnArray); return fileNodeArray2TreeNodeArray(fnArray);
} }
@ -189,13 +190,14 @@ public class TemplateFileTree extends EnvFileTree {
*/ */
private ExpandMutableTreeNode[] fileNodeArray2TreeNodeArray(FileNode[] fileNodes) { private ExpandMutableTreeNode[] fileNodeArray2TreeNodeArray(FileNode[] fileNodes) {
boolean isLocal = WorkContext.getCurrent().isLocal(); boolean isLocal = WorkContext.getCurrent().isLocal();
boolean isRoot = WorkContext.getCurrent().isRoot();
ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[fileNodes.length]; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[fileNodes.length];
for (int i = 0; i < res.length; i++) { for (int i = 0; i < res.length; i++) {
FileNode fn = fileNodes[i]; FileNode fn = fileNodes[i];
res[i] = new ExpandMutableTreeNode(fn); res[i] = new ExpandMutableTreeNode(fn);
if (fn.isDirectory()) { if (fn.isDirectory()) {
res[i].add(new ExpandMutableTreeNode()); res[i].add(new ExpandMutableTreeNode());
if (isLocal || WorkContext.getCurrent().isRoot()) { if (isLocal || isRoot) {
res[i].setFullAuthority(true); res[i].setFullAuthority(true);
} else { } else {
boolean hasFullAuthority = isContained(fn); boolean hasFullAuthority = isContained(fn);
@ -203,7 +205,6 @@ public class TemplateFileTree extends EnvFileTree {
} }
} }
} }
return res; return res;
} }
@ -269,6 +270,7 @@ public class TemplateFileTree extends EnvFileTree {
* 求当前TreeNode下所有的FileNode. * 求当前TreeNode下所有的FileNode.
*/ */
private FileNode[] listFileNodes(ExpandMutableTreeNode currentTreeNode) { private FileNode[] listFileNodes(ExpandMutableTreeNode currentTreeNode) {
if (currentTreeNode == null) { if (currentTreeNode == null) {
return new FileNode[0]; return new FileNode[0];
} }
@ -276,6 +278,7 @@ public class TemplateFileTree extends EnvFileTree {
Object object = currentTreeNode.getUserObject(); Object object = currentTreeNode.getUserObject();
if (object instanceof FileNode) { if (object instanceof FileNode) {
return this.listFileNodes(((FileNode) object).getEnvPath()); return this.listFileNodes(((FileNode) object).getEnvPath());
} }

Loading…
Cancel
Save