BrightSide Workbench Full Report + Source Code
org.turro.file.zul.control.FileControl Class Reference
Inheritance diagram for org.turro.file.zul.control.FileControl:
Collaboration diagram for org.turro.file.zul.control.FileControl:

Public Member Functions

void onChangeFolder ()
 
void onSelectFolder ()
 
void onSearchValue ()
 
void onRegexp ()
 
void onFullpath ()
 
void onPartial ()
 
void onSearch ()
 
void onLevelUp () throws Exception
 
void onNewFolder () throws Exception
 
void onUpload (UploadEvent event) throws Exception
 
void onSend () throws Exception
 
void onDownload () throws Exception
 
void onCopy () throws Exception
 
void onCut () throws Exception
 
void onPaste () throws Exception
 
void onDelete () throws Exception
 
void onEvent (UploadEvent event) throws Exception
 
 FileControl ()
 
Boolean getPublicOnly ()
 
void setPublicOnly (Boolean publicOnly)
 
boolean isReadOnly ()
 
void setReadOnly (boolean readOnly)
 
boolean isTreeCollapsed ()
 
void setTreeCollapsed (boolean treeCollapsed)
 
String getLabel ()
 
void setLabel (String label)
 
String getPath ()
 
void setPath (String path)
 
void setEntity (Object entity)
 
void refreshControls ()
 
FileTree getTreeFolder ()
 
void afterCompose ()
 
void selectFirst ()
 

Detailed Description

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

Definition at line 60 of file FileControl.java.

Constructor & Destructor Documentation

◆ FileControl()

org.turro.file.zul.control.FileControl.FileControl ( )

Definition at line 265 of file FileControl.java.

265  {
266  Executions.createComponents("/WEB-INF/_zul/bs/comps/attachment/fileControl.zul", this, null);
267  Selectors.wireComponents(this, this, false);
268  Selectors.wireEventListeners(this, this);
269  path = SECURED;
270  }

Member Function Documentation

◆ afterCompose()

void org.turro.file.zul.control.FileControl.afterCompose ( )

Reimplemented in org.turro.file.zul.navigator.SelfFileNavigator, org.turro.file.zul.navigator.RootFileNavigator, org.turro.file.zul.navigator.RepositoryFileNavigator, and org.turro.file.zul.navigator.MyDocumentsNavigator.

Definition at line 338 of file FileControl.java.

338  {
339  initResults();
340  initComponents();
341  panelFolder.setOpen(!treeCollapsed);
342  if(!SECURED.equals(path)) {
343  if(entity) {
344  FileFolder publicFolder = treeFolder.addFolder(I_.get("Publishable") +
345  Chars.forward().spaced().toString() + label, new FileAttach(path).getPublishable(), true);
346  panelFolder.setTitle(label);
347  publicFolder.showContents();
348  if(Application.getApplication().isInRole("file-attach:private")) {
349  FileFolder privateFolder = treeFolder.addFolder(label, new FileAttach(path).getPrivate(), true);
350  panelFolder.setTitle(label);
351  privateFolder.showContents();
352  }
353  } else {
354  if(!Strings.isBlank(path)) {
355  String[] paths = path.split("\\|");
356  String[] labels = label.split("\\|");
357  for(int i = 0; i < paths.length; i++) {
358  FileFolder rootFolder = treeFolder.addFolder(labels[i], paths[i], true);
359  panelFolder.setTitle(labels[i]);
360  rootFolder.showContents();
361  }
362  }
363  }
364  selectFirst();
365  delete.setDisabled(!Application.getApplication().isInRole("file-attach:delete") || readOnly);
366  } else {
367  panelFolder.setTitle("");
368  treeFolder.resetTree();
369  fileGrid.setCurrentFolder(null);
370  newFolder.setDisabled(true);
371  upload.setDisabled(true);
372  send.setDisabled(true);
373  levelUp.setDisabled(true);
374  copy.setDisabled(true);
375  cut.setDisabled(true);
376  paste.setDisabled(true);
377  delete.setDisabled(true);
378  }
379  }
void setCurrentFolder(FileFolder currentFolder)
FileFolder addFolder(String label, String path, boolean loadOnDemand)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLabel()

String org.turro.file.zul.control.FileControl.getLabel ( )

Definition at line 296 of file FileControl.java.

296  {
297  return label;
298  }

◆ getPath()

String org.turro.file.zul.control.FileControl.getPath ( )

Definition at line 304 of file FileControl.java.

304  {
305  return path;
306  }

◆ getPublicOnly()

Boolean org.turro.file.zul.control.FileControl.getPublicOnly ( )

Definition at line 272 of file FileControl.java.

272  {
273  return publicOnly;
274  }

◆ getTreeFolder()

FileTree org.turro.file.zul.control.FileControl.getTreeFolder ( )

