A set of attributes which control a print job.
Instances of this class control the number of copies, default selection,
destination, print dialog, file and printer names, page ranges, multiple
document handling (including collation), and multi-page imposition (such
as duplex) of every print job which uses the instance. Attribute names are
compliant with the Internet Printing Protocol (IPP) 1.1 where possible.
Attribute values are partially compliant where possible.
To use a method which takes an inner class type, pass a reference to
one of the constant fields of the inner class. Client code cannot create
new instances of the inner class types because none of those classes
has a public constructor. For example, to set the print dialog type to
the cross-platform, pure Java print dialog, use the following code:
import java.awt.JobAttributes;
public class PureJavaPrintDialogExample {
public void setPureJavaPrintDialog(JobAttributes jobAttributes) {
jobAttributes.setDialog(JobAttributes.DialogType.COMMON);
}
}
Every IPP attribute which supports an attributeName-default value
has a corresponding setattributeNameToDefault
method.
Default value fields are not provided.
Constructs a JobAttributes
instance with default
values for every attribute. The dialog defaults to
DialogType.NATIVE
. Min page defaults to
1
. Max page defaults to Integer.MAX_VALUE
.
Destination defaults to DestinationType.PRINTER
.
Selection defaults to DefaultSelectionType.ALL
.
Number of copies defaults to 1
. Multiple document handling defaults
to MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
.
Sides defaults to SidesType.ONE_SIDED
. File name defaults
to null
.
Constructs a JobAttributes
instance which is a copy
of the supplied JobAttributes
.
Constructs a JobAttributes
instance with the
specified values for every attribute.
Creates and returns a copy of this JobAttributes
.
Determines whether two JobAttributes are equal to each other.
Two JobAttributes are equal if and only if each of their attributes are
equal. Attributes of enumeration type are equal if and only if the
fields refer to the same unique enumeration object. A set of page
ranges is equal if and only if the sets are of equal length, each range
enumerates the same pages, and the ranges are in the same order.
Returns the runtime class of an object. That Class
object is the object that is locked by static synchronized
methods of the represented class.
Returns the number of copies the application should render for jobs
using these attributes. This attribute is updated to the value chosen
by the user.
Specifies whether, for jobs using these attributes, the application
should print all pages, the range specified by the return value of
getPageRanges
, or the current selection. This attribute
is updated to the value chosen by the user.
Specifies whether output will be to a printer or a file for jobs using
these attributes. This attribute is updated to the value chosen by the
user.
Returns whether, for jobs using these attributes, the user should see
a print dialog in which to modify the print settings, and which type of
print dialog should be displayed. DialogType.COMMON denotes a cross-
platform, pure Java print dialog. DialogType.NATIVE denotes the
platform's native print dialog. If a platform does not support a native
print dialog, the pure Java print dialog is displayed instead.
DialogType.NONE specifies no print dialog (i.e., background printing).
This attribute cannot be modified by, and is not subject to any
limitations of, the implementation or the target printer.
Specifies the file name for the output file for jobs using these
attributes. This attribute is updated to the value chosen by the user.
Returns, for jobs using these attributes, the first page to be
printed, if a range of pages is to be printed. This attribute is
updated to the value chosen by the user. An application should ignore
this attribute on output, unless the return value of the
getDefaultSelection
method is DefaultSelectionType.RANGE. An
application should honor the return value of getPageRanges
over the return value of this method, if possible.
Specifies the maximum value the user can specify as the last page to
be printed for jobs using these attributes. This attribute cannot be
modified by, and is not subject to any limitations of, the
implementation or the target printer.
Specifies the minimum value the user can specify as the first page to
be printed for jobs using these attributes. This attribute cannot be
modified by, and is not subject to any limitations of, the
implementation or the target printer.
Specifies the handling of multiple copies, including collation, for
jobs using these attributes. This attribute is updated to the value
chosen by the user.
Specifies, for jobs using these attributes, the ranges of pages to be
printed, if a range of pages is to be printed. All range numbers are
inclusive. This attribute is updated to the value chosen by the user.
An application should ignore this attribute on output, unless the
return value of the getDefaultSelection
method is
DefaultSelectionType.RANGE.
Returns the destination printer for jobs using these attributes. This
attribute is updated to the value chosen by the user.
Returns how consecutive pages should be imposed upon the sides of the
print medium for jobs using these attributes. SidesType.ONE_SIDED
imposes each consecutive page upon the same side of consecutive media
sheets. This imposition is sometimes called simplex.
SidesType.TWO_SIDED_LONG_EDGE imposes each consecutive pair of pages
upon front and back sides of consecutive media sheets, such that the
orientation of each pair of pages on the medium would be correct for
the reader as if for binding on the long edge. This imposition is
sometimes called duplex. SidesType.TWO_SIDED_SHORT_EDGE imposes
each consecutive pair of pages upon front and back sides of consecutive
media sheets, such that the orientation of each pair of pages on the
medium would be correct for the reader as if for binding on the short
edge. This imposition is sometimes called tumble. This attribute
is updated to the value chosen by the user.
Returns, for jobs using these attributes, the last page (inclusive)
to be printed, if a range of pages is to be printed. This attribute is
updated to the value chosen by the user. An application should ignore
this attribute on output, unless the return value of the
getDefaultSelection
method is DefaultSelectionType.RANGE. An
application should honor the return value of getPageRanges
over the return value of this method, if possible.
Returns a hash code value for this JobAttributes.
Wakes up a single thread that is waiting on this object's
monitor. If any threads are waiting on this object, one of them
is chosen to be awakened. The choice is arbitrary and occurs at
the discretion of the implementation. A thread waits on an object's
monitor by calling one of the
wait
methods.
The awakened thread will not be able to proceed until the current
thread relinquishes the lock on this object. The awakened thread will
compete in the usual manner with any other threads that might be
actively competing to synchronize on this object; for example, the
awakened thread enjoys no reliable privilege or disadvantage in being
the next thread to lock this object.
This method should only be called by a thread that is the owner
of this object's monitor. A thread becomes the owner of the
object's monitor in one of three ways:
- By executing a synchronized instance method of that object.
- By executing the body of a
synchronized
statement
that synchronizes on the object.
- For objects of type
Class,
by executing a
synchronized static method of that class.
Only one thread at a time can own an object's monitor.
Wakes up all threads that are waiting on this object's monitor. A
thread waits on an object's monitor by calling one of the
wait
methods.
The awakened threads will not be able to proceed until the current
thread relinquishes the lock on this object. The awakened threads
will compete in the usual manner with any other threads that might
be actively competing to synchronize on this object; for example,
the awakened threads enjoy no reliable privilege or disadvantage in
being the next thread to lock this object.
This method should only be called by a thread that is the owner
of this object's monitor. See the notify
method for a
description of the ways in which a thread can become the owner of
a monitor.
Sets all of the attributes of this JobAttributes
to
the same values as the attributes of obj.
Specifies the number of copies the application should render for jobs
using these attributes. Not specifying this attribute is equivalent to
specifying 1
.
Sets the number of copies the application should render for jobs using
these attributes to the default. The default number of copies is 1.
Specifies whether, for jobs using these attributes, the application
should print all pages, the range specified by the return value of
getPageRanges
, or the current selection. Not specifying
this attribute is equivalent to specifying DefaultSelectionType.ALL.
Specifies whether output will be to a printer or a file for jobs using
these attributes. Not specifying this attribute is equivalent to
specifying DesintationType.PRINTER.
Specifies whether, for jobs using these attributes, the user should see
a print dialog in which to modify the print settings, and which type of
print dialog should be displayed. DialogType.COMMON denotes a cross-
platform, pure Java print dialog. DialogType.NATIVE denotes the
platform's native print dialog. If a platform does not support a native
print dialog, the pure Java print dialog is displayed instead.
DialogType.NONE specifies no print dialog (i.e., background printing).
Not specifying this attribute is equivalent to specifying
DialogType.NATIVE.
Specifies the file name for the output file for jobs using these
attributes. Default is platform-dependent and implementation-defined.
Specifies, for jobs using these attributes, the first page to be
printed, if a range of pages is to be printed. If this attribute is not
specified, then the values from the pageRanges attribute are used. If
pageRanges and either or both of fromPage and toPage are specified,
pageRanges takes precedence. Specifying none of pageRanges, fromPage,
or toPage is equivalent to calling
setPageRanges(new int[][] { new int[] { minPage } });
Specifies the maximum value the user can specify as the last page to
be printed for jobs using these attributes. Not specifying this
attribute is equivalent to specifying Integer.MAX_VALUE
.
Specifies the minimum value the user can specify as the first page to
be printed for jobs using these attributes. Not specifying this
attribute is equivalent to specifying 1
.
Specifies the handling of multiple copies, including collation, for
jobs using these attributes. Not specifying this attribute is equivalent
to specifying
MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.
Sets the handling of multiple copies, including collation, for jobs
using these attributes to the default. The default handling is
MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.
Specifies, for jobs using these attributes, the ranges of pages to be
printed, if a range of pages is to be printed. All range numbers are
inclusive. If this attribute is not specified, then the values from the
fromPage and toPages attributes are used. If pageRanges and either or
both of fromPage and toPage are specified, pageRanges takes precedence.
Specifying none of pageRanges, fromPage, or toPage is equivalent to
calling setPageRanges(new int[][] { new int[] { minPage,
minPage } });
Specifies the destination printer for jobs using these attributes.
Default is platform-dependent and implementation-defined.
Specifies how consecutive pages should be imposed upon the sides of the
print medium for jobs using these attributes. SidesType.ONE_SIDED
imposes each consecutive page upon the same side of consecutive media
sheets. This imposition is sometimes called simplex.
SidesType.TWO_SIDED_LONG_EDGE imposes each consecutive pair of pages
upon front and back sides of consecutive media sheets, such that the
orientation of each pair of pages on the medium would be correct for
the reader as if for binding on the long edge. This imposition is
sometimes called duplex. SidesType.TWO_SIDED_SHORT_EDGE imposes
each consecutive pair of pages upon front and back sides of consecutive
media sheets, such that the orientation of each pair of pages on the
medium would be correct for the reader as if for binding on the short
edge. This imposition is sometimes called tumble. Not specifying
this attribute is equivalent to specifying SidesType.ONE_SIDED.
Sets how consecutive pages should be imposed upon the sides of the
print medium for jobs using these attributes to the default. The
default imposition is SidesType.ONE_SIDED.
Specifies, for jobs using these attributes, the last page (inclusive)
to be printed, if a range of pages is to be printed.
If this attribute is not specified, then the values from the pageRanges
attribute are used. If pageRanges and either or both of fromPage and
toPage are specified, pageRanges takes precedence. Specifying none of
pageRanges, fromPage, or toPage is equivalent to calling
setPageRanges(new int[][] { new int[] { minPage } });
Returns a string representation of this JobAttributes.
Causes current thread to wait until another thread invokes the
method or the
method for this object.
In other words, this method behaves exactly as if it simply
performs the call
wait(0).
The current thread must own this object's monitor. The thread
releases ownership of this monitor and waits until another thread
notifies threads waiting on this object's monitor to wake up
either through a call to the notify
method or the
notifyAll
method. The thread then waits until it can
re-obtain ownership of the monitor and resumes execution.
As in the one argument version, interrupts and spurious wakeups are
possible, and this method should always be used in a loop:
synchronized (obj) {
while (<condition does not hold>)
obj.wait();
... // Perform action appropriate to condition
}
This method should only be called by a thread that is the owner
of this object's monitor. See the
notify
method for a
description of the ways in which a thread can become the owner of
a monitor.
Causes current thread to wait until either another thread invokes the
method or the
method for this object, or a
specified amount of time has elapsed.
The current thread must own this object's monitor.
This method causes the current thread (call it T) to
place itself in the wait set for this object and then to relinquish
any and all synchronization claims on this object. Thread T
becomes disabled for thread scheduling purposes and lies dormant
until one of four things happens:
- Some other thread invokes the notify method for this
object and thread T happens to be arbitrarily chosen as
the thread to be awakened.
- Some other thread invokes the notifyAll method for this
object.
- Some other thread interrupts
thread T.
- The specified amount of real time has elapsed, more or less. If
timeout is zero, however, then real time is not taken into
consideration and the thread simply waits until notified.
The thread
T is then removed from the wait set for this
object and re-enabled for thread scheduling. It then competes in the
usual manner with other threads for the right to synchronize on the
object; once it has gained control of the object, all its
synchronization claims on the object are restored to the status quo
ante - that is, to the situation as of the time that the
wait
method was invoked. Thread
T then returns from the
invocation of the
wait method. Thus, on return from the
wait method, the synchronization state of the object and of
thread
T is exactly as it was when the
wait method
was invoked.
A thread can also wake up without being notified, interrupted, or
timing out, a so-called spurious wakeup. While this will rarely
occur in practice, applications must guard against it by testing for
the condition that should have caused the thread to be awakened, and
continuing to wait if the condition is not satisfied. In other words,
waits should always occur in loops, like this one:
synchronized (obj) {
while (<condition does not hold>)
obj.wait(timeout);
... // Perform action appropriate to condition
}
(For more information on this topic, see Section 3.2.3 in Doug Lea's
"Concurrent Programming in Java (Second Edition)" (Addison-Wesley,
2000), or Item 50 in Joshua Bloch's "Effective Java Programming
Language Guide" (Addison-Wesley, 2001).
If the current thread is
interrupted
by another thread
while it is waiting, then an InterruptedException is thrown.
This exception is not thrown until the lock status of this object has
been restored as described above.
Note that the wait method, as it places the current thread
into the wait set for this object, unlocks only this object; any
other objects on which the current thread may be synchronized remain
locked while the thread waits.
This method should only be called by a thread that is the owner
of this object's monitor. See the notify
method for a
description of the ways in which a thread can become the owner of
a monitor.
Causes current thread to wait until another thread invokes the
method or the
method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
This method is similar to the wait
method of one
argument, but it allows finer control over the amount of time to
wait for a notification before giving up. The amount of real time,
measured in nanoseconds, is given by:
1000000*timeout+nanos
In all other respects, this method does the same thing as the
method
of one argument. In particular,
wait(0, 0) means the same thing as wait(0).
The current thread must own this object's monitor. The thread
releases ownership of this monitor and waits until either of the
following two conditions has occurred:
- Another thread notifies threads waiting on this object's monitor
to wake up either through a call to the
notify
method
or the notifyAll
method.
- The timeout period, specified by
timeout
milliseconds plus nanos
nanoseconds arguments, has
elapsed.
The thread then waits until it can re-obtain ownership of the
monitor and resumes execution.
As in the one argument version, interrupts and spurious wakeups are
possible, and this method should always be used in a loop:
synchronized (obj) {
while (<condition does not hold>)
obj.wait(timeout, nanos);
... // Perform action appropriate to condition
}
This method should only be called by a thread that is the owner
of this object's monitor. See the
notify
method for a
description of the ways in which a thread can become the owner of
a monitor.