Class Diagram

The following UML class diagram illustrates the inheritance and use association relationships among the primary J2PrinterWorks classes and interfaces:

J2PrinterWorks class diagram

The basic Java interface representing a printable series of pages is java.awt.print.Pageable (upper left).   J2Printer is able to print any series of 0 to n Pageables in one document. The J2Printer14 subclass of J2Printer supports the additional Java printing APIs introduced in JDK 1.4.  J2PrinterWebStart is a subclass of J2Printer that supports printing from Java Web Start applications using the JNLP API.

At the center of this diagram, the abstract base class J2Pageable implements the Flowable interface and implements java.awt.print.Pageable. The six primary J2PrinterWorks component printing classes J2TextPrinter, J2TablePrinter, J2TreePrinter, J2ListPrinter, J2PanelPrinter, and J2FlowPrinter all extend J2Pageable.  By implementing the methods in Flowable interface, these classes are able to inherit a full Pageable implementation (with support for headers, footers, margins, etc.) from J2Pageable.  Likewise, anyone can create fully-capable J2PrinterWorks printing components by extending J2Pageable and implementing just the methods of Flowable.

J2FlowPrinter is a special component printing container class that can print any series of 0 to n Flowables as either a Pageable or a Flowable.

Finally, HorizontalLine, VerticalGap, and PageEject each implement Flowable and are useful in building up complex documents within a J2FlowPrinter.

The following table provides a summary of these class relationships:
J2Printer manages the Java PrinterJob class, prints one or more Pageables (the Java class defining a set of printable pages)
J2Printer14 J2Printer subclass supporting the new JDK 1.4 printing features (printer discovery, cross-platform dialogs, etc.)
J2Printer subclass supporting printing from Java Web Start applications using the JNLP APIs
Flowable interface for printing that can start and end in the middle of a page
J2Pageable abstract base class that extends java.awt.print.Pageable for any subclass that implements Flowable
J2TextPrinter prints any JTextPane as a Pageable or a Flowable
J2TablePrinter prints any JTable as a Pageable or a Flowable
J2TreePrinter prints any JTree as a Pageable or a Flowable
J2ListPrinter prints any JList as a Pageable or a Flowable
J2PanelPrinter prints any JPanel (or Component, JComponent, Container, Image, etc.) as a Pageable or a Flowable
J2FlowPrinter prints any series of Flowables back-to-back as a Pageable or a (single) Flowable
HorizontalLine Flowable for drawing a horizontal line between two Flowables
VerticalGap Flowable for leaving a gap between two Flowables
PageEject Flowable that causes the next Flowable to start at the top of the next page

Copyright 2009, Wildcrest Associates ( http://www.wildcrest.com )