Package com.xinapse.util
Class ReportGenerator
java.lang.Object
com.xinapse.util.ReportGenerator
Abstract Class to generate reports. Reports can be either in simple text format, or
in PDF format.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
An enumration of the types of report that can be generated. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The node name for all Preferences to do with ReportGenerator. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Adds a graph to the report.abstract void
Adds a graph to the report.abstract void
addImage
(ReadableImage image, ColourMapping cm, double displayMin, double displayMax, ComplexMode complexMode, String title) Adds an image to the report.abstract void
addImage
(ReadableImage image, String title) Adds a colour image to the report.void
addImageInfo
(ReadableImage image) Adds basic image information to a report.void
addImageInfo
(ReadableImage image, String imageFileName) Adds basic image information to a report.abstract void
addParagraph
(com.lowagie.text.Chunk c) Adds a paragraph to the report.abstract void
Adds a paragraph to the report.abstract void
addPicture
(BufferedImage picture, String title, float fractionOfPageWidth) Adds a picture image to the report.abstract void
addTable
(com.xinapse.graph.TableDataSet tableDataSet) Adds a table to the report.abstract void
addTable
(String title, String[] columnHeaders, double[][] data, DecimalFormat format) Adds a table to the report.abstract void
addTable
(String title, String[] columnHeaders, double[][] data, DecimalFormat[] columnFormats) Adds a table to the report.abstract void
Adds a table to the report.abstract void
Cause this ReportGenerator to generate a report.static ReportGenerator
getInstance
(ReportGenerator.ReportType type, String title, File file) Creates a new ReportGenerator.static ReportGenerator
Creates a new ReportGenerator after prompting the user to ask if she wants a report to be created.abstract ReportGenerator.ReportType
Returns the ReportType generated.static DateFormat
Returns a DateFormat suitable for formatting scan dates.abstract void
Insert an (optional) page break in the report.
-
Field Details
-
PREFERENCES_NODE_NAME
The node name for all Preferences to do with ReportGenerator.- See Also:
-
-
Method Details
-
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, String title, File file) throws IOException, com.lowagie.text.DocumentException Creates a new ReportGenerator.- Parameters:
type
- the type of report.title
- the report title.file
- the file to which the report will be written.- Returns:
- a new ReportGenerator.
- Throws:
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(Component component, List<String> info, String title, String basename) throws 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.- Returns:
- a new ReportGenerator.
- Throws:
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
Returns the ReportType generated.- Returns:
- the ReportType generated.
-
addParagraph
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, String title) throws com.lowagie.text.DocumentException, IOException Adds a graph to the report.- Parameters:
graphPanel
- the graph to be added.title
- the graph title.- Throws:
com.lowagie.text.DocumentException
- if the graph cannot be added.IOException
- if an I/O error occurs.
-
addGraph
public abstract void addGraph(com.xinapse.graph.GraphPanel graphPanel, String title, String dataKey, String pointsKey) throws com.lowagie.text.DocumentException, 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.IOException
- if an I/O error occurs.
-
addImage
public abstract void addImage(ReadableImage image, ColourMapping cm, double displayMin, double displayMax, ComplexMode complexMode, String title) throws com.lowagie.text.DocumentException, 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.IOException
- if reading the image results in an IOException.
-
addImage
public abstract void addImage(ReadableImage image, String title) throws com.lowagie.text.DocumentException, IOException Adds a colour image to the report.- Parameters:
image
- the colour image to be added.title
- the image title.- Throws:
com.lowagie.text.DocumentException
- if the image is not a colour image, or cannot be added.IOException
- if reading the image results in an IOException.
-
addPicture
public abstract void addPicture(BufferedImage picture, String title, float fractionOfPageWidth) throws com.lowagie.text.DocumentException Adds a picture image to the report.- Parameters:
picture
- the picture to be added.title
- the picture title.fractionOfPageWidth
- the fraction of the printable page width that the picture should occupy.- Throws:
com.lowagie.text.DocumentException
- if the picture cannot be added.
-
addTable
public abstract void addTable(String title, String[] columnHeaders, double[][] data, DecimalFormat format) throws com.lowagie.text.DocumentException, IOException Adds a table to the report.- Parameters:
title
- the table title.columnHeaders
- the table column headers.data
- the table data.format
- the format used to format the data values in the report.- Throws:
com.lowagie.text.DocumentException
- if the table cannot be added.IOException
- if an I/O error occurs.
-
addTable
public abstract void addTable(String title, String[] columnHeaders, double[][] data, DecimalFormat[] columnFormats) throws com.lowagie.text.DocumentException, IOException Adds a table to the report.- Parameters:
title
- the table title.columnHeaders
- the table column headers.data
- the table data.columnFormats
- the format used to format the data values in the report - one for each column.- Throws:
com.lowagie.text.DocumentException
- if the table cannot be added.IOException
- if an I/O error occurs.
-
addTable
public abstract void addTable(com.xinapse.graph.TableDataSet tableDataSet) throws com.lowagie.text.DocumentException, IOException Adds a table to the report.- Parameters:
tableDataSet
- a TableDataSet to add as a table.- Throws:
com.lowagie.text.DocumentException
- if the table cannot be added.IOException
- if an I/O error occurs.
-
addTable
public abstract void addTable(String title, String[] rowHeaders, String[] columnHeaders, String[][] data) throws com.lowagie.text.DocumentException, IOException Adds a table to the report.- Parameters:
title
- the table title.rowHeaders
- the table row headers.columnHeaders
- the table column headers.data
- the table data.- Throws:
com.lowagie.text.DocumentException
- if the table cannot be added.IOException
- if an I/O error occurs.
-
addImageInfo
public void addImageInfo(ReadableImage image) throws com.lowagie.text.DocumentException, IOException Adds basic image information to a report.- Parameters:
image
- the image from which the information will be extracted.- Throws:
com.lowagie.text.DocumentException
- if the table cannot be added.IOException
- if an I/O error occurs.
-
addImageInfo
public void addImageInfo(ReadableImage image, String imageFileName) throws com.lowagie.text.DocumentException, IOException Adds basic image information to a report.- Parameters:
image
- the image from which the information will be extracted.imageFileName
- the file name from which the image was originally read.- Throws:
com.lowagie.text.DocumentException
- if the table cannot be added.IOException
- if an I/O error occurs.
-
pageBreak
public abstract void pageBreak() throws com.lowagie.text.DocumentExceptionInsert an (optional) page break in the report.- Throws:
com.lowagie.text.DocumentException
- if the page break cannot be inserted.
-
generateReport
Cause this ReportGenerator to generate a report.- Throws:
com.lowagie.text.DocumentException
- if the report cannot be generated.IOException
- if an IO error occurs during the report generation.
-