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

Public Member Functions

 AttachFolder (String label, String path, boolean loadOnDemand)
 
 AttachFolder (String label, Object value)
 
 AttachFolder (String label)
 
 AttachFolder ()
 
AttachTree getTree ()
 
void doUpload () throws InterruptedException, IOException
 
void addMedias (Media[] medias) throws InterruptedException, IOException
 
void doAddFolder () throws InterruptedException
 
AttachFolder addFolder (String label, String path)
 
void showContents ()
 
void reloadContents ()
 
boolean isLoadOnDemand ()
 
void setLoadOnDemand (boolean loadOnDemand)
 
String getPath ()
 
void setPath (String path)
 
IAttachFolder getParentFolder ()
 
String getFolderPath ()
 
String getFolderLabel ()
 
void setFolderLabel (String label)
 
void doProcessors ()
 
boolean isLeaf ()
 
Collection< String > getFolders ()
 
Collection< AttachFoldergetAttachFolders ()
 
Collection< AttachmentgetAttachments ()
 
AttachVersionMap getVersionMap ()
 
Collection< AttachmentgetAllAttachments ()
 
void afterCompose ()
 

Detailed Description

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

Definition at line 61 of file AttachFolder.java.

Constructor & Destructor Documentation

◆ AttachFolder() [1/4]

org.turro.attach.zul.navigator.AttachFolder.AttachFolder ( String  label,
String  path,
boolean  loadOnDemand 
)

Definition at line 70 of file AttachFolder.java.

70  {
71  super();
72  this.label = label;
73  this.realLabel = label;
74  this.path = path;
75  this.loadOnDemand = loadOnDemand;
76  this.setTooltiptext(label);
77  }

◆ AttachFolder() [2/4]

org.turro.attach.zul.navigator.AttachFolder.AttachFolder ( String  label,
Object  value 
)

Definition at line 79 of file AttachFolder.java.

79  {
80  throw new UnsupportedOperationException("Do not use");
81  }

◆ AttachFolder() [3/4]

org.turro.attach.zul.navigator.AttachFolder.AttachFolder ( String  label)

Definition at line 83 of file AttachFolder.java.

83  {
84  throw new UnsupportedOperationException("Do not use");
85  }

◆ AttachFolder() [4/4]

org.turro.attach.zul.navigator.AttachFolder.AttachFolder ( )

Definition at line 87 of file AttachFolder.java.

87  {
88  throw new UnsupportedOperationException("Do not use");
89  }

Member Function Documentation

◆ addFolder()

AttachFolder org.turro.attach.zul.navigator.AttachFolder.addFolder ( String  label,
String  path 
)

Definition at line 175 of file AttachFolder.java.

