Class ReportGenerator

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

public abstract class ReportGenerator extends Object
Abstract Class to generate reports. Reports can be either in simple text format, or in PDF format.
  • Field Details

    • PREFERENCES_NODE_NAME

      public static final String PREFERENCES_NODE_NAME
      The node name for all Preferences to do with ReportGenerator.
      See Also:
  • Method Details

    • getScanDateFormat

      public static 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, 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

      public abstract ReportGenerator.ReportType getReportType()
      Returns the ReportType generated.
      Returns:
      the ReportType generated.
    • addParagraph

      public abstract void addParagraph(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, 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.DocumentException
      Insert an (optional) page break in the report.
      Throws:
      com.lowagie.text.DocumentException - if the page break cannot be inserted.
    • generateReport

      public abstract void generateReport() throws com.lowagie.text.DocumentException, IOException
      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.