Package rma.swing.table
Class TablePrintManager
java.lang.Object
rma.swing.table.TablePrintManager
-
Field Summary
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGESFields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS -
Constructor Summary
ConstructorsConstructorDescriptionTablePrintManager(JTable table) Constructs a new print manager for the given table. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the width of fixed Columns for the table.intReturns the total number of pages that this table will need to print.getPageFormat(int pageIndex) Returns the PageFormat need for a given page.voidgetPageInfo(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.getPrintable(int page) Returns the printable object used to print a given page.getPrintUI(Class c) Returns the printing UI for a given class.doublegetScale()intprint(Graphics g, PageFormat pageFormat, int pageIndex) voidbooleanprintData(boolean printSilently) This method starts the printing cycle to print the table to the printervoidThis methods starts the printing cycle to generate a print preview.booleanprintPreview(boolean printSilently) voidprintSubTable(Graphics2D g, PageFormat pageFormat, int rowIndex, int columnIndex) voidregisterPrintUI(Class c, PrintUI ui) Register a PrintUI to use to print the particular class.voidsetFixedColumnTable(boolean fixed) voidsetPageFormat(int index, PageFormat pf) voidSets the default print propeties for the print job.voidbooleanshowPropertiesDialog(String type) Shows the print properties dialog for the user to adjust the print properties.
-
Constructor Details
-
TablePrintManager
Constructs a new print manager for the given table. The manager is repsonsible for all printing aspects of the table.
-
-
Method Details
-
setTable
-
setFixedColumnTable
public void setFixedColumnTable(boolean fixed) -
registerPrintUI
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
Returns the printing UI for a given class. If the UI is registered for the class, then a NULL value is returned. -
setPrintProperties
Sets the default print propeties for the print job. If the value is null then it is ignored. -
getPrintProperties
-
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. -
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
-
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:
getNumberOfPagesin interfacePageable
-
getPageFormat
Returns the PageFormat need for a given page. For tables, all page formats are the same.- Specified by:
getPageFormatin interfacePageable
-
setPageFormat
-
getPrintable
Returns the printable object used to print a given page.- Specified by:
getPrintablein interfacePageable
-
getPageInfo
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
- Specified by:
printin interfacePrintable- Throws:
PrinterException
-
printSubTable
-
getScale
public double getScale()
-