Class TablePrintManager

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

public class TablePrintManager extends Object implements Printable, Pageable
  • Constructor Details

    • TablePrintManager

      public TablePrintManager(JTable table)
      Constructs a new print manager for the given table. The manager is repsonsible for all printing aspects of the table.
  • Method Details

    • setTable

      public void setTable(JTable table)
    • setFixedColumnTable

      public void setFixedColumnTable(boolean fixed)
    • registerPrintUI

      public void registerPrintUI(Class c, PrintUI ui)
      Register a PrintUI to use to print the particular class. Can be a Table Header or a table. If a PrintUI is already registered for that class, it is removed and the UI parameter is used.
    • getPrintUI

      public PrintUI getPrintUI(Class c)
      Returns the printing UI for a given class. If the UI is registered for the class, then a NULL value is returned.
    • setPrintProperties

      public void setPrintProperties(TablePrintProperties prop)
      Sets the default print propeties for the print job. If the value is null then it is ignored.
    • getPrintProperties

      public TablePrintProperties getPrintProperties()
    • showPropertiesDialog

      public 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.
    • printPreview

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

      public boolean printPreview(boolean printSilently)
    • printData

      public void printData()
    • printData

      public boolean printData(boolean printSilently)
      This method starts the printing cycle to print the table to the printer
      Parameters:
      printSilently - if true the user is not queried for the print properties and is not bothered by the windows print dialog.
    • getFixedColumns

      public JTable getFixedColumns()
    • getFixedColumnWidth

      public int getFixedColumnWidth()
      Returns the width of fixed Columns for the table. Fixed columns are columns that don't scroll and are implemented by putting another table in the Row Header Viewpoort of the ScrollPane that our table belongs to. If our table does not have a scroll pane as a parent or the scroll panes row header is not a JTable then 0 is returned, otherwise that table width is returned.
    • getNumberOfPages

      public int getNumberOfPages()
      Returns the total number of pages that this table will need to print.
      Specified by:
      getNumberOfPages in interface Pageable
    • 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
    • setPageFormat

      public void setPageFormat(int index, PageFormat pf)
    • getPrintable

      public Printable getPrintable(int page)
      Returns the printable object used to print a given page.
      Specified by:
      getPrintable in interface Pageable
    • getPageInfo

      public void getPageInfo(PageFormat pageFormat)
      Calculates all of the information used when printing, such as the total number of pages, scaling, what columns go in what page, etc.
      Parameters:
      pageFormat - the format of the pages to used in the print.
    • print

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

      public void printSubTable(Graphics2D g, PageFormat pageFormat, int rowIndex, int columnIndex)
    • getScale

      public double getScale()