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

Public Member Functions

void onSelectFolder ()
 
void onSearchValue ()
 
void onSearch ()
 
void onValidated ()
 
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
 
 AttachmentControl ()
 
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 ()
 
AttachTree getTreeFolder ()
 
void afterCompose ()
 
void selectFirst ()
 

Static Public Member Functions

static void showFor (Object entity, Consumer< Windows > onClose)
 

Detailed Description

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

Definition at line 62 of file AttachmentControl.java.

Constructor & Destructor Documentation

◆ AttachmentControl()

org.turro.attach.zul.control.AttachmentControl.AttachmentControl ( )

Definition at line 240 of file AttachmentControl.java.

240  {
241  Executions.createComponents("/WEB-INF/_zul/bs/comps/attachment/attachmentControl.zul", this, null);
242  Selectors.wireComponents(this, this, false);
243  Selectors.wireEventListeners(this, this);
244  path = SECURED;
245  }

Member Function Documentation

◆ afterCompose()

void org.turro.attach.zul.control.AttachmentControl.afterCompose ( )

Reimplemented in org.turro.dossier.zul.attach.IssueAttachTree, org.turro.attach.zul.navigator.SelfAttachNavigator, org.turro.attach.zul.navigator.RootAttachNavigator, and org.turro.attach.zul.navigator.MyDocumentsNavigator.

Definition at line 312 of file AttachmentControl.java.

312  {
313  initResults();
314  initComponents();
315  panelFolder.setOpen(!treeCollapsed);
316  if(!SECURED.equals(path)) {
317  AttachFolder rootFolder = treeFolder.addFolder(label, path, true);
318  panelFolder.setTitle(label);
319  rootFolder.showContents();
320  selectFirst();
321  delete.setDisabled(!Application.getApplication().isInRole("attach:delete") || readOnly);
322  } else {
323  panelFolder.setTitle("");
324  treeFolder.resetTree();
325  attachmentGrid.setCurrentFolder(null);
326  newFolder.setDisabled(true);
327  upload.setDisabled(true);
328  send.setDisabled(true);
329  levelUp.setDisabled(true);
330  copy.setDisabled(true);
331  cut.setDisabled(true);
332  paste.setDisabled(true);
333  delete.setDisabled(true);
334  }
335  }
AttachFolder 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.attach.zul.control.AttachmentControl.getLabel ( )

Definition at line 271 of file AttachmentControl.java.

271  {
272  return label;
273  }

◆ getPath()

String org.turro.attach.zul.control.AttachmentControl.getPath ( )

Definition at line 279 of file AttachmentControl.java.

279  {
280  return path;
281  }

◆ getPublicOnly()

Boolean org.turro.attach.zul.control.AttachmentControl.getPublicOnly ( )

Definition at line 247 of file AttachmentControl.java.

247  {
248  return publicOnly;
249  }

◆ getTreeFolder()

AttachTree org.turro.attach.zul.control.AttachmentControl.getTreeFolder ( )

Definition at line 307 of file AttachmentControl.java.

307  {
308  return treeFolder;
309  }
Here is the caller graph for this function:

◆ isReadOnly()

boolean org.turro.attach.zul.control.AttachmentControl.isReadOnly ( )

Definition at line 255 of file AttachmentControl.java.

255  {
256  return readOnly;
257  }

◆ isTreeCollapsed()

boolean org.turro.attach.zul.control.AttachmentControl.isTreeCollapsed ( )

Definition at line 263 of file AttachmentControl.java.

263  {
264  return treeCollapsed;
265  }

◆ onCopy()

void org.turro.attach.zul.control.AttachmentControl.onCopy ( ) throws Exception

Definition at line 198 of file AttachmentControl.java.

198  {
199  AttachmentUtil.copyFolder(currentFolder.getPath());
200  }
Here is the call graph for this function:

◆ onCut()

void org.turro.attach.zul.control.AttachmentControl.onCut ( ) throws Exception

Definition at line 203 of file AttachmentControl.java.

203  {
204  AttachmentUtil.cutFolder(currentFolder.getLabel(), currentFolder.getPath());
205  }
Here is the call graph for this function:

◆ onDelete()

void org.turro.attach.zul.control.AttachmentControl.onDelete ( ) throws Exception

Definition at line 217 of file AttachmentControl.java.

