BrightSide Workbench Full Report + Source Code
AttachSheet.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.attach.zul.tree;
19 
20 import org.turro.zkoss.ss.ISaveIt;
21 import org.turro.zkoss.ss.SpreadsheetWrapper;
22 
27 public class AttachSheet implements ISaveIt {
28 
29 // private AttachFile file;
30 //
31 // public AttachSheet(AttachFile file) {
32 // this.file = file;
33 // }
34 //
35 // public boolean isSheet() {
36 // return file.getAttachment().getFileName().endsWith(".xls");
37 // }
38 //
39 // public void edit() {
40 // new SpreadsheetWrapper(
41 // new ByteArrayInputStream(LoadContent.getContent(file.getAttachment())),
42 // file.getAttachment().getFileName(),
43 // this, true).show();
44 // }
45 
46  @Override
47  public void save(SpreadsheetWrapper wrapper) {
48 // Application app = Application.getApplication();
49 // AttachFolder folder = (AttachFolder) file.getParentItem();
50 // Attachment attachment = new Attachment();
51 // attachment.setModification(new Date());
52 // attachment.setPath(folder.getFolderPath());
53 // attachment.setOwner(app.getConstructor().getUser().getId());
54 // attachment.setOnlyOwner(false);
55 // attachment.setComment(wrapper.getComment());
56 // attachment.setShowKey(null);
57 // AttachContent ac = new AttachContent();
58 // ByteArrayOutputStream baos = new ByteArrayOutputStream();
59 // wrapper.saveToOuputStream(baos);
60 // ac.setFileContent(baos.toByteArray());
61 // attachment.setAttachContent(ac);
62 // attachment.setFileName(wrapper.getFileName());
63 // attachment.setFileContentType("application/vnd.ms-excel");
64 // attachment.setFileSize(ac.getFileContent().length);
65 // attachment.setValidated(app.isInRole("attach:self-validate"));
66 // attachment = new AttachPU().saveObject(attachment);
67 // AttachFile afile = folder.addFile(attachment);
68 // if(folder.getTree().getAttachListener() != null) {
69 // folder.getTree().getAttachListener().uploadDone(afile);
70 // }
71  }
72 }
void save(SpreadsheetWrapper wrapper)