BrightSide Workbench Full Report + Source Code
org.turro.zkoss.text.RepositoriesTree Class Reference
Inheritance diagram for org.turro.zkoss.text.RepositoriesTree:
Collaboration diagram for org.turro.zkoss.text.RepositoriesTree:

Public Member Functions

 RepositoriesTree ()
 
File getSelectedRepository ()
 
void createFolder ()
 
void selectFolder (String folder)
 
void deleteFolder ()
 

Static Public Member Functions

static boolean isPublishable (File file)
 
static String getEntityPath (File file)
 

Static Public Attributes

static final String REPOSITORY_DIR = "/_internal/repository"
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 40 of file RepositoriesTree.java.

Constructor & Destructor Documentation

◆ RepositoriesTree()

org.turro.zkoss.text.RepositoriesTree.RepositoriesTree ( )

Definition at line 47 of file RepositoriesTree.java.

47  {
48  addFolder(I_.get("Root"), new File(ElephantContext.getRealPath("/")), REPOSITORY_DIR);
49  addFolder(I_.get("Publication"), new File(ElephantContext.getRealPath(REPOSITORY_PUBLICATION)), "");
50  addFolder(I_.get("Publishable"), new File(ElephantContext.getRealPath(REPOSITORY_PUBLISHABLE)), "");
51  }
Here is the call graph for this function:

Member Function Documentation

◆ createFolder()

void org.turro.zkoss.text.RepositoriesTree.createFolder ( )

Definition at line 57 of file RepositoriesTree.java.

57  {
58  InputDialog.getInput(getPage(), I_.get("Folder"), "Name", "",
59  null, 0, new Command() {
60  @Override
61  public Object execute(Context context) {
62  String name = (String) context.get("value");
63  if(!Strings.isBlank(name)) {
64  File folder = getSelectedRepository();
65  if(folder != null && folder.isDirectory()) {
66  folder = new File(folder, name);
67  folder.mkdir();
68  addFolderOnSelected(folder.getName(), folder, "");
69  }
70  }
71  return null;
72  }
73  });
74  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteFolder()

void org.turro.zkoss.text.RepositoriesTree.deleteFolder ( )

Definition at line 112 of file RepositoriesTree.java.

112  {
113  final File folder = getSelectedRepository();
114  if(folder != null) {
115  Messages.confirmDeletion().add(folder.getName()).show(() -> {
116  FileUtil.deleteFile(folder);
117  });
118  }
119  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntityPath()

static String org.turro.zkoss.text.RepositoriesTree.getEntityPath ( File  file)
static

Definition at line 125 of file RepositoriesTree.java.

125  {
126  String path = file.getAbsolutePath();
127  return path.substring(path.indexOf(REPOSITORY_PUBLISHABLE) + REPOSITORY_PUBLISHABLE.length());
128  }

◆ getSelectedRepository()

File org.turro.zkoss.text.RepositoriesTree.getSelectedRepository ( )

Definition at line 53 of file RepositoriesTree.java.

53  {
54  return ((RepositoryItem) getSelectedItem()).getRepositoryFile();
55  }
Here is the caller graph for this function:

◆ isPublishable()

static boolean org.turro.zkoss.text.RepositoriesTree.isPublishable ( File  file)
static

Definition at line 121 of file RepositoriesTree.java.

121  {
122  return file.getAbsolutePath().startsWith(ElephantContext.getRealPath(REPOSITORY_PUBLISHABLE));
123  }
Here is the call graph for this function:

◆ selectFolder()

void org.turro.zkoss.text.RepositoriesTree.selectFolder ( String  folder)

Definition at line 97 of file RepositoriesTree.java.

97  {
98  for(Treeitem ti : getItems()) {
99  RepositoryItem ri = (RepositoryItem) ti;
100  if(ri.isFolder(folder)) {
101  setSelectedItem(ti);
102  while(ti != null) {
103  ti.setOpen(true);
104  ti = ti.getParentItem();
105  }
106  Events.postEvent(new Event(Events.ON_SELECT, RepositoriesTree.this));
107  break;
108  }
109  }
110  }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ REPOSITORY_DIR

final String org.turro.zkoss.text.RepositoriesTree.REPOSITORY_DIR = "/_internal/repository"
static

Definition at line 43 of file RepositoriesTree.java.


The documentation for this class was generated from the following file: