net.aerith.misao.toolkit.HtmlImageGallery
Class HtmlImageGalleryOperation

java.lang.Object
  |
  +--net.aerith.misao.util.OperationObservable
        |
        +--net.aerith.misao.util.Operation
              |
              +--net.aerith.misao.util.MultiTaskOperation
                    |
                    +--net.aerith.misao.toolkit.HtmlImageGallery.HtmlImageGalleryOperation
Direct Known Subclasses:
AgentHtmlImageGalleryOperation

public class HtmlImageGalleryOperation
extends MultiTaskOperation

The HtmlImageGalleryOperation represents an operation to create HTML image gallery.


Field Summary
protected  boolean create_fits
          True when to create FITS thumbnail image.
protected  ThumbnailImageCreater creater
          The thumbnail image creater.
protected  java.util.Vector current_element_list
          The current list of gallery elements.
protected  int current_index
          The current file number.
protected  java.util.Vector current_message_list
          The current list of messages.
protected  Variability current_variability
          The current variability.
protected  GlobalDBManager db_manager
          The database manager.
protected  ImageGallerySettingDialog dialog
          The dialog to set the image size, scale, and rotation.
protected  java.io.File directory
          The directory to create HTML image gallery files.
protected  boolean dss_image
          True when to add a DSS image.
protected  FileManager file_manager
          The file manager.
protected  HtmlImageGallery gallery
          The HTML image gallery.
protected  java.util.Hashtable hash_failed_images
          The list of image files failed to read.
protected  boolean past_image
          True when to add a past image from database.
protected  boolean warning_message_flag
          True when to show the warning message.
 
Fields inherited from class net.aerith.misao.util.MultiTaskOperation
conductor
 
Fields inherited from class net.aerith.misao.util.Operation
monitor_set, stopped
 
Fields inherited from class net.aerith.misao.util.OperationObservable
observer_list
 
Constructor Summary
HtmlImageGalleryOperation(MultiTaskConductor conductor, FileManager file_manager, GlobalDBManager db_manager, boolean fits, boolean past, boolean dss)
          Constructs a HtmlImageGalleryOperation.
 
Method Summary
protected  void addCurrentElement()
          Adds the current element to the gallery.
private static java.lang.String create2massAnchor(Coor coor)
          Creates the anchor to get the 2MASS images.
private static java.lang.String[] createDssAnchors(Coor coor)
          Creates the anchors to get the DSS GIF and FITS images.
private  ImageGalleryElement createImageGalleryElement(XmlMagRecord mag_record, XmlInformation info)
          Creates the gallery element of one image.
private static java.lang.String createSimbadAnchor(Coor coor)
          Creates the anchor to search data in SIMBAD.
protected  Size getImageSize()
          Gets the image size.
protected  double getResolution()
          Gets the resolution in arcsec/pixel.
protected  void notifyEnd(java.lang.Exception exception)
          Notifies when the operation ends.
protected  void notifyStart()
          Notifies when the operation starts.
 void operate(java.lang.Object object)
          Operates on one item.
protected  boolean rotatesNorthUpAtRightAngles()
          Returns true when to rotate north up at right angles.
 void setWarningMessageEnabled(boolean flag)
          Enables/disables to show the warning message.
 int showSettingDialog()
          Shows the dialog to set parameters.
protected  boolean unifiesResolution()
          Returns true when to unify the resolution.
 
Methods inherited from class net.aerith.misao.util.MultiTaskOperation
operate, ready
 
Methods inherited from class net.aerith.misao.util.Operation
addMonitor, isStopped, perform, run, stop
 
Methods inherited from class net.aerith.misao.util.OperationObservable
addObserver, deleteObserver, notifyFailed, notifySucceeded, notifyWarned
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

dialog

protected ImageGallerySettingDialog dialog
The dialog to set the image size, scale, and rotation.

directory

protected java.io.File directory
The directory to create HTML image gallery files.

creater

protected ThumbnailImageCreater creater
The thumbnail image creater.

gallery

protected HtmlImageGallery gallery
The HTML image gallery.

hash_failed_images

protected java.util.Hashtable hash_failed_images
The list of image files failed to read.

current_variability

