86
|
1 /* DocuFile.java -- digilib image file class.
|
|
2
|
|
3 Digital Image Library servlet components
|
|
4
|
|
5 Copyright (C) 2003 Robert Casties (robcast@mail.berlios.de)
|
|
6
|
|
7 This program is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2 of the License, or (at your
|
|
10 option) any later version.
|
|
11
|
|
12 Please read license.txt for the full details. A copy of the GPL
|
|
13 may be found at http://www.gnu.org/copyleft/lgpl.html
|
|
14
|
|
15 You should have received a copy of the GNU General Public License
|
|
16 along with this program; if not, write to the Free Software
|
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18
|
|
19 * Created on 25.02.2003
|
|
20 */
|
|
21
|
|
22 package digilib.io;
|
|
23
|
|
24 import java.awt.Dimension;
|
|
25 import java.io.File;
|
|
26
|
|
27 /**
|
|
28 * @author casties
|
|
29 */
|
|
30 public class DocuFile {
|
|
31
|
|
32 // file object
|
|
33 private File file = null;
|
|
34 // parent DocuFileset
|
|
35 private DocuFileset parent = null;
|
|
36 // mime file type
|
|
37 private String mimetype = null;
|
|
38 // image size in pixels
|
|
39 private Dimension pixelSize = null;
|
|
40 // image size and type are valid
|
|
41 private boolean checked = false;
|
|
42
|
|
43 public DocuFile(File f) {
|
|
44 file = f;
|
|
45 }
|
|
46
|
|
47 public String getName() {
|
|
48 if (file != null) {
|
|
49 return file.getName();
|
|
50 }
|
|
51 return null;
|
|
52 }
|
|
53
|
|
54 /**
|
|
55 * @return File
|
|
56 */
|
|
57 public File getFile() {
|
|
58 return file;
|
|
59 }
|
|
60
|
|
61 /**
|
|
62 * @return Dimension
|
|
63 */
|
|
64 public Dimension getSize() {
|
|
65 return pixelSize;
|
|
66 }
|
|
67
|
|
68 /**
|
|
69 * @return String
|
|
70 */
|
|
71 public String getMimetype() {
|
|
72 return mimetype;
|
|
73 }
|
|
74
|
|
75 /**
|
|
76 * Sets the file.
|
|
77 * @param file The file to set
|
|
78 */
|
|
79 public void setFile(File f) {
|
|
80 this.file = f;
|
|
81 mimetype = FileOps.mimeForFile(f);
|
|
82 }
|
|
83
|
|
84 /**
|
|
85 * Sets the imageSize.
|
|
86 * @param imageSize The imageSize to set
|
|
87 */
|
|
88 public void setSize(Dimension imageSize) {
|
|
89 this.pixelSize = imageSize;
|
|
90 }
|
|
91
|
|
92 /**
|
|
93 * Sets the mimetype.
|
|
94 * @param mimetype The mimetype to set
|
|
95 */
|
|
96 public void setMimetype(String mimetype) {
|
|
97 this.mimetype = mimetype;
|
|
98 }
|
|
99
|
|
100 /**
|
|
101 * @return DocuFileset
|
|
102 */
|
|
103 public DocuFileset getParent() {
|
|
104 return parent;
|
|
105 }
|
|
106
|
|
107 /**
|
|
108 * Sets the parent.
|
|
109 * @param parent The parent to set
|
|
110 */
|
|
111 public void setParent(DocuFileset parent) {
|
|
112 this.parent = parent;
|
|
113 }
|
|
114
|
|
115 /**
|
|
116 * @return boolean
|
|
117 */
|
|
118 public boolean isChecked() {
|
|
119 return checked;
|
|
120 }
|
|
121
|
|
122 /**
|
|
123 * Sets the checked.
|
|
124 * @param checked The checked to set
|
|
125 */
|
|
126 public void setChecked(boolean checked) {
|
|
127 this.checked = checked;
|
|
128 }
|
|
129
|
|
130 }
|