BrightSide Workbench Full Report + Source Code
DossierFileTree.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.dossier.zul.attach;
19 
20 import java.io.File;
21 import java.util.ArrayList;
22 import java.util.List;
23 import org.turro.dossier.entity.Dossier;
24 import org.turro.elephant.context.ElephantContext;
25 import org.turro.file.zul.tree.FileColumn;
26 import org.turro.file.zul.tree.FileColumnType;
27 import org.turro.file.zul.tree.FileItem;
28 import org.turro.file.zul.tree.FileListener;
29 import org.turro.file.zul.tree.FileTree;
30 import org.turro.i18n.I_;
31 import org.zkoss.zk.ui.ext.AfterCompose;
32 
37 @Deprecated
38 public class DossierFileTree extends FileTree implements AfterCompose, FileListener {
39 
40  private Dossier dossier;
41 
42  public DossierFileTree() {
43  super(I_.get("Root"));
44  }
45 
46  public Dossier getDossier() {
47  return dossier;
48  }
49 
50  public void setDossier(Dossier dossier) {
51  this.dossier = dossier;
52  }
53 
54  @Override
55  public void afterCompose() {
56  initTreeColumns(createFileColumns());
57  if(dossier != null) {
58  File myFiles = new File(ElephantContext.getRealPath("/WEB-INF/files") + "/dossier/" + dossier.getId());
59  //if(!myFiles.exists()) myFiles.mkdirs();
60  addFolder(dossier.getDescription(), myFiles.getAbsolutePath());
61  myFiles = new File(ElephantContext.getRealPath("/_internal/files") + "/dossier/" + dossier.getId());
62  //if(!myFiles.exists()) myFiles.mkdirs();
63  addFolder(dossier.getDescription() + " (" + I_.get("Publishable") + ")", myFiles.getAbsolutePath());
64  }
65  }
66 
67  @Override
68  public void uploadDone(FileItem file) {
69  }
70 
71  @Override
72  public void downloadDone(FileItem file) {
73  }
74 
75  @Override
76  public void deleteDone(FileItem file) {
77  }
78 
79  private List<FileColumn> createFileColumns() {
80  List<FileColumn> columns = new ArrayList<FileColumn>();
81  columns.add(new FileColumn(FileColumnType.FILE_DATE_COLUMN));
82  columns.add(new FileColumn(FileColumnType.FILE_SIZE_COLUMN));
83  return columns;
84  }
85 
86 }
void initTreeColumns(List< FileColumn > fileColumns)
FileItem addFolder(String label, String path)
static String get(String msg)
Definition: I_.java:41