Definition at line 333 of file FileControl.java.

333  {
334  return treeFolder;
335  }

◆ isReadOnly()

boolean org.turro.file.zul.control.FileControl.isReadOnly ( )

Definition at line 280 of file FileControl.java.

280  {
281  return readOnly;
282  }

◆ isTreeCollapsed()

boolean org.turro.file.zul.control.FileControl.isTreeCollapsed ( )

Definition at line 288 of file FileControl.java.

288  {
289  return treeCollapsed;
290  }

◆ onChangeFolder()

void org.turro.file.zul.control.FileControl.onChangeFolder ( )

Definition at line 118 of file FileControl.java.

118  {
119  currentFolder = (FileFolder) treeFolder.getSelectedFolder().getParentFolder();
120  if(currentFolder == null) {
121  treeFolder.reloadContents();
122  treeFolder.selectFirst();
123  currentFolder = treeFolder.getSelectedFolder();
124  } else {
125  currentFolder.reloadContents();
126  fileGrid.setCurrentFolder(currentFolder);
127  }
128  updateButtons();
129  }
Here is the call graph for this function:

◆ onCopy()

void org.turro.file.zul.control.FileControl.onCopy ( ) throws Exception

Definition at line 223 of file FileControl.java.

223  {
224  FileClipboard.copyFolder(currentFolder.getRealFolder());
225  }
Here is the call graph for this function:

◆ onCut()

void org.turro.file.zul.control.FileControl.onCut ( ) throws Exception

Definition at line 228 of file FileControl.java.

228  {
229  FileClipboard.cutFolder(currentFolder.getLabel(), currentFolder.getRealFolder());
230  }
Here is the call graph for this function:

◆ onDelete()

void org.turro.file.zul.control.FileControl.onDelete ( ) throws Exception

Definition at line 242 of file FileControl.java.

242  {
243  if(Application.getApplication().isInRole("file-attach:delete")) {
244  Messages.confirmDeletion().show(() -> {
245  for(File f : currentFolder.getFiles()) {
246  f.delete();
247  if(treeFolder.getFileListener() != null) {
248  treeFolder.getFileListener().deleteDone(f);
249  }
250  }
251  treeFolder.setSelectedItem(currentFolder);
252  fileGrid.setCurrentFolder(currentFolder);
253  });
254  }
255  }
Here is the call graph for this function:

◆ onDownload()

void org.turro.file.zul.control.FileControl.onDownload ( ) throws Exception

Definition at line 213 of file FileControl.java.

213  {
214  FileFolder af = fileGrid.getCurrentFolder();
215  if(af != null) {
216  File targetZip = File.createTempFile("attach_", "_folder.zip");
217  Compress.zip(af.getRealFolder().toPath(), targetZip.toPath());
218  Filedownload.save(targetZip, "application/zip");
219  }
220  }
Here is the call graph for this function:

◆ onEvent()

void org.turro.file.zul.control.FileControl.onEvent ( UploadEvent  event) throws Exception

Definition at line 258 of file FileControl.java.

258  {
259  if(currentFolder != null) {
260  currentFolder.addMedias(event.getMedias());
261  fileGrid.setCurrentFolder(currentFolder);
262  }
263  }

◆ onFullpath()

void org.turro.file.zul.control.FileControl.onFullpath ( )

Definition at line 149 of file FileControl.java.

149  {
150  results.setPath(fullpath.isChecked());
151  }
Here is the call graph for this function:

◆ onLevelUp()

void org.turro.file.zul.control.FileControl.onLevelUp ( ) throws Exception

Definition at line 165 of file FileControl.java.

165  {
166  if(currentFolder != null && currentFolder.getParentItem() != null) {
167  currentFolder = (FileFolder) currentFolder.getParentItem();
168  treeFolder.setSelectedItem(currentFolder);
169  fileGrid.setCurrentFolder(currentFolder);
170  updateButtons();
171  }
172  }
Here is the call graph for this function:

◆ onNewFolder()

void org.turro.file.zul.control.FileControl.onNewFolder ( ) throws Exception

Definition at line 175 of file FileControl.java.

175  {
176  if(currentFolder != null) {
177  currentFolder.doAddFolder();
178  currentFolder.reloadContents();
179  fileGrid.setCurrentFolder(currentFolder);
180  }
181  }
Here is the call graph for this function:

◆ onPartial()

void org.turro.file.zul.control.FileControl.onPartial ( )

Definition at line 154 of file FileControl.java.

154  {
155  results.setPartial(partial.isChecked());
156  }
Here is the call graph for this function:

◆ onPaste()

void org.turro.file.zul.control.FileControl.onPaste ( ) throws Exception

Definition at line 233 of file FileControl.java.

