Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
PrintOptions() |
Modifier and Type | Method and Description |
---|---|
void |
addRange(int firstPage,
int lastPage)
Add a range of pages to print.
|
void |
clearRanges() |
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.
|
int[] |
getPrintedPages(int reportedNumberOfPages)
Returns the list of page numbers, starting from 1, that will print using this
PrintOptions - given the total number of pages.
|
RangeList |
getRanges()
Return the RangeList of pages to print.
|
boolean |
isFull() |
void |
rangesFromString(String ranges) |
String |
rangesToString(boolean showAll)
Convert the ranges of this PrintOptions to a String.
|
public boolean printBackwards
public int whichPages
public static final int ODD_AND_EVEN_PAGES
public static final int ODD_PAGES_ONLY
public static final int EVEN_PAGES_ONLY
public static final int TO_END_OF_DOCUMENT
public static final int NO_MORE_PAGES
public Object getCopy()
Copyable
public String rangesToString(boolean showAll)
showAll
- if this is true and all the pages are selected
(i.e. no explicit range has been set) then this will return "All"
otherwise it will return a blank String.public void clearRanges()
public void rangesFromString(String ranges)
public void addRange(int firstPage, int lastPage)
public RangeList getRanges()
public boolean isFull()
public int getFirstPage(int reportedNumberOfPages) throws IllegalStateException
reportedNumberOfPages
- the number of pages the Printable object reported for the document.IllegalStateException
- if printBackwards is true but the reportedNumberOfPages is unknown.public int getNextPage()
public int countPagesWillPrint(int reportedNumberOfPages)
public int[] getPrintedPages(int reportedNumberOfPages)
reportedNumberOfPages
- the number of pages in total. This should not be UNKNOWN_NUMBER_OF_PAGES.