Package rma.swing.table
Class MultiTablePrintManager
java.lang.Object
rma.swing.table.MultiTablePrintManager
-
Field Summary
FieldsFields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected Rectangle
computeTableBounds
(JTable table) int
Computes the number of pages that will be needed for this print.int
Returns the number of visible rows per page to have at a minimum.getPageFormat
(int pageIndex) Returns the PageFormat need for a given page.getPrintable
(int pageIndex) protected List
protected Point
getStartPoint
(JTable table, PageFormat pageFormat, int xOffset, int yOffset) Computes the starting location (upper, left) for a table.protected void
Private method that computes the pageformat for each table.protected void
int
print
(Graphics graphics, PageFormat pageFormat, int pageIndex) void
printFooter
(Graphics g, PageFormat pageFormat, int pageIndex) void
printHeader
(Graphics g, PageFormat pageFormat, int pageIndex) void
This methods starts the printing cycle to generate a print preview.void
This is the method that starts off the entire print process.void
setPrintProperties
(TablePrintProperties properties) void
protected boolean
protected boolean
showPropertiesDialog
(String type) Shows the print properties dialog for the user to adjust the print properties.
-
Field Details
-
m_tables
-
m_printManagers
-
m_totalTableHeight
protected int m_totalTableHeight -
m_totalTableWidth
protected int m_totalTableWidth
-
-
Constructor Details
-
MultiTablePrintManager
public MultiTablePrintManager() -
MultiTablePrintManager
-
MultiTablePrintManager
-
-
Method Details
-
getPrintProperties
-
setPrintProperties
-
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
-
setTables
-
getNumberOfPages
public int getNumberOfPages()Computes the number of pages that will be needed for this print.- Specified by:
getNumberOfPages
in interfacePageable
- Returns:
- ;
-
getPageFormat
Returns the PageFormat need for a given page. For tables, all page formats are the same.- Specified by:
getPageFormat
in interfacePageable
-
getPrintable
- Specified by:
getPrintable
in interfacePageable
- Throws:
IndexOutOfBoundsException
-
printHeader
-
getStartPoint
Computes the starting location (upper, left) for a table.- Parameters:
table
- the table to find the start location forpageFormat
- the page that this table will be placed in.xOffset
- the offset in pixels to adjust the x locationyOffset
- the offset in pixels to adjust the y location- Returns:
-
print
- Specified by:
print
in interfacePrintable
- 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
-
showPropertiesDialog
protected boolean showPropertiesDialog() -
showPropertiesDialog
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
-