public final class JobSettings
extends java.lang.Object
As documented on PrinterJob, the JobSettings installed on that job will initially reflect the current default settings for the initially associated printer for that job.
The JobSettings delegate then remains the same for the life of the job, and will have it's member properties updated to be compatible with a change in Printer on the job. For example as a result of a user interaction via a platform's dialog. An incompatible setting will usually cause the setting to revert to the default for the new printer.
Any implicit or explicit updates to settings resulting from the user interaction with dialog will be propagated and visible to the application once the user approves the settings by dismissing the dialog using its "accept" option.
For most printing applications it is likely sufficient to let the user set the desired options and have these propagated to the job. For applications which need them, there are setter and getter methods for the individual options, which are also available as properties, and change in values of settings may be monitored and updated via these properties.
Not all values of settings are available on all printers. For example
a printer may not support two-sided printing.
See the Printer
class for how to
to determine supported settings.
Type | Property and Description |
---|---|
<any> |
collation
Property representing an instance of
Collation . |
IntegerProperty |
copies
IntegerProperty representing the number of
copies of the job to print. |
StringProperty |
jobName
StringProperty representing the name of a job. |
<any> |
pageLayout
Property representing an instance of
PageLayout . |
ObjectProperty |
pageRanges
An
ObjectProperty whose value represents the job pages
to print as an array of PageRange. |
<any> |
paperSource
Property representing an instance of
PaperSource . |
<any> |
printColor
Property representing an instance of
PrintColor . |
<any> |
printQuality
Property representing an instance of
PrintQuality . |
<any> |
printResolution
Property representing an instance of
PrintResolution . |
<any> |
printSides
Property representing an instance of
PrintSides . |
Modifier and Type | Field and Description |
---|---|
private <any> |
collation |
private <any> |
color |
private IntegerProperty |
copies |
private static java.lang.String |
DEFAULT_JOBNAME |
private boolean |
defaultCollation |
private boolean |
defaultCopies |
private boolean |
defaultPageLayout |
private boolean |
defaultPaperSource |
private boolean |
defaultPrintColor |
private boolean |
defaultPrintQuality |
private boolean |
defaultPrintResolution |
private boolean |
defaultSides |
private boolean |
hasOldCollation |
private boolean |
hasOldCopies |
private boolean |
hasOldPageLayout |
private boolean |
hasOldPaperSource |
private boolean |
hasOldPrintColor |
private boolean |
hasOldPrintQuality |
private boolean |
hasOldPrintResolution |
private boolean |
hasOldSides |
private PrinterJob |
job |
private SimpleStringProperty |
jobName |
private <any> |
layout |
private Collation |
oldCollation |
private int |
oldCopies |
private PageLayout |
oldPageLayout |
private PaperSource |
oldPaperSource |
private PrintColor |
oldPrintColor |
private PrintQuality |
oldPrintQuality |
private PrintResolution |
oldPrintResolution |
private PrintSides |
oldSides |
private <any> |
pageRanges |
private <any> |
paperSource |
private Printer |
printer |
private PrinterAttributes |
printerCaps |
private <any> |
quality |
private <any> |
resolution |
private <any> |
sides |
Constructor and Description |
---|
JobSettings(Printer printer) |
Modifier and Type | Method and Description |
---|---|
<any> |
collationProperty()
Property representing an instance of
Collation . |
IntegerProperty |
copiesProperty()
IntegerProperty representing the number of
copies of the job to print. |
Collation |
getCollation()
Collation determines how sheets are sorted when
multiple copies of a document are printed.
|
int |
getCopies()
Get the number of copies to print.
|
java.lang.String |
getJobName()
Get the name of a job.
|
PageLayout |
getPageLayout()
Get the current page layout for this job.
|
PageRange[] |
getPageRanges()
The range of pages to print.
|
PaperSource |
getPaperSource()
Gets the value of the property paperSource.
|
PrintColor |
getPrintColor()
Gets the value of the property printColor.
|
PrintQuality |
getPrintQuality()
Gets the value of the property printQuality.
|
PrintResolution |
getPrintResolution() |
PrintSides |
getPrintSides()
If a printer supports it, then a job may be printed on
both sides of the media (paper), ie duplex printing.
|
private boolean |
isJobNew() |
StringProperty |
jobNameProperty()
StringProperty representing the name of a job. |
<any> |
pageLayoutProperty()
Property representing an instance of
PageLayout . |
ObjectProperty |
pageRangesProperty()
An
ObjectProperty whose value represents the job pages
to print as an array of PageRange. |
<any> |
paperSourceProperty()
Property representing an instance of
PaperSource . |
<any> |
printColorProperty()
Property representing an instance of
PrintColor . |
<any> |
printQualityProperty()
Property representing an instance of
PrintQuality . |
<any> |
printResolutionProperty()
Property representing an instance of
PrintResolution . |
<any> |
printSidesProperty()
Property representing an instance of
PrintSides . |
void |
setCollation(Collation collation)
Set the
Collation property. |
void |
setCopies(int nCopies)
Set the number of copies to print.
|
void |
setJobName(java.lang.String name)
Set the name of a job.
|
void |
setPageLayout(PageLayout pageLayout)
Set the PageLayout to use.
|
void |
setPageRanges(PageRange... pages)
The range of pages to print as an array of PageRange.
|
void |
setPaperSource(PaperSource value)
Sets the value of the property paperSource.
|
void |
setPrintColor(PrintColor color)
Set the
PrintColor property. |
(package private) void |
setPrinterJob(PrinterJob job) |
void |
setPrintQuality(PrintQuality quality)
Set the
PrintQuality property. |
void |
setPrintResolution(PrintResolution resolution)
Set the
PrintResolution property. |
void |
setPrintSides(PrintSides sides)
Set the
PrintSides property which controls
duplex printing. |
java.lang.String |
toString() |
(package private) void |
updateForPrinter(Printer printer)
If any settings are incompatible with the specified printer,
they are updated to be compatible.
|
public final StringProperty jobNameProperty
StringProperty
representing the name of a job.getJobName()
,
setJobName(String)
public final IntegerProperty copiesProperty
IntegerProperty
representing the number of
copies of the job to print.getCopies()
,
setCopies(int)
public final ObjectProperty pageRangesProperty
ObjectProperty
whose value represents the job pages
to print as an array of PageRange.
A null values mean print all pages.
Otherwise it must be a non-overlapping array of PageRange
instances ordered in increasing page number.
Page numbers start from 1 (one).
An empty array is considered equivalent to a null array.
An illegal or unsupported (by the printer) set of page ranges will be ignored.
Ranges which exceed beyond the number of pages imaged by the job during printing do not cause any error.
getPageRanges()
,
setPageRanges(PageRange[])
public final <any> printSidesProperty
PrintSides
.getPrintSides()
,
setPrintSides(PrintSides)
public final <any> collationProperty
Collation
.getCollation()
,
setCollation(Collation)
public final <any> printColorProperty
PrintColor
.getPrintColor()
,
setPrintColor(PrintColor)
public final <any> printQualityProperty
PrintQuality
.getPrintQuality()
,
setPrintQuality(PrintQuality)
public final <any> printResolutionProperty
PrintResolution
.public final <any> paperSourceProperty
PaperSource
.getPaperSource()
,
setPaperSource(PaperSource)
public final <any> pageLayoutProperty
PageLayout
.getPageLayout()
,
setPageLayout(PageLayout)
private PrinterJob job
private Printer printer
private PrinterAttributes printerCaps
private boolean defaultCopies
private boolean hasOldCopies
private int oldCopies
private boolean defaultSides
private boolean hasOldSides
private PrintSides oldSides
private boolean defaultCollation
private boolean hasOldCollation
private Collation oldCollation
private boolean defaultPrintColor
private boolean hasOldPrintColor
private PrintColor oldPrintColor
private boolean defaultPrintQuality
private boolean hasOldPrintQuality
private PrintQuality oldPrintQuality
private boolean defaultPrintResolution
private boolean hasOldPrintResolution
private PrintResolution oldPrintResolution
private boolean defaultPaperSource
private boolean hasOldPaperSource
private PaperSource oldPaperSource
private boolean defaultPageLayout
private boolean hasOldPageLayout
private PageLayout oldPageLayout
private static final java.lang.String DEFAULT_JOBNAME
private SimpleStringProperty jobName
private IntegerProperty copies
private <any> pageRanges
private <any> sides
private <any> collation
private <any> color
private <any> quality
private <any> resolution
private <any> paperSource
private <any> layout
JobSettings(Printer printer)
void setPrinterJob(PrinterJob job)
private boolean isJobNew()
void updateForPrinter(Printer printer)
public final StringProperty jobNameProperty()
StringProperty
representing the name of a job.getJobName()
,
setJobName(String)
public java.lang.String getJobName()
public void setJobName(java.lang.String name)
name
- string representing the name of a jobpublic final IntegerProperty copiesProperty()
IntegerProperty
representing the number of
copies of the job to print.getCopies()
,
setCopies(int)
public int getCopies()
public final void setCopies(int nCopies)
nCopies
- number of copies to printpublic final ObjectProperty pageRangesProperty()
ObjectProperty
whose value represents the job pages
to print as an array of PageRange.
A null values mean print all pages.
Otherwise it must be a non-overlapping array of PageRange
instances ordered in increasing page number.
Page numbers start from 1 (one).
An empty array is considered equivalent to a null array.
An illegal or unsupported (by the printer) set of page ranges will be ignored.
Ranges which exceed beyond the number of pages imaged by the job during printing do not cause any error.
getPageRanges()
,
setPageRanges(PageRange[])
public PageRange[] getPageRanges()
pageRangesProperty
for more details.public void setPageRanges(PageRange... pages)
((PageRange[])null)
always means all pages however
since this is the default it is less likely to be used.
See pageRangesProperty
for more details.pages
- null or a varargs array as specified abovepublic final <any> printSidesProperty()
PrintSides
.getPrintSides()
,
setPrintSides(PrintSides)
public PrintSides getPrintSides()
public void setPrintSides(PrintSides sides)
PrintSides
property which controls
duplex printing.
A null value is ignored.sides
- new setting for number of sides.public final <any> collationProperty()
Collation
.getCollation()
,
setCollation(Collation)
public Collation getCollation()
false
) is the typical default value.public void setCollation(Collation collation)
Collation
property.
A null value is ignored.collation
- new setting for collationpublic final <any> printColorProperty()
PrintColor
.getPrintColor()
,
setPrintColor(PrintColor)
public PrintColor getPrintColor()
public void setPrintColor(PrintColor color)
PrintColor
property.
A null value is ignored.color
- new setting for print color.public final <any> printQualityProperty()
PrintQuality
.getPrintQuality()
,
setPrintQuality(PrintQuality)
public PrintQuality getPrintQuality()
public void setPrintQuality(PrintQuality quality)
PrintQuality
property.
A null value is ignored.
Note that quality and resolution overlapping concepts. Therefore a printer may support setting one, or the other but not both. Applications setting these programmatically should query both properties and select appropriately from the supported values. If a printer supports non-standard values, code likely cannot distinguish the printer's interpretation of these values and is safest to stick to selecting from the standard value that matches the requirement.
quality
- new setting for print quality.public final <any> printResolutionProperty()
PrintResolution
.public PrintResolution getPrintResolution()
public void setPrintResolution(PrintResolution resolution)
PrintResolution
property.
A null value is ignored.
Note that quality and resolution overlapping concepts. Therefore a printer may support setting one, or the other but not both. Applications setting these programmatically should query both properties and select appropriately from the supported values. If a printer supports non-standard values, code likely cannot distinguish the printer's interpretation of these values and is safest to stick to selecting from the standard value that matches the requirement.
resolution
- new setting for print resolution.public final <any> paperSourceProperty()
PaperSource
.getPaperSource()
,
setPaperSource(PaperSource)
public PaperSource getPaperSource()
public void setPaperSource(PaperSource value)
public final <any> pageLayoutProperty()
PageLayout
.getPageLayout()
,
setPageLayout(PageLayout)
public PageLayout getPageLayout()
public void setPageLayout(PageLayout pageLayout)
pageLayout
- The page layout to use.public java.lang.String toString()
toString
in class java.lang.Object