ewe.fx.print
Class PrintOptions

java.lang.Object
  extended byewe.fx.print.PrintOptions
All Implemented Interfaces:
Copyable

public class PrintOptions
extends Object
implements Copyable

This class holds options for the pages that are to be printed - but do not relate to the layout of the pages.


Field Summary
static int EVEN_PAGES_ONLY
          A possible value for whichPages
static int NO_MORE_PAGES
          A possible return value from getFirstPage() or getNextPage().
static int ODD_AND_EVEN_PAGES
          The default value for whichPages
static int ODD_PAGES_ONLY
          A possible value for whichPages
 boolean printBackwards
          This indicates that printing should be from the highest page to the lowest.
static int TO_END_OF_DOCUMENT
          This can be a lastPage value for addRange().
 int whichPages
          This defaults to ODD_AND_EVEN_PAGES, but can also be set to ODD_PAGES_ONLY and EVEN_PAGES_ONLY.
 
Constructor Summary
PrintOptions()
           
 
Method Summary
 void addRange(int firstPage, int lastPage)
          Add a range of pages to print.
 int countPagesWillPrint(int reportedNumberOfPages)
          Count the number of pages that will print if reportedNumberOfPages is not UNKNOWN_NUMBER_OF_PAGES.
 Object getCopy()
          Return a copy of this object.
 int getFirstPage(int reportedNumberOfPages)
          Return the first page that should be printed.
 int getNextPage()
          Return the next page that should be printed.
 RangeList getRanges()
          Return the RangeList of pages to print.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, toString
 

Field Detail

printBackwards

public boolean printBackwards
This indicates that printing should be from the highest page to the lowest.


whichPages

public int whichPages
This defaults to ODD_AND_EVEN_PAGES, but can also be set to ODD_PAGES_ONLY and EVEN_PAGES_ONLY.


ODD_AND_EVEN_PAGES

public static final int ODD_AND_EVEN_PAGES
The default value for whichPages

See Also:
Constant Field Values

ODD_PAGES_ONLY

public static final int ODD_PAGES_ONLY
A possible value for whichPages

See Also:
Constant Field Values

EVEN_PAGES_ONLY

public static final int EVEN_PAGES_ONLY
A possible value for whichPages

See Also:
Constant Field Values

TO_END_OF_DOCUMENT

public static final int TO_END_OF_DOCUMENT
This can be a lastPage value for addRange().

See Also:
Constant Field Values

NO_MORE_PAGES

public static final int NO_MORE_PAGES
A possible return value from getFirstPage() or getNextPage().

See Also:
Constant Field Values
Constructor Detail

PrintOptions

public PrintOptions()
Method Detail

getCopy

public Object getCopy()
Description copied from interface: Copyable
Return a copy of this object.

Specified by:
getCopy in interface Copyable

addRange

public void addRange(int firstPage,
                     int lastPage)
Add a range of pages to print. The firstPage and lastPage values are inclusive and should start from 1. Use TO_END_OF_DOCUMENT as a lastPage value to specifiy printing to the end of the document.


getRanges

public RangeList getRanges()
Return the RangeList of pages to print. If this returns null it indicates that no ranges were set - indicating to print all pages.


getFirstPage

public int getFirstPage(int reportedNumberOfPages)
                 throws IllegalStateException
Return the first page that should be printed.

Parameters:
reportedNumberOfPages - the number of pages the Printable object reported for the document.
Returns:
the first page to be printed (where 1 is the lowest page) or NO_MORE_PAGES if there are none to print.
Throws:
IllegalStateException - if printBackwards is true but the reportedNumberOfPages is unknown.

getNextPage

public int getNextPage()
Return the next page that should be printed.

Returns:
the next page to be printed (where 1 is the lowest page) or NO_MORE_PAGES if there are none to print.

countPagesWillPrint

public int countPagesWillPrint(int reportedNumberOfPages)
Count the number of pages that will print if reportedNumberOfPages is not UNKNOWN_NUMBER_OF_PAGES.