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

Public Member Functions

 AttachFolder (String label, String path, boolean loadOnDemand, Set< AttachColumn > columns)
 
 AttachFolder (String label, Object value)
 
 AttachFolder (String label)
 
 AttachFolder ()
 
AttachTree getTree ()
 
void doUpload () throws InterruptedException, IOException
 
void doAddFolder () throws InterruptedException
 
AttachFolder addFolder (String label, String path)
 
AttachFile addFile (Attachment attachment)
 
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 ()
 

Detailed Description

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

Definition at line 57 of file tree/AttachFolder.java.

Constructor & Destructor Documentation

◆ AttachFolder() [1/4]

org.turro.attach.zul.tree.AttachFolder.AttachFolder ( String  label,
String  path,
boolean  loadOnDemand,
Set< AttachColumn columns 
)

Definition at line 67 of file tree/AttachFolder.java.

67  {
68  super();
69  this.label = label;
70  this.realLabel = label;
71  this.path = path;
72  this.loadOnDemand = loadOnDemand;
73  this.columns = columns;
74  initLoadOnDemand();
75  addCells();
76  addChildrenSpace();
77  }

◆ AttachFolder() [2/4]

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

Definition at line 79 of file tree/AttachFolder.java.

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

◆ AttachFolder() [3/4]

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

Definition at line 83 of file tree/AttachFolder.java.

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

◆ AttachFolder() [4/4]

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

Definition at line 87 of file tree/AttachFolder.java.

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

Member Function Documentation

◆ addFile()

AttachFile org.turro.attach.zul.tree.AttachFolder.addFile ( Attachment  attachment)

Definition at line 178 of file tree/AttachFolder.java.

178  {
179  AttachFile af = new AttachFile(attachment, columns);
180  children.appendChild(af); //insertBefore(af, children.getFirstChild());
181  af.afterCompose();
182  return af;
183  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addFolder()

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

Definition at line 171 of file tree/AttachFolder.java.

171  {
172  AttachFolder af = new AttachFolder(label, path, loadOnDemand, columns);
173  children.appendChild(af);
174  af.doProcessors();
175  return af;
176  }
Here is the call graph for this function:

◆ doAddFolder()

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

Definition at line 137 of file tree/AttachFolder.java.

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

◆ doProcessors()

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

Definition at line 313 of file tree/AttachFolder.java.

313  {
314  String str = Entities.getController(getPath()).getTreeLabel();
315  if(str != null) {
316  setFolderLabel(StringParser.cutString(str, 50));
317  }
318  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doUpload()

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

Definition at line 96 of file tree/AttachFolder.java.

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

◆ getFolderLabel()

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

Implements org.turro.plugin.attach.IAttachFolder.

Definition at line 304 of file tree/AttachFolder.java.

304  {
305  return realLabel;
306  }

◆ getFolderPath()

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

Implements org.turro.plugin.attach.IAttachFolder.

Definition at line 299 of file tree/AttachFolder.java.

299  {
300  return path;
301  }

◆ getParentFolder()

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

Implements org.turro.plugin.attach.IAttachFolder.

Definition at line 294 of file tree/AttachFolder.java.

294  {
295  return (IAttachFolder) getParentItem();
296  }

◆ getPath()

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

Definition at line 253 of file tree/AttachFolder.java.

253  {
254  return path;
255  }

◆ getTree()

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

Definition at line 92 of file tree/AttachFolder.java.

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

◆ isLoadOnDemand()

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

Definition at line 245 of file tree/AttachFolder.java.

245  {
246  return loadOnDemand;
247  }

◆ reloadContents()

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

Definition at line 190 of file tree/AttachFolder.java.

190  {
191  children.getChildren().clear();
192  showContents();
194  }

◆ setFolderLabel()

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

Implements org.turro.plugin.attach.IAttachFolder.

Definition at line 309 of file tree/AttachFolder.java.

309  {
310  setLabel(label);
311  }

◆ setLoadOnDemand()

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

Definition at line 249 of file tree/AttachFolder.java.

249  {
250  this.loadOnDemand = loadOnDemand;
251  }

◆ setPath()

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

Definition at line 257 of file tree/AttachFolder.java.

257  {
258  this.path = path;
259  }

◆ showContents()

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

Definition at line 185 of file tree/AttachFolder.java.

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

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