/*
 * @(#)ImageViewer.java    2.3.3  2 January 2005
 *
 * Copyright 2005
 * College of Computer and Information Science
 * Northeastern University
 * Boston, MA  02115
 *
 * The Java Power Tools software may be used for educational
 * purposes as long as this copyright notice is retained intact
 * at the top of all source files.
 *
 * To discuss possible commercial use of this software, 
 * contact Richard Rasala at Northeastern University, 
 * College of Computer and Information Science,
 * 617-373-2462 or rasala@ccs.neu.edu.
 *
 * The Java Power Tools software has been designed and built
 * in collaboration with Viera Proulx and Jeff Raab.
 *
 * Should this software be modified, the words "Modified from 
 * Original" must be included as a comment below this notice.
 *
 * All publication rights are retained.  This software or its 
 * documentation may not be published in any media either
 * in whole or in part without explicit permission.
 *
 * This software was created with support from Northeastern 
 * University and from NSF grant DUE-9950829.
 */

package edu.neu.ccs.gui;


/**
 * <p>Class <code>ImageViewer</code> creates
 * an image viewer for local image files.</p>
 *
 * @author  Richard Rasala
 * @version 2.3.3
 * @since   2.3.3
 */
public class ImageViewer extends ImageViewerBase {
    
    /**
     * <p>Creates an image viewer for local image files that
     * displays all images files in the given directory;
     * images are shown full size and may need to be scrolled.</p>
     *
     * @param directory the local directory with the images
     */
    public ImageViewer
        (String directory)
    {
        this(directory, "", false);
    }
    
    
    /**
     * <p>Creates an image viewer for local image files that
     * displays the images in the given directory that are
     * provided in the given filelist text file;
     * images are shown full size and may need to be scrolled.</p>
     *
     * @param directory the local directory with the images
     * @param filelist the name of a file with the list of images
     */
    public ImageViewer
        (String directory, String filelist)
    {
        this(directory, filelist, false);
    }
    
    
    /**
     * <p>Creates an image viewer for local image files that
     * displays the images in the given directory that are
     * provided in the given array of image file names;
     * images are shown full size and may need to be scrolled.</p>
     *
     * @param directory the local directory with the images
     * @param imageFileNames the array of image file names
     */
    public ImageViewer
        (String directory, String[] imageFileNames)
    {
        this(directory, imageFileNames, false);
    }
    
    
    /**
     * <p>Creates an image viewer for local image files that
     * displays all images files in the given directory;
     * the autoscale parameter determines whether or not the
     * individual images should be scaled to fit on screen.</p>
     *
     * @param directory the local directory with the images
     * @param autoscale whether or not to scale the images
     */
    public ImageViewer
        (String directory, boolean autoscale)
    {
        this(directory, "", autoscale);
    }


    /**
     * <p>Creates an image viewer for local image files that
     * displays the images in the given directory that are
     * provided in the given filelist text file;
     * the autoscale parameter determines whether or not the
     * individual images should be scaled to fit on screen.</p>
     *
     * @param directory the local directory with the images
     * @param filelist the name of a file with the list of images
     * @param autoscale whether or not to scale the images
     */
    public ImageViewer
        (String directory, String filelist, boolean autoscale)
    {
        this(directory, ImageTools.readImageFileNames(directory, filelist), autoscale);
    }


    /**
     * <p>Creates an image viewer for local image files that
     * displays the images in the given directory that are
     * provided in the given filelist text file;
     * the autoscale parameter determines whether or not the
     * individual images should be scaled to fit on screen.</p>
     *
     * @param directory the local directory with the images
     * @param imageFileNames the array of image file names
     * @param autoscale whether or not to scale the images
     */
   public ImageViewer
        (String directory, String[] imageFileNames, boolean autoscale)
    {
        this.imageFileNames = imageFileNames;
        this.paintables = ImageTools.readImagesAsPaintableLite(directory, imageFileNames);
        
        add(makeGUI(autoscale));
        
        frame("Image Viewer");
    }
   
}
