# HG changeset patch # User robcast # Date 1293041872 -3600 # Node ID efd7a223f819f569a52d8d4e6d5e08c24c18fee5 # Parent 790cbfb58b52795b9d9c8537ad134954f1007f3b try: ImageInput as interface, ImageFile inherits from Dirent and implements ImageInput diff -r 790cbfb58b52 -r efd7a223f819 servlet/src/digilib/image/ImageLoaderDocuImage.java --- a/servlet/src/digilib/image/ImageLoaderDocuImage.java Wed Dec 22 18:32:06 2010 +0100 +++ b/servlet/src/digilib/image/ImageLoaderDocuImage.java Wed Dec 22 19:17:52 2010 +0100 @@ -50,8 +50,8 @@ import digilib.io.FileOpException; import digilib.io.FileOps; import digilib.io.ImageFile; +import digilib.io.ImageInput; import digilib.io.ImageSet; -import digilib.io.ImageInput; /** Implementation of DocuImage using the ImageLoader API of Java 1.4 and Java2D. */ public class ImageLoaderDocuImage extends ImageInfoDocuImage { diff -r 790cbfb58b52 -r efd7a223f819 servlet/src/digilib/image/JAIDocuImage.java --- a/servlet/src/digilib/image/JAIDocuImage.java Wed Dec 22 18:32:06 2010 +0100 +++ b/servlet/src/digilib/image/JAIDocuImage.java Wed Dec 22 19:17:52 2010 +0100 @@ -47,8 +47,8 @@ import digilib.io.FileOpException; import digilib.io.FileOps; import digilib.io.ImageFile; +import digilib.io.ImageInput; import digilib.io.ImageSet; -import digilib.io.ImageInput; /** A DocuImage implementation using Java Advanced Imaging Library. */ /** diff -r 790cbfb58b52 -r efd7a223f819 servlet/src/digilib/io/ImageFile.java --- a/servlet/src/digilib/io/ImageFile.java Wed Dec 22 18:32:06 2010 +0100 +++ b/servlet/src/digilib/io/ImageFile.java Wed Dec 22 19:17:52 2010 +0100 @@ -28,7 +28,7 @@ /** * @author casties */ -public class ImageFile extends ImageInput { +public class ImageFile extends DocuDirent implements ImageInput { // file name private String filename = null; @@ -36,6 +36,11 @@ private ImageSet parent = null; // parent directory private Directory dir = null; + // mime file type + protected String mimetype = null; + // image size in pixels + protected ImageSize pixelSize = null; + public ImageFile(String fn, ImageSet parent, Directory dir) { this.filename = fn; @@ -50,12 +55,6 @@ } - @Override - public boolean hasFile() { - // this is File-based - return true; - } - /** Returns the file name (without path). * * @return @@ -68,7 +67,6 @@ /** * @return File */ - @Override public File getFile() { if (dir == null) { return null; @@ -77,21 +75,6 @@ return f; } - /** - * @return ImageSet - */ - public ImageSet getParent() { - return parent; - } - - /** - * Sets the parent. - * @param parent The parent to set - */ - public void setParent(ImageSet parent) { - this.parent = parent; - } - /* (non-Javadoc) * @see digilib.io.ImageInput#setSize(digilib.image.ImageSize) */ @@ -102,5 +85,63 @@ this.parent.setAspect(imageSize); } } + /* (non-Javadoc) + * @see digilib.io.ImageInput#getSize() + */ + public ImageSize getSize() { + return pixelSize; + } + + /* (non-Javadoc) + * @see digilib.io.ImageInput#getMimetype() + */ + public String getMimetype() { + return mimetype; + } + + /* (non-Javadoc) + * @see digilib.io.ImageInput#setMimetype(java.lang.String) + */ + public void setMimetype(String filetype) { + this.mimetype = filetype; + } + + /* (non-Javadoc) + * @see digilib.io.ImageInput#isChecked() + */ + public boolean isChecked() { + return (pixelSize != null); + } + + /* (non-Javadoc) + * @see digilib.io.ImageInput#getAspect() + */ + public float getAspect() { + return (pixelSize != null) ? pixelSize.getAspect() : 0; + } + + @Override + public ImageSet getParentSet() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setParentSet(ImageSet parent) { + // TODO Auto-generated method stub + + } + + @Override + public void checkMeta() { + // TODO Auto-generated method stub + + } + + @Override + public File getInput() { + // TODO Auto-generated method stub + return null; + } } diff -r 790cbfb58b52 -r efd7a223f819 servlet/src/digilib/io/ImageInput.java --- a/servlet/src/digilib/io/ImageInput.java Wed Dec 22 18:32:06 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* ImageInput-- digilib image input interface. - - Digital Image Library servlet components - - Copyright (C) 2010 Robert Casties (robcast@mail.berlios.de) - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - Please read license.txt for the full details. A copy of the GPL - may be found at http://www.gnu.org/copyleft/lgpl.html - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - * Created on 20.12.2010 - */ - -package digilib.io; - -import digilib.image.ImageSize; - -public abstract class ImageInput { - - // mime file type - protected String mimetype = null; - // image size in pixels - protected ImageSize pixelSize = null; - - /** - * @return ImageSize - */ - public ImageSize getSize() { - return pixelSize; - } - - /** - * Sets the imageSize. - * @param imageSize The imageSize to set - */ - public void setSize(ImageSize imageSize) { - this.pixelSize = imageSize; - } - - /** - * @return String - */ - public String getMimetype() { - return mimetype; - } - - /** - * Sets the mimetype. - * @param mimetype The mimetype to set - */ - public void setMimetype(String filetype) { - this.mimetype = filetype; - } - - /** returns if this image has been checked - * (i.e. has size and mimetype) - * @return boolean - */ - public boolean isChecked() { - return (pixelSize != null); - } - - /** Returns the aspect ratio of the image (width/height). - * - * @return - */ - public float getAspect() { - return (pixelSize != null) ? pixelSize.getAspect() : 0; - } - -} \ No newline at end of file diff -r 790cbfb58b52 -r efd7a223f819 servlet/src/digilib/io/ImageInputImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/servlet/src/digilib/io/ImageInputImpl.java Wed Dec 22 19:17:52 2010 +0100 @@ -0,0 +1,81 @@ +/* ImageInput-- digilib image input interface. + + Digital Image Library servlet components + + Copyright (C) 2010 Robert Casties (robcast@mail.berlios.de) + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + Please read license.txt for the full details. A copy of the GPL + may be found at http://www.gnu.org/copyleft/lgpl.html + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + * Created on 20.12.2010 + */ + +package digilib.io; + +import digilib.image.ImageSize; + +public abstract class ImageInputImpl implements ImageInput { + + // mime file type + protected String mimetype = null; + // image size in pixels + protected ImageSize pixelSize = null; + + /* (non-Javadoc) + * @see digilib.io.ImageInput#getSize() + */ + @Override + public ImageSize getSize() { + return pixelSize; + } + + /* (non-Javadoc) + * @see digilib.io.ImageInput#setSize(digilib.image.ImageSize) + */ + @Override + public void setSize(ImageSize imageSize) { + this.pixelSize = imageSize; + } + + /* (non-Javadoc) + * @see digilib.io.ImageInput#getMimetype() + */ + @Override + public String getMimetype() { + return mimetype; + } + + /* (non-Javadoc) + * @see digilib.io.ImageInput#setMimetype(java.lang.String) + */ + @Override + public void setMimetype(String filetype) { + this.mimetype = filetype; + } + + /* (non-Javadoc) + * @see digilib.io.ImageInput#isChecked() + */ + @Override + public boolean isChecked() { + return (pixelSize != null); + } + + /* (non-Javadoc) + * @see digilib.io.ImageInput#getAspect() + */ + @Override + public float getAspect() { + return (pixelSize != null) ? pixelSize.getAspect() : 0; + } + +} \ No newline at end of file diff -r 790cbfb58b52 -r efd7a223f819 servlet/src/digilib/io/ImageSet.java --- a/servlet/src/digilib/io/ImageSet.java Wed Dec 22 18:32:06 2010 +0100 +++ b/servlet/src/digilib/io/ImageSet.java Wed Dec 22 19:17:52 2010 +0100 @@ -38,7 +38,7 @@ protected static FileClass fileClass = FileClass.IMAGE; /** list of files (ImageFile) */ - private List list = null; + private List list = null; /** aspect ratio (width/height) */ private float aspect = 0f; @@ -62,7 +62,7 @@ * @param initialCapacity */ public ImageSet() { - list = new ArrayList(); + list = new ArrayList(); } /** @@ -76,7 +76,7 @@ public ImageSet(File file, Map hints) { Directory[] dirs = (Directory[]) hints.get(FileOps.HINT_BASEDIRS); int nb = dirs.length; - list = new ArrayList(nb); + list = new ArrayList(nb); parent = dirs[0]; fill(dirs, file, hints); } @@ -140,7 +140,7 @@ * @return */ public ImageInput getNextSmaller(ImageSize size) { - for (ListIterator i = getHiresIterator(); i.hasNext();) { + for (ListIterator i = getHiresIterator(); i.hasNext();) { ImageInput f = i.next(); try { if (!f.isChecked()) { @@ -168,7 +168,7 @@ * @return */ public ImageInput getNextBigger(ImageSize size) { - for (ListIterator i = getLoresIterator(); i.hasPrevious();) { + for (ListIterator i = getLoresIterator(); i.hasPrevious();) { ImageInput f = i.previous(); try { if (!f.isChecked()) { @@ -210,7 +210,7 @@ * * @return */ - public ListIterator getHiresIterator() { + public ListIterator getHiresIterator() { return list.listIterator(); } @@ -224,7 +224,7 @@ * * @return */ - public ListIterator getLoresIterator() { + public ListIterator getLoresIterator() { return list.listIterator(list.size()); }