19 package org.turro.zkoss.text;
22 import org.amic.util.file.FileUtil;
23 import org.turro.string.Strings;
24 import org.turro.command.Command;
25 import org.turro.command.Context;
26 import org.turro.elephant.context.ElephantContext;
27 import org.turro.elephant.util.Messages;
28 import org.turro.i18n.I_;
29 import org.turro.zkoss.dialog.InputDialog;
30 import org.zkoss.zk.ui.event.Event;
31 import org.zkoss.zk.ui.event.Events;
32 import org.zkoss.zul.Tree;
33 import org.zkoss.zul.Treechildren;
34 import org.zkoss.zul.Treeitem;
42 public static final String
44 REPOSITORY_PUBLICATION =
"/_internal/UserFiles",
45 REPOSITORY_PUBLISHABLE =
"/_internal/files";
59 null, 0,
new Command() {
61 public Object execute(Context context) {
62 String name = (String) context.get(
"value");
63 if(!Strings.isBlank(name)) {
65 if(folder !=
null && folder.isDirectory()) {
66 folder =
new File(folder, name);
68 addFolderOnSelected(folder.getName(), folder,
"");
76 private void addFolder(String name, File file, String path) {
77 Treechildren children = getTreechildren();
78 if(children ==
null) {
79 children =
new Treechildren();
80 appendChild(children);
82 children.appendChild(
new RepositoryItem(file, name, path));
85 private void addFolderOnSelected(String name, File file, String path) {
86 Treeitem ti = getSelectedItem();
88 Treechildren children = ti.getTreechildren();
89 if(children ==
null) {
90 children =
new Treechildren();
91 ti.appendChild(children);
93 children.appendChild(
new RepositoryItem(file, name, path));
98 for(Treeitem ti : getItems()) {
104 ti = ti.getParentItem();
126 String path = file.getAbsolutePath();
127 return path.substring(path.indexOf(REPOSITORY_PUBLISHABLE) + REPOSITORY_PUBLISHABLE.length());
static String getRealPath(String path)
static Messages confirmDeletion()
Messages add(String word)
static String get(String msg)
static final String REPOSITORY_DIR
static boolean isPublishable(File file)
void selectFolder(String folder)
static String getEntityPath(File file)
File getSelectedRepository()
boolean isFolder(String folder)