19 package org.turro.zkoss.text;
22 import org.turro.elephant.context.ElephantContext;
23 import org.turro.elephant.impl.util.StringParser;
24 import org.turro.entities.Entities;
25 import org.turro.file.Document;
26 import org.turro.file.Folder;
27 import org.turro.path.Path;
28 import org.zkoss.lang.Strings;
29 import org.zkoss.zul.Treechildren;
30 import org.zkoss.zul.Treeitem;
38 private final File file;
39 private final String path;
45 if(doProcessors(file)) {
52 return new File(file, path);
59 private void fillFolder() {
60 if(!Strings.isBlank(path)) {
62 Treechildren children = getTreechildren();
63 if(children ==
null) {
64 children =
new Treechildren();
65 appendChild(children);
67 children.appendChild(
new RepositoryItem(child, child.getName(),
""));
70 for(File child : file.listFiles(
new RepositoryFilter(path))) {
71 Treechildren children = getTreechildren();
72 if(children ==
null) {
73 children =
new Treechildren();
74 appendChild(children);
76 children.appendChild(
new RepositoryItem(child, child.getName(), path));
80 private boolean doProcessors(File file) {
81 if(RepositoriesTree.isPublishable(file)) {
82 if(Folder.from(file).removeEmpties()) {
86 Path p =
new Path(RepositoriesTree.getEntityPath(file));
87 if(p.getSize() > 0 && p.getSize() < 3) {
88 String str = Entities.getController(p.getPath()).getTreeLabel();
90 setLabel(StringParser.cutString(str, 50));
92 }
else if(p.getSize() == 2) {
93 Document.from(file).delete();
static String getRelativePath(String path)
RepositoryItem(File file, String name, String path)
boolean isFolder(String folder)