Browse Source

Merge remote-tracking branch 'origin/release/10.0' into release/10.0

final/10.0
Harrison 6 years ago
parent
commit
1b0c8adf70
  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.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<DesignAuthority> {
}
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<DesignAuthority> {
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;

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]));
}
/**
* 全选
*/
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();

Loading…
Cancel
Save