BrightSide Workbench Full Report + Source Code
FileDocumentWrapper.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.elephant.documents;
19 
20 import java.util.Properties;
21 
26 public class FileDocumentWrapper implements Comparable {
27 
28  private FileDocument fd;
29  private boolean treatAsRoot;
30 
31  public FileDocumentWrapper(FileDocument fd, boolean treatAsRoot) {
32  this.fd = fd;
33  this.treatAsRoot = treatAsRoot;
34  }
35 
36  public String getId() {
37  return fd.getName();
38  }
39 
40  public String getPath() {
41  return fd.getAbsolutePath();
42  }
43 
44  public String getName() {
45  return fd.getFormattedPath();
46  }
47 
48  public String getInsertionSelected() {
50  return "selected=\"selected\"";
51  }
52  return "";
53  }
54 
55  public String getFolderSelected() {
57  return "selected=\"selected\"";
58  }
59  return "";
60  }
61 
62  public String getChecked() {
63  Properties props = fd.getDocumentsRoot().getPropertiesFrom(
65  if (props != null) {
66  for(int i = 0; i < 30; i++) {
67  if(getId().equals(props.getProperty("allowed." + i))) {
68  return "checked=\"checked\"";
69  }
70  }
71  }
72  return "";
73  }
74 
75  @Override
76  public int compareTo(Object o) {
78  return getName().compareTo(other.getName());
79  }
80 }
boolean isInsertionSelected(FileDocument fd)
Properties getPropertiesFrom(String folder)
FileDocumentWrapper(FileDocument fd, boolean treatAsRoot)