233  {
234  FileClipboard.paste(currentFolder.getRealFolder());
235  treeFolder.setSelectedItem(currentFolder);
236  currentFolder.reloadContents();
237  fileGrid.setCurrentFolder(currentFolder);
238  paste.setDisabled(true);
239  }
Here is the call graph for this function:

◆ onRegexp()

void org.turro.file.zul.control.FileControl.onRegexp ( )

Definition at line 144 of file FileControl.java.

144  {
145  results.setRegexp(regexp.isChecked());
146  }
Here is the call graph for this function:

◆ onSearch()

void org.turro.file.zul.control.FileControl.onSearch ( )

Definition at line 159 of file FileControl.java.

159  {
160  treeFolder.reloadContents();
161  selectFirst();
162  }
Here is the call graph for this function:

◆ onSearchValue()

void org.turro.file.zul.control.FileControl.onSearchValue ( )

Definition at line 139 of file FileControl.java.

139  {
140  results.setSearchValue(searchValue.getValue());
141  }
void setSearchValue(String searchValue)
Here is the call graph for this function:

◆ onSelectFolder()

void org.turro.file.zul.control.FileControl.onSelectFolder ( )

Definition at line 132 of file FileControl.java.

132  {
133  currentFolder = treeFolder.getSelectedFolder();
134  updateButtons();
135  fileGrid.setCurrentFolder(currentFolder);
136  }
Here is the call graph for this function:

◆ onSend()

void org.turro.file.zul.control.FileControl.onSend ( ) throws Exception

Definition at line 192 of file FileControl.java.

192  {
193  SendAttachments sa = new SendAttachments(I_.get("Attachment")) {
194  @Override
195  protected void fillAttachment(File attachment, Object entity) {
196  try {
197  FileUtils.copyFile((File) entity, attachment);
198  } catch (IOException ex) {
199  Logger.getLogger(FileControl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
200  }
201  }
202  };
203  FileFolder af = fileGrid.getCurrentFolder();
204  if(af != null) {
205  for(File file : af.getFiles()) {
206  sa.addAttachment(file, file.getName(), file.getName());
207  }
208  }
209  sa.sendAttachments(null);
210  }
Here is the call graph for this function:

◆ onUpload()

void org.turro.file.zul.control.FileControl.onUpload ( UploadEvent  event) throws Exception

Definition at line 184 of file FileControl.java.

184  {
185  if(currentFolder != null) {
186  currentFolder.addMedias(event.getMedias());
187  fileGrid.setCurrentFolder(currentFolder);
188  }
189  }
Here is the call graph for this function:

◆ refreshControls()

void org.turro.file.zul.control.FileControl.refreshControls ( )

Implements org.turro.action.IEntityHolder.

Definition at line 329 of file FileControl.java.

329  {
330  afterCompose();
331  }

◆ selectFirst()

void org.turro.file.zul.control.FileControl.selectFirst ( )

Definition at line 395 of file FileControl.java.

395  {
396  currentFolder = treeFolder.selectFirst();
397  updateButtons();
398  fileGrid.setCurrentFolder(currentFolder);
399  }
Here is the caller graph for this function:

◆ setEntity()

void org.turro.file.zul.control.FileControl.setEntity ( Object  entity)

Implements org.turro.action.IEntityHolder.

Definition at line 314 of file FileControl.java.

314  {
315  IElephantEntity iee = Entities.getController(entity);
316  path = iee.getPath();
317  this.entity = true;
318  if(Strings.isBlank(path)) {
319  path = SECURED;
320  } else {
321  label = iee.getName();
322  }
323  treeFolder.setDoProcessors(false);
324  treeFolder.resetTree();
325  fileGrid.setCurrentFolder(null);
326  }
void setDoProcessors(boolean doProcessors)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLabel()

void org.turro.file.zul.control.FileControl.setLabel ( String  label)

Definition at line 300 of file FileControl.java.

300  {
301  this.label = label;
302  }
Here is the caller graph for this function:

◆ setPath()

void org.turro.file.zul.control.FileControl.setPath ( String  path)

Definition at line 308 of file FileControl.java.

308  {
309  this.path = path;
310  treeFolder.resetTree();
311  }
Here is the caller graph for this function:

◆ setPublicOnly()

void org.turro.file.zul.control.FileControl.setPublicOnly ( Boolean  publicOnly)

Definition at line 276 of file FileControl.java.

276  {
277  this.publicOnly = publicOnly;
278  }

◆ setReadOnly()

void org.turro.file.zul.control.FileControl.setReadOnly ( boolean  readOnly)

Definition at line 284 of file FileControl.java.

284  {
285  this.readOnly = readOnly;
286  }

◆ setTreeCollapsed()

void org.turro.file.zul.control.FileControl.setTreeCollapsed ( boolean  treeCollapsed)

Definition at line 292 of file FileControl.java.

292  {
293  this.treeCollapsed = treeCollapsed;
294  }

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