Class MultiTablePrintManager

java.lang.Object
rma.swing.table.MultiTablePrintManager
All Implemented Interfaces:
Pageable, Printable

public class MultiTablePrintManager extends Object implements Pageable, Printable
  • Field Details

    • m_tables

      protected List m_tables
    • m_printManagers

      protected List m_printManagers
    • m_totalTableHeight

      protected int m_totalTableHeight
    • m_totalTableWidth

      protected int m_totalTableWidth
  • Constructor Details

    • MultiTablePrintManager

      public MultiTablePrintManager()
    • MultiTablePrintManager

      public MultiTablePrintManager(List tables)
    • MultiTablePrintManager

      public MultiTablePrintManager(JTable[] tables)
  • Method Details

    • getPrintProperties

      public TablePrintProperties getPrintProperties()
    • setPrintProperties

      public void setPrintProperties(TablePrintProperties properties)
    • getPrintManagers

      protected List getPrintManagers()
    • getNumVisibleRowsPerPage

      public int getNumVisibleRowsPerPage()
      Returns the number of visible rows per page to have at a minimum. This way tables do not get "squished" so small that they are not visible anymore.
    • addTables

      public void addTables(List tables)
    • setTables

      public void setTables(List tables)
    • getNumberOfPages

      public int getNumberOfPages()
      Computes the number of pages that will be needed for this print.
      Specified by:
      getNumberOfPages in interface Pageable
      Returns:
      ;
    • getPageFormat

      public PageFormat getPageFormat(int pageIndex)
      Returns the PageFormat need for a given page. For tables, all page formats are the same.
      Specified by:
      getPageFormat in interface Pageable
    • getPrintable

      public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException
      Specified by:
      getPrintable in interface Pageable
      Throws:
      IndexOutOfBoundsException
    • printFooter

      public void printFooter(Graphics g, PageFormat pageFormat, int pageIndex)
    • printHeader

      public void printHeader(Graphics g, PageFormat pageFormat, int pageIndex)
    • getStartPoint

      protected Point getStartPoint(JTable table, PageFormat pageFormat, int xOffset, int yOffset)
      Computes the starting location (upper, left) for a table.
      Parameters:
      table - the table to find the start location for
      pageFormat - the page that this table will be placed in.
      xOffset - the offset in pixels to adjust the x location
      yOffset - the offset in pixels to adjust the y location
      Returns:
    • print

      public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
      Specified by:
      print in interface Printable
      Throws:
      PrinterException
    • printTables

      public void printTables()
      This is the method that starts off the entire print process.
    • printPreview

      public void printPreview()
      This methods starts the printing cycle to generate a print preview.
    • initializeBounds

      protected void initializeBounds()
    • initialize

      protected void initialize()
      Private method that computes the pageformat for each table. This format will be passed to the printing manager for each table. Each print manager will print a table within each table.
    • computeTableBounds

      protected Rectangle computeTableBounds(JTable table)
    • showPropertiesDialog

      protected boolean showPropertiesDialog()
    • showPropertiesDialog

      protected boolean showPropertiesDialog(String type)
      Shows the print properties dialog for the user to adjust the print properties. If the user cancels, thus not wanting to print, false is returned. If the user clicks OK then a true is returned.
      Parameters:
      type - The text to show in the "Print" button, such as switching between Print and Print Preview