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.io.File;
|
122
|
25
|
149
|
26 import digilib.image.ImageSize;
|
86
|
27
|
|
28 /**
|
|
29 * @author casties
|
|
30 */
|
|
31 public class DocuFile {
|
|
32
|
|
33 // file object
|
149
|
34 private String filename = null;
|
86
|
35 // parent DocuFileset
|
|
36 private DocuFileset parent = null;
|
149
|
37 // parent directory
|
|
38 private Directory dir = null;
|
86
|
39 // mime file type
|
|
40 private String mimetype = null;
|
|
41 // image size in pixels
|
149
|
42 private ImageSize pixelSize = null;
|
86
|
43
|
149
|
44 public DocuFile(String fn, DocuFileset parent, Directory dir) {
|
|
45 this.filename = fn;
|
|
46 this.parent = parent;
|
|
47 this.dir = dir;
|
|
48 }
|
|
49
|
|
50 public DocuFile(String fn) {
|
|
51 File f = new File(fn);
|
|
52 this.dir = new Directory(f.getParentFile());
|
|
53 this.filename = f.getName();
|
86
|
54 }
|
|
55
|
130
|
56 /** Returns the file name (without path).
|
|
57 *
|
|
58 * @return
|
|
59 */
|
86
|
60 public String getName() {
|
149
|
61 return filename;
|
86
|
62 }
|
|
63
|
122
|
64
|
86
|
65 /**
|
|
66 * @return File
|
|
67 */
|
|
68 public File getFile() {
|
149
|
69 File f = new File(dir.getDir(), filename);
|
|
70 return f;
|
86
|
71 }
|
|
72
|
|
73 /**
|
149
|
74 * @return ImageSize
|
86
|
75 */
|
149
|
76 public ImageSize getSize() {
|
86
|
77 return pixelSize;
|
|
78 }
|
|
79
|
|
80 /**
|
|
81 * @return String
|
|
82 */
|
|
83 public String getMimetype() {
|
|
84 return mimetype;
|
|
85 }
|
|
86
|
|
87 /**
|
|
88 * Sets the imageSize.
|
|
89 * @param imageSize The imageSize to set
|
|
90 */
|
149
|
91 public void setSize(ImageSize imageSize) {
|
86
|
92 this.pixelSize = imageSize;
|
|
93 }
|
|
94
|
|
95 /**
|
|
96 * Sets the mimetype.
|
|
97 * @param mimetype The mimetype to set
|
|
98 */
|
|
99 public void setMimetype(String mimetype) {
|
|
100 this.mimetype = mimetype;
|
|
101 }
|
|
102
|
|
103 /**
|
|
104 * @return DocuFileset
|
|
105 */
|
|
106 public DocuFileset getParent() {
|
|
107 return parent;
|
|
108 }
|
|
109
|
|
110 /**
|
|
111 * Sets the parent.
|
|
112 * @param parent The parent to set
|
|
113 */
|
|
114 public void setParent(DocuFileset parent) {
|
|
115 this.parent = parent;
|
|
116 }
|
|
117
|
|
118 /**
|
|
119 * @return boolean
|
|
120 */
|
|
121 public boolean isChecked() {
|
149
|
122 return (pixelSize != null);
|
86
|
123 }
|
|
124
|
|
125 }
|