protected Variability current_variability
The current variability.

current_element_list

protected java.util.Vector current_element_list
The current list of gallery elements.

current_message_list

protected java.util.Vector current_message_list
The current list of messages.

current_index

protected int current_index
The current file number.

file_manager

protected FileManager file_manager
The file manager.

db_manager

protected GlobalDBManager db_manager
The database manager.

create_fits

protected boolean create_fits
True when to create FITS thumbnail image.

past_image

protected boolean past_image
True when to add a past image from database.

dss_image

protected boolean dss_image
True when to add a DSS image.

warning_message_flag

protected boolean warning_message_flag
True when to show the warning message.
Constructor Detail

HtmlImageGalleryOperation

public HtmlImageGalleryOperation(MultiTaskConductor conductor,
                                 FileManager file_manager,
                                 GlobalDBManager db_manager,
                                 boolean fits,
                                 boolean past,
                                 boolean dss)
Constructs a HtmlImageGalleryOperation.
Parameters:
conductor - the conductor of multi task operation.
file_manager - the file manager.
db_manager - the database manager.
fits - true when to create FITS thumbnail images.
past - true when to add a past image from database.
dss - true when to add a DSS image.
Method Detail

setWarningMessageEnabled

public void setWarningMessageEnabled(boolean flag)
Enables/disables to show the warning message.
Parameters:
flag - true when to show the message.

showSettingDialog

public int showSettingDialog()
Shows the dialog to set parameters.
Overrides:
showSettingDialog in class MultiTaskOperation
Returns:
0 if OK button is pushed, or 2 if Cancel button is pushed.

getImageSize

protected Size getImageSize()
Gets the image size.
Returns:
the image size.

unifiesResolution

protected boolean unifiesResolution()
Returns true when to unify the resolution.
Returns:
true when to unify the resolution.

getResolution

protected double getResolution()
Gets the resolution in arcsec/pixel.
Returns:
the resolution in arcsec/pixel.

rotatesNorthUpAtRightAngles

protected boolean rotatesNorthUpAtRightAngles()
Returns true when to rotate north up at right angles.
Returns:
true when to rotate north up at right angles.

notifyStart

protected void notifyStart()
Notifies when the operation starts.
Overrides:
notifyStart in class OperationObservable

notifyEnd

protected void notifyEnd(java.lang.Exception exception)
Notifies when the operation ends.
Overrides:
notifyEnd in class OperationObservable
Parameters:
exception - the exception if an error occurs, or null if succeeded.

addCurrentElement

protected void addCurrentElement()
                          throws java.io.IOException,
                                 java.io.FileNotFoundException,
                                 UnsupportedBufferTypeException,
                                 UnsupportedFileTypeException
Adds the current element to the gallery.
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.

createImageGalleryElement

private ImageGalleryElement createImageGalleryElement(XmlMagRecord mag_record,
                                                      XmlInformation info)
                                               throws java.io.IOException,
                                                      java.io.FileNotFoundException,
                                                      UnsupportedBufferTypeException,
                                                      UnsupportedFileTypeException
Creates the gallery element of one image.
Parameters:
mag_record - the magnitude record.
info - the image information.
Returns:
the image gallery 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.

createDssAnchors

private static java.lang.String[] createDssAnchors(Coor coor)
Creates the anchors to get the DSS GIF and FITS images.
Parameters:
coor - the R.A. and Decl.
Returns:
the anchors to get the DSS GIF and FITS images.

create2massAnchor

private static java.lang.String create2massAnchor(Coor coor)
Creates the anchor to get the 2MASS images.
Parameters:
coor - the R.A. and Decl.
Returns:
the anchor to get the 2MASS images.

createSimbadAnchor

private static java.lang.String createSimbadAnchor(Coor coor)
Creates the anchor to search data in SIMBAD.
Parameters:
coor - the R.A. and Decl.
Returns:
the anchor to search data in SIMBAD.

operate

public void operate(java.lang.Object object)
             throws java.lang.Exception
Operates on one item. This is invoked from the conductor of multi task operation.
Overrides:
operate in class MultiTaskOperation
Parameters:
object - the target object to operate.
Throws:
java.lang.Exception - if an error occurs.