net.aerith.misao.io
Class HtmlImageGallery

java.lang.Object
  |
  +--net.aerith.misao.io.HtmlImageGallery

public class HtmlImageGallery
extends java.lang.Object

The HtmlImageGallery represents a HTML gallery of images to create on the file system.

Note that only the file name in the specified image URL in the element is used. Any protocol or leading path is ignored.


Field Summary
protected  boolean create_index
          True when to create the index.html.
protected  java.io.File folder
          The folder to create the gallery.
protected  boolean next_anchor
          True when to insert the anchor to the next group.
protected  int number_of_elements
          The number of elements added to this gallery.
protected  java.io.PrintStream ps_index
          The print stream of index.html.
 
Constructor Summary
HtmlImageGallery(java.io.File folder)
          Constructs a HtmlImageGallery in the specified folder.
 
Method Summary
 void addElement(ImageGalleryElement element)
          Adds an image element.
 void close()
          Closes the gallery.
 void open()
          Opens the gallery.
private  void outputElement(ImageGalleryElement element, java.lang.String sub_path)
          Outputs an image element.
 void setCreateIndex(boolean flag)
          Sets the flag to to create the index.html.
 void setInsertNextAnchor(boolean flag)
          Sets the flag to insert the anchor to the next group.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

folder

protected java.io.File folder
The folder to create the gallery.

create_index

protected boolean create_index
True when to create the index.html.

ps_index

protected java.io.PrintStream ps_index
The print stream of index.html.

number_of_elements

protected int number_of_elements
The number of elements added to this gallery.

next_anchor

protected boolean next_anchor
True when to insert the anchor to the next group.
Constructor Detail

HtmlImageGallery

public HtmlImageGallery(java.io.File folder)
Constructs a HtmlImageGallery in the specified folder.
Parameters:
folder - the folder to create the gallery.
Method Detail

setCreateIndex

public void setCreateIndex(boolean flag)
Sets the flag to to create the index.html.
Parameters:
flag - the flag to to create the index.html.

setInsertNextAnchor

public void setInsertNextAnchor(boolean flag)
Sets the flag to insert the anchor to the next group.
Parameters:
flag - the flag to to insert the anchor to the next group.

open

public void open()
          throws java.io.IOException
Opens the gallery.
Throws:
java.io.IOException - if I/O error occurs.

close

public void close()
           throws java.io.IOException
Closes the gallery.
Throws:
java.io.IOException - if I/O error occurs.

addElement

public void addElement(ImageGalleryElement element)
                throws java.io.IOException,
                       java.io.FileNotFoundException,
                       UnsupportedBufferTypeException,
                       UnsupportedFileTypeException
Adds an image element.
Parameters:
element - the image element.
Throws:
java.io.IOException - if I/O error occurs.
java.io.FileNotFoundException - if the file does not exist.
UnsupportedBufferTypeException - if the data type is unsupported.
UnsupportedFileTypeException - if the file type is unsupported.

outputElement

private void outputElement(ImageGalleryElement element,
                           java.lang.String sub_path)
                    throws java.io.IOException,
                           java.io.FileNotFoundException,
                           UnsupportedBufferTypeException,
                           UnsupportedFileTypeException
Outputs an image element.
Parameters:
element - the image element.
sub_path - the sub folder path.
Throws:
java.io.IOException - if I/O error occurs.
java.io.FileNotFoundException - if the file does not exist.
UnsupportedBufferTypeException - if the data type is unsupported.
UnsupportedFileTypeException - if the file type is unsupported.