175  {
176  AttachFolder af = new AttachFolder(label, path, loadOnDemand);
177  if(children == null) {
178  children = new Treechildren();
179  appendChild(children);
180  }
181  children.appendChild(af);
182  af.afterCompose();
183  af.doProcessors();
184  return af;
185  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMedias()

void org.turro.attach.zul.navigator.AttachFolder.addMedias ( Media[]  medias) throws InterruptedException, IOException

Definition at line 100 of file AttachFolder.java.

100  {
101  if(medias == null || medias.length == 0) return;
102  fillFolder();
103  setOpen(true);
104  for(Media media : medias) {
105  Attachment attachment = new Attachment();
106  attachment.setModification(new Date());
107  attachment.setPath(path);
108  attachment.setOwner(app.getConstructor().getUser().getId());
109  attachment.setOnlyOwner(false);
110  attachment.setComment("");
111  attachment.setShowKey(null);
112  attachment.setPublishable(true);
113  AttachContent ac = new AttachContent();
114  if(media.inMemory()) {
115  ac.setFileContent(media.isBinary() ? media.getByteData() : media.getStringData().getBytes());
116  } else {
117  byte[] buffer = new byte[102400];
118  InputStream is = media.isBinary() ? media.getStreamData() : new ReaderInputStream(media.getReaderData(), Charset.defaultCharset());
119  ByteArrayOutputStream baos = new ByteArrayOutputStream();
120  int r;
121  while((r = is.read(buffer)) != -1) {
122  baos.write(buffer, 0, r);
123  }
124  is.close();
125  ac.setFileContent(baos.toByteArray());
126  }
127  attachment.setAttachContent(ac);
128  attachment.setFileName(media.getName());
129  attachment.setFileContentType(media.getContentType());
130  attachment.setFileSize(ac.getFileContent().length);
131  attachment.setValidated(app.isInRole("attach:self-validate"));
132  attachment = new AttachPU().saveObject(attachment);
133  SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, attachment, "uploaded", null);
134  if(getTree().getAttachListener() != null) {
135  getTree().getAttachListener().uploadDone(attachment);
136  }
137  reloadContents();
138  }
139  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ afterCompose()

void org.turro.attach.zul.navigator.AttachFolder.afterCompose ( )

Definition at line 343 of file AttachFolder.java.

343  {
344  initLoadOnDemand();
345  addCells();
346  addChildrenSpace();
347  }
Here is the caller graph for this function:

◆ doAddFolder()

void org.turro.attach.zul.navigator.AttachFolder.doAddFolder ( ) throws InterruptedException

Definition at line 141 of file AttachFolder.java.

141  {
142  InputDialog.getInput(
143  getPage(),
144  I_.get("Folder"),
145  new InputField[] {
146  new InputField("Name", "", null, 0) {
147  @Override
148  protected HtmlBasedComponent createEditor() {
149  return new FolderNameCombobox(AttachFolder.this);
150  }
151  }
152  }, new Command() {
153  @Override
154  public Object execute(Context context) {
155  InputField[] fields = (InputField[]) context.get("fields");
156  if(fields.length > 0) {
157  for(InputField f : fields) {
158  if("Name".equals(f.getLabel())) {
159  fillFolder();
160  AttachFolder af = AttachFolder.this;
161  for(String s : ((String) f.getValue()).split("\\/")) {
162  if(!Strings.isBlank(s)) {
163  af.setOpen(true);
164  af = af.addFolder(s, af.getPath() + "/" + s);
165  }
166  }
167  }
168  }
169  }
170  return null;
171  }
172  });
173  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doProcessors()

void org.turro.attach.zul.navigator.AttachFolder.doProcessors ( )

Definition at line 296 of file AttachFolder.java.

296  {
297  String str = Entities.getController(getPath()).getTreeLabel();
298  if(str != null) {
299  setFolderLabel(StringParser.cutString(str, 50));
300  setTooltiptext(str);
301  }
302  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doUpload()

void org.turro.attach.zul.navigator.AttachFolder.doUpload ( ) throws InterruptedException, IOException

Definition at line 96 of file AttachFolder.java.

96  {
97  addMedias(Fileupload.get(-1, true));
98  }
Here is the call graph for this function:

◆ getAllAttachments()

Collection<Attachment> org.turro.attach.zul.navigator.AttachFolder.getAllAttachments ( )

Definition at line 335 of file AttachFolder.java.

335  {
336  AttachResults results = getTree().getResults();
337  results.setAttachPath(Strings.isEmpty(path) ? "/" : path + "/%");
338  results.setCkExactPath(false);
339  return results.getAttachmentList();
340  }
void setAttachPath(String attachPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAttachFolders()

Collection<AttachFolder> org.turro.attach.zul.navigator.AttachFolder.getAttachFolders ( )

Definition at line 315 of file AttachFolder.java.

315  {
316  showContents();
317  return children != null ? CollectionUtil.from(children.getChildren()).<Collection<AttachFolder>>cast() : new ArrayList<>();
318  }

◆ getAttachments()

Collection<Attachment> org.turro.attach.zul.navigator.AttachFolder.getAttachments ( )

Definition at line 320 of file AttachFolder.java.

320  {
321  AttachResults results = getTree().getResults();
322  results.setAttachPath(Strings.isEmpty(path) ? "/" : path);
323  results.setCkExactPath(true);
324  return results.getAttachmentList();
325  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFolderLabel()

String org.turro.attach.zul.navigator.AttachFolder.getFolderLabel ( )

Implements org.turro.plugin.attach.IAttachFolder.

Definition at line 287 of file AttachFolder.java.

287  {
288  return realLabel;
289  }

◆ getFolderPath()

String org.turro.attach.zul.navigator.AttachFolder.getFolderPath ( )

Implements org.turro.plugin.attach.IAttachFolder.

Definition at line 282 of file AttachFolder.java.

282  {
283  return path;
284  }

◆ getFolders()

Collection<String> org.turro.attach.zul.navigator.AttachFolder.getFolders ( )

Definition at line 308 of file AttachFolder.java.

308  {
309  AttachResults results = getTree().getResults();
310  results.setAttachPath(path + "/_%");
311  results.setCkExactPath(false);
312  return results.getPathList(path);
313  }
Here is the call graph for this function:

◆ getParentFolder()

IAttachFolder org.turro.attach.zul.navigator.AttachFolder.getParentFolder ( )

Implements org.turro.plugin.attach.IAttachFolder.

Definition at line 277 of file AttachFolder.java.

277  {
278  return (IAttachFolder) getParentItem();
279  }

◆ getPath()

String org.turro.attach.zul.navigator.AttachFolder.getPath ( )

Definition at line 244 of file AttachFolder.java.

244  {
245  return path;
246  }
Here is the caller graph for this function:

◆ getTree()

AttachTree org.turro.attach.zul.navigator.AttachFolder.getTree ( )

Definition at line 92 of file AttachFolder.java.

92  {
93  return (AttachTree) super.getTree();
94  }
Here is the caller graph for this function:

◆ getVersionMap()

AttachVersionMap org.turro.attach.zul.navigator.AttachFolder.getVersionMap ( )

Definition at line 327 of file AttachFolder.java.

327  {
328  AttachVersionMap avm = new AttachVersionMap();
329  for(Attachment a : getAttachments()) {
330  avm.addAttachment(a);
331  }
332  return avm;
333  }
Collection< Attachment > getAttachments()
Here is the call graph for this function:

◆ isLeaf()

boolean org.turro.attach.zul.navigator.AttachFolder.isLeaf ( )

Definition at line 304 of file AttachFolder.java.

304  {
305  return getFolders().isEmpty();
306  }

◆ isLoadOnDemand()

boolean org.turro.attach.zul.navigator.AttachFolder.isLoadOnDemand ( )

Definition at line 236 of file AttachFolder.java.

236  {
237  return loadOnDemand;
238  }

◆ reloadContents()

void org.turro.attach.zul.navigator.AttachFolder.reloadContents ( )

Definition at line 192 of file AttachFolder.java.

192  {
193  if(children != null) {
194  children.getChildren().clear();
195  showContents();
196  }
197  }
Here is the caller graph for this function:

◆ setFolderLabel()

void org.turro.attach.zul.navigator.AttachFolder.setFolderLabel ( String  label)

Implements org.turro.plugin.attach.IAttachFolder.

Definition at line 292 of file AttachFolder.java.

292  {
293  setLabel(label);
294  }

◆ setLoadOnDemand()

void org.turro.attach.zul.navigator.AttachFolder.setLoadOnDemand ( boolean  loadOnDemand)

Definition at line 240 of file AttachFolder.java.

240  {
241  this.loadOnDemand = loadOnDemand;
242  }

◆ setPath()

void org.turro.attach.zul.navigator.AttachFolder.setPath ( String  path)

Definition at line 248 of file AttachFolder.java.

248  {
249  this.path = path;
250  }

◆ showContents()

void org.turro.attach.zul.navigator.AttachFolder.showContents ( )

Definition at line 187 of file AttachFolder.java.

187  {
188  fillFolder();
189  setOpen(true);
190  }
Here is the caller graph for this function:

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