217  {
218  if(Application.getApplication().isInRole("attach:delete")) {
219  Messages.confirmDeletion().show(() -> {
220  Collection<Attachment> deleted = AttachmentUtil.delete(currentFolder.getPath());
221  if(treeFolder.getAttachListener() != null) {
222  for(Attachment a : deleted) {
223  treeFolder.getAttachListener().deleteDone(a);
224  }
225  }
226  treeFolder.setSelectedItem(currentFolder);
227  attachmentGrid.setCurrentFolder(currentFolder);
228  });
229  }
230  }
Here is the call graph for this function:

◆ onDownload()

void org.turro.attach.zul.control.AttachmentControl.onDownload ( ) throws Exception

Definition at line 186 of file AttachmentControl.java.

186  {
187  AttachFolder af = attachmentGrid.getCurrentFolder();
188  if(af != null) {
189  File targetZip = File.createTempFile("attach_", "_folder.zip");
190  Compress.zip(af.getAllAttachments(), targetZip.toPath(),
191  a -> Paths.get(a.getPath(), a.getFileName()),
192  a -> new ByteArrayInputStream(a.getWithContent().getAttachContent().getFileContent()));
193  Filedownload.save(targetZip, "application/zip");
194  }
195  }
Here is the call graph for this function:

◆ onEvent()

void org.turro.attach.zul.control.AttachmentControl.onEvent ( UploadEvent  event) throws Exception

Definition at line 233 of file AttachmentControl.java.

233  {
234  if(currentFolder != null) {
235  currentFolder.addMedias(event.getMedias());
236  attachmentGrid.setCurrentFolder(currentFolder);
237  }
238  }

◆ onLevelUp()

void org.turro.attach.zul.control.AttachmentControl.onLevelUp ( ) throws Exception

Definition at line 142 of file AttachmentControl.java.

142  {
143  if(currentFolder != null && currentFolder.getParentItem() != null) {
144  currentFolder = (AttachFolder) currentFolder.getParentItem();
145  treeFolder.setSelectedItem(currentFolder);
146  attachmentGrid.setCurrentFolder(currentFolder);
147  updateButtons();
148  }
149  }
Here is the call graph for this function:

◆ onNewFolder()

void org.turro.attach.zul.control.AttachmentControl.onNewFolder ( ) throws Exception

Definition at line 152 of file AttachmentControl.java.

152  {
153  if(currentFolder != null) {
154  currentFolder.doAddFolder();
155  attachmentGrid.setCurrentFolder(currentFolder);
156  }
157  }
Here is the call graph for this function:

◆ onPaste()

void org.turro.attach.zul.control.AttachmentControl.onPaste ( ) throws Exception

Definition at line 208 of file AttachmentControl.java.

208  {
209  AttachmentUtil.paste(currentFolder.getPath());
210  treeFolder.setSelectedItem(currentFolder);
211  currentFolder.reloadContents();
212  attachmentGrid.setCurrentFolder(currentFolder);
213  paste.setDisabled(true);
214  }
Here is the call graph for this function:

◆ onSearch()

void org.turro.attach.zul.control.AttachmentControl.onSearch ( )

Definition at line 129 of file AttachmentControl.java.

129  {
130  treeFolder.reloadContents();
131  selectFirst();
132  }
Here is the call graph for this function:

◆ onSearchValue()

void org.turro.attach.zul.control.AttachmentControl.onSearchValue ( )

Definition at line 124 of file AttachmentControl.java.

124  {
125  results.setAttachValue(searchValue.getText());
126  }
void setAttachValue(String attachValue)
Here is the call graph for this function:

◆ onSelectFolder()

void org.turro.attach.zul.control.AttachmentControl.onSelectFolder ( )

Definition at line 117 of file AttachmentControl.java.

117  {
118  currentFolder = treeFolder.getSelectedFolder();
119  updateButtons();
120  attachmentGrid.setCurrentFolder(currentFolder);
121  }
Here is the call graph for this function:

◆ onSend()

void org.turro.attach.zul.control.AttachmentControl.onSend ( ) throws Exception

Definition at line 169 of file AttachmentControl.java.

