com.xinapse.util
Class ReportGenerator

java.lang.Object
  extended by com.xinapse.util.ReportGenerator

public abstract class ReportGenerator
extends java.lang.Object

Abstract Class to generate reports. Reports can be either in simple text format, or in PDF format.


Nested Class Summary
static class ReportGenerator.ReportType
          An enumration of the types of report that can be generated.
 
Field Summary
static java.lang.String PREFERENCES_NODE_NAME
          The node name for all Preferences to do with ReportGenerator.
 
Constructor Summary
ReportGenerator()
           
 
Method Summary
abstract  void addGraph(com.xinapse.graph.GraphPanel graphPanel, java.lang.String title, java.lang.String dataKey, java.lang.String pointsKey)
          Adds a graph to the report.
abstract  void addImage(MultiSliceImage image, ColourMapping cm, double displayMin, double displayMax, ComplexMode complexMode, java.lang.String title)
          Adds an image to the report.
abstract  void addParagraph(com.lowagie.text.Chunk c)
          Adds a paragraph to the report.
abstract  void addParagraph(java.lang.String s)
          Adds a paragraph to the report.
abstract  void addTable(java.lang.String title, java.lang.String[] columnHeaders, double[][] data, java.text.NumberFormat formatter)
          Adds a table to the report.
abstract  void generateReport()
          Cause this ReoprtGenerator to generate a report.
static ReportGenerator getInstance(java.awt.Component component, java.util.List<java.lang.String> info, java.lang.String title, java.lang.String basename)
          Creates a new ReportGenerator after prompting the user to ask if she wants a report to be created.
static ReportGenerator getInstance(ReportGenerator.ReportType type, java.lang.String title, java.io.File file)
          Creates a new ReportGenerator.
abstract  ReportGenerator.ReportType getReportType()
          Returns the ReportType generated.
static java.text.DateFormat getScanDateFormat()
          Returns a DateFormat suitable for formatting scan dates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFERENCES_NODE_NAME

public static final java.lang.String PREFERENCES_NODE_NAME
The node name for all Preferences to do with ReportGenerator.

See Also:
Constant Field Values
Constructor Detail

ReportGenerator

public ReportGenerator()
Method Detail

getScanDateFormat

public static java.text.DateFormat getScanDateFormat()
Returns a DateFormat suitable for formatting scan dates.

Returns:
a DateFormat suitable for formatting scan dates.

getInstance

public static ReportGenerator getInstance(ReportGenerator.ReportType type,
                                          java.lang.String title,
                                          java.io.File file)
                                   throws java.io.IOException,
                                          com.lowagie.text.DocumentException
Creates a new ReportGenerator.

Parameters:
type - the type of report.
title - the report title.
file - the file name for the report.
Throws:
java.io.IOException - if an I/O error occurs.
com.lowagie.text.DocumentException - if the report cannot be generated because the document could not be created.

getInstance

public static ReportGenerator getInstance(java.awt.Component component,
                                          java.util.List<java.lang.String> info,
                                          java.lang.String title,
                                          java.lang.String basename)
                                   throws java.io.IOException,
                                          com.lowagie.text.DocumentException
Creates a new ReportGenerator after prompting the user to ask if she wants a report to be created.

Parameters:
component - parent of any pop-up dialog.
info - a List of information to be put into the pop-up dialog where the user is asked.
title - the report title.
basename - the suggested file basename for the report.
Throws:
java.io.IOException - if an I/O error occurs.
com.lowagie.text.DocumentException - if the report cannot be generated because the document could not be created.

getReportType

public abstract ReportGenerator.ReportType getReportType()
Returns the ReportType generated.

Returns:
the ReportType generated.

addParagraph

public abstract void addParagraph(java.lang.String s)
                           throws com.lowagie.text.DocumentException
Adds a paragraph to the report.

Parameters:
s - some text to be added as a paragraph to the report.
Throws:
com.lowagie.text.DocumentException - if the paragraph cannot be added.

addParagraph

public abstract void addParagraph(com.lowagie.text.Chunk c)
                           throws com.lowagie.text.DocumentException
Adds a paragraph to the report.

Parameters:
c - a Chunk to be added as a paragraph to the report.
Throws:
com.lowagie.text.DocumentException - if the paragraph cannot be added.

addGraph

public abstract void addGraph(com.xinapse.graph.GraphPanel graphPanel,
                              java.lang.String title,
                              java.lang.String dataKey,
                              java.lang.String pointsKey)
                       throws com.lowagie.text.DocumentException,
                              java.io.IOException
Adds a graph to the report.

Parameters:
graphPanel - the graph to be added.
title - the graph title.
dataKey - the key to the line data.
pointsKey - the key to the points data.
Throws:
com.lowagie.text.DocumentException - if the graph cannot be added.
java.io.IOException

addImage

public abstract void addImage(MultiSliceImage image,
                              ColourMapping cm,
                              double displayMin,
                              double displayMax,
                              ComplexMode complexMode,
                              java.lang.String title)
                       throws com.lowagie.text.DocumentException,
                              java.io.IOException
Adds an image to the report.

Parameters:
image - the image to be added.
cm - the ColourMapping for the image.
displayMin - the value in the image that maps to the first entry of the colour mapping.
displayMax - the value in the image that maps to the last entry of the colour mapping.
complexMode - used to create the image if it is comples.
title - the image title.
Throws:
com.lowagie.text.DocumentException - if the image cannot be added.
java.io.IOException - if reading the image results in an IOException.

addTable

public abstract void addTable(java.lang.String title,
                              java.lang.String[] columnHeaders,
                              double[][] data,
                              java.text.NumberFormat formatter)
                       throws com.lowagie.text.DocumentException,
                              java.io.IOException
Adds a table to the report.

Parameters:
title - the table title.
columnHeaders - the table column headers.
data - the table data.
formatter - the format used to format the data values in the report.
Throws:
com.lowagie.text.DocumentException - if the table cannot be added.
java.io.IOException - if an IOException occurs.

generateReport

public abstract void generateReport()
                             throws com.lowagie.text.DocumentException,
                                    java.io.IOException
Cause this ReoprtGenerator to generate a report.

Throws:
com.lowagie.text.DocumentException - if the report cannot be generated.
java.io.IOException - if an IOException occurs.


Copyright 2006-2011 Xinapse Systems Limited. All Rights Reserved.