169  {
170  SendAttachments sa = new SendAttachments(I_.get("Attachment")) {
171  @Override
172  protected void fillAttachment(File attachment, Object entity) {
173  AttachWd.writeToFile((Attachment) entity, attachment);
174  }
175  };
176  AttachFolder af = attachmentGrid.getCurrentFolder();
177  if(af != null) {
178  for(Attachment a : af.getAttachments()) {
179  sa.addAttachment(a, AttachPU.getObjectPath(a), a.getFileName());
180  }
181  }
182  sa.sendAttachments(null);
183  }
Here is the call graph for this function:

◆ onUpload()

void org.turro.attach.zul.control.AttachmentControl.onUpload ( UploadEvent  event) throws Exception

Definition at line 160 of file AttachmentControl.java.

160  {
161  if(currentFolder != null) {
162  //currentFolder.doUpload();
163  currentFolder.addMedias(event.getMedias());
164  attachmentGrid.setCurrentFolder(currentFolder);
165  }
166  }
Here is the call graph for this function:

◆ onValidated()

void org.turro.attach.zul.control.AttachmentControl.onValidated ( )

Definition at line 135 of file AttachmentControl.java.

135  {
136  results.setCkNonValidated(validated.isChecked());
137  treeFolder.reloadContents();
138  selectFirst();
139  }
void setCkNonValidated(boolean ckNonValidated)
Here is the call graph for this function:

◆ refreshControls()

void org.turro.attach.zul.control.AttachmentControl.refreshControls ( )

Implements org.turro.action.IEntityHolder.

Definition at line 303 of file AttachmentControl.java.

◆ selectFirst()

void org.turro.attach.zul.control.AttachmentControl.selectFirst ( )

Definition at line 352 of file AttachmentControl.java.

352  {
353  currentFolder = treeFolder.selectFirst();
354  updateButtons();
355  attachmentGrid.setCurrentFolder(currentFolder);
356  }
Here is the caller graph for this function:

◆ setEntity()

void org.turro.attach.zul.control.AttachmentControl.setEntity ( Object  entity)

Implements org.turro.action.IEntityHolder.

Definition at line 289 of file AttachmentControl.java.

289  {
290  IElephantEntity iee = Entities.getController(entity);
291  path = iee.getPath();
292  if(Strings.isBlank(path)) {
293  path = SECURED;
294  } else {
295  label = iee.getName();
296  }
297  treeFolder.setDoProcessors(false);
298  treeFolder.resetTree();
299  attachmentGrid.setCurrentFolder(null);
300  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLabel()

void org.turro.attach.zul.control.AttachmentControl.setLabel ( String  label)

Definition at line 275 of file AttachmentControl.java.

275  {
276  this.label = label;
277  }
Here is the caller graph for this function:

◆ setPath()

void org.turro.attach.zul.control.AttachmentControl.setPath ( String  path)

Definition at line 283 of file AttachmentControl.java.

283  {
284  this.path = path;
285  treeFolder.resetTree();
286  }
Here is the caller graph for this function:

◆ setPublicOnly()

void org.turro.attach.zul.control.AttachmentControl.setPublicOnly ( Boolean  publicOnly)

Definition at line 251 of file AttachmentControl.java.

251  {
252  this.publicOnly = publicOnly;
253  }
Here is the caller graph for this function:

◆ setReadOnly()

void org.turro.attach.zul.control.AttachmentControl.setReadOnly ( boolean  readOnly)

Definition at line 259 of file AttachmentControl.java.

259  {
260  this.readOnly = readOnly;
261  }

◆ setTreeCollapsed()

void org.turro.attach.zul.control.AttachmentControl.setTreeCollapsed ( boolean  treeCollapsed)

Definition at line 267 of file AttachmentControl.java.

267  {
268  this.treeCollapsed = treeCollapsed;
269  }

◆ showFor()

static void org.turro.attach.zul.control.AttachmentControl.showFor ( Object  entity,
Consumer< Windows onClose 
)
static

Definition at line 374 of file AttachmentControl.java.

374  {
376  ac.setWidth("100%");
377  ac.setHeight("100%");
378  ac.setEntity(entity);
379  Windows.title(I_.get("Attachments"))
380  .width("80%")
381  .height("80%")
382  .addComponent(ac)
383  .onClose(onClose)
384  .closeable()
385  .show();
386  }
Here is the call graph for this function:
Here is the caller graph for this function:

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