Spec-Zone .ru
спецификации, руководства, описания, API
|
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.JobAttributes
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.
Inner Class Summary | |
static class |
JobAttributes.DefaultSelectionType
A type-safe enumeration of possible default selection states. |
static class |
JobAttributes.DestinationType
A type-safe enumeration of possible job destinations. |
static class |
JobAttributes.DialogType
A type-safe enumeration of possible dialogs to display to the user. |
static class |
JobAttributes.MultipleDocumentHandlingType
A type-safe enumeration of possible multiple document handling states. |
static class |
JobAttributes.SidesType
A type-safe enumeration of possible multi-page impositions. |
Constructor Summary | |
JobAttributes()
Constructs a JobAttributes instance with default values for every attribute. |
|
JobAttributes(int copies,
JobAttributes.DefaultSelectionType defaultSelection,
JobAttributes.DestinationType destination,
JobAttributes.DialogType dialog,
String fileName,
int maxPage,
int minPage,
JobAttributes.MultipleDocumentHandlingType multipleDocumentHandling,
int[][] pageRanges,
String printer,
JobAttributes.SidesType sides)
Constructs a JobAttributes instance with the specified values for every attribute. |
|
JobAttributes(JobAttributes obj)
Constructs a JobAttributes instance which is a copy of the supplied JobAttributes. |
Method Summary | |
Object |
clone()
Creates and returns a copy of this JobAttributes. |
boolean |
equals(Object obj)
Determines whether two JobAttributes are equal to each other. |
int |
getCopies()
Returns the number of copies the application should render for jobs using these attributes. |
JobAttributes.DefaultSelectionType |
getDefaultSelection()
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. |
JobAttributes.DestinationType |
getDestination()
Specifies whether output will be to a printer or a file for jobs using these attributes. |
JobAttributes.DialogType |
getDialog()
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. |
String |
getFileName()
Specifies the file name for the output file for jobs using these attributes. |
int |
getFromPage()
Returns, for jobs using these attributes, the first page to be printed, if a range of pages is to be printed. |
int |
getMaxPage()
Specifies the maximum value the user can specify as the last page to be printed for jobs using these attributes. |
int |
getMinPage()
Specifies the minimum value the user can specify as the first page to be printed for jobs using these attributes. |
JobAttributes.MultipleDocumentHandlingType |
getMultipleDocumentHandling()
Specifies the handling of multiple documents, including collation, for jobs using these attributes. |
int[][] |
getPageRanges()
Specifies, for jobs using these attributes, the ranges of pages to be printed, if a range of pages is to be printed. |
String |
getPrinter()
Returns the destination printer for jobs using these attributes. |
JobAttributes.SidesType |
getSides()
Returns how consecutive pages should be imposed upon the sides of the print medium for jobs using these attributes. |
int |
getToPage()
Returns, for jobs using these attributes, the last page (inclusive) to be printed, if a range of pages is to be printed. |
int |
hashCode()
Returns a hash code value for this JobAttributes. |
void |
set(JobAttributes obj)
Sets all of the attributes of this JobAttributes to the same values as the attributes of obj. |
void |
setCopies(int copies)
Specifies the number of copies the application should render for jobs using these attributes. |
void |
setCopiesToDefault()
Sets the number of copies the application should render for jobs using these attributes to the default. |
void |
setDefaultSelection(JobAttributes.DefaultSelectionType defaultSelection)
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. |
void |
setDestination(JobAttributes.DestinationType destination)
Specifies whether output will be to a printer or a file for jobs using these attributes. |
void |
setDialog(JobAttributes.DialogType dialog)
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. |
void |
setFileName(String fileName)
Specifies the file name for the output file for jobs using these attributes. |
void |
setFromPage(int fromPage)
Specifies, for jobs using these attributes, the first page to be printed, if a range of pages is to be printed. |
void |
setMaxPage(int maxPage)
Specifies the maximum value the user can specify as the last page to be printed for jobs using these attributes. |
void |
setMinPage(int minPage)
Specifies the minimum value the user can specify as the first page to be printed for jobs using these attributes. |
void |
setMultipleDocumentHandling(JobAttributes.MultipleDocumentHandlingType multipleDocumentHandling)
Specifies the handling of multiple documents, including collation, for jobs using these attributes. |
void |
setMultipleDocumentHandlingToDefault()
Sets the handling of multiple documents, including collation, for jobs using these attributes to the default. |
void |
setPageRanges(int[][] pageRanges)
Specifies, for jobs using these attributes, the ranges of pages to be printed, if a range of pages is to be printed. |
void |
setPrinter(String printer)
Specifies the destination printer for jobs using these attributes. |
void |
setSides(JobAttributes.SidesType sides)
Specifies how consecutive pages should be imposed upon the sides of the print medium for jobs using these attributes. |
void |
setSidesToDefault()
Sets how consecutive pages should be imposed upon the sides of the print medium for jobs using these attributes to the default. |
void |
setToPage(int toPage)
Specifies, for jobs using these attributes, the last page (inclusive) to be printed, if a range of pages is to be printed. |
String |
toString()
Returns a string representation of this JobAttributes. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JobAttributes()
public JobAttributes(JobAttributes obj)
obj
- the JobAttributes to copy.public JobAttributes(int copies, JobAttributes.DefaultSelectionType defaultSelection, JobAttributes.DestinationType destination, JobAttributes.DialogType dialog, String fileName, int maxPage, int minPage, JobAttributes.MultipleDocumentHandlingType multipleDocumentHandling, int[][] pageRanges, String printer, JobAttributes.SidesType sides)
copies
- an integer greater than 0.defaultSelection
- DefaultSelectionType.ALL,
DefaultSelectionType.RANGE, or DefaultSelectionType.SELECTION.destination
- DesintationType.FILE or DesintationType.PRINTER.dialog
- DialogType.COMMON, DialogType.NATIVE, or
DialogType.NONE.fileName
- the possibly null file name.maxPage
- an integer greater than zero and greater than or equal
to minPage.minPage
- an integer greater than zero and less than or equal
to maxPage.multipleDocumentHandling
- MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES or
MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.pageRanges
- an array of integer arrays of 2 elements. An array
is interpreted as a range spanning all pages including and
between the specified pages. Ranges must be in ascending
order and must not overlap. Specified page numbers cannot be
less than minPage nor greater than maxPage.
For example:
(new int[][] { new int[] { 1, 3 }, new int[] { 5, 5 },
new int[] { 15, 19 } }),
specifies pages 1, 2, 3, 5, 15, 16, 17, 18, and 19. Note that
(new int[][] { new int[] { 1, 1 }, new int[] { 1, 2 } }),
is an invalid set of page ranges because the two ranges
overlap.printer
- the possibly null printer name.sides
- SidesType.ONE_SIDED, SidesType.TWO_SIDED_LONG_EDGE, or
SidesType.TWO_SIDED_SHORT_EDGE.IllegalArgumentException
- if one or more of the above
conditions is violated.Method Detail |
public Object clone()
clone
in class Object
public void set(JobAttributes obj)
obj
- the JobAttributes to copy.public int getCopies()
public void setCopies(int copies)
1
.copies
- an integer greater than 0.IllegalArgumentException
- if copies is less than or equal to 0.public void setCopiesToDefault()
public JobAttributes.DefaultSelectionType getDefaultSelection()
getPageRanges
, or the current selection. This attribute
is updated to the value chosen by the user.public void setDefaultSelection(JobAttributes.DefaultSelectionType defaultSelection)
getPageRanges
, or the current selection. Not specifying
this attribute is equivalent to specifying DefaultSelectionType.ALL.defaultSelection
- DefaultSelectionType.ALL,
DefaultSelectionType.RANGE, or DefaultSelectionType.SELECTION.IllegalArgumentException
- if defaultSelection is null.public JobAttributes.DestinationType getDestination()
public void setDestination(JobAttributes.DestinationType destination)
destination
- DesintationType.FILE or DesintationType.PRINTER.IllegalArgumentException
- if destination is null.public JobAttributes.DialogType getDialog()
public void setDialog(JobAttributes.DialogType dialog)
dialog
- DialogType.COMMON, DialogType.NATIVE, or
DialogType.NONE.IllegalArgumentException
- if dialog is null.public String getFileName()
public void setFileName(String fileName)
fileName
- the possibly null file name.public int getFromPage()
getDefaultSelection
method is DefaultSelectionType.RANGE. An
application should honor the return value of getPageRanges
over the return value of this method, if possible.public void setFromPage(int fromPage)
fromPage
- an integer greater than zero and less than or equal to
toPage and greater than or equal to minPage and
less than or equal to maxPage.IllegalArgumentException
- if one or more of the above
conditions is violated.public int getMaxPage()
public void setMaxPage(int maxPage)
Integer.MAX_VALUE
.maxPage
- an integer greater than zero and greater than or equal
to minPage.IllegalArgumentException
- if one or more of the above
conditions is violated.public int getMinPage()
public void setMinPage(int minPage)
1
.minPage
- an integer greater than zero and less than or equal
to maxPage.IllegalArgumentException
- if one or more of the above
conditions is violated.public JobAttributes.MultipleDocumentHandlingType getMultipleDocumentHandling()
public void setMultipleDocumentHandling(JobAttributes.MultipleDocumentHandlingType multipleDocumentHandling)
multipleDocumentHandling
- MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES or
MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.IllegalArgumentException
- if multipleDocumentHandling is null.public void setMultipleDocumentHandlingToDefault()
public int[][] getPageRanges()
getDefaultSelection
method is
DefaultSelectionType.RANGE.public void setPageRanges(int[][] pageRanges)
pageRanges
- an array of integer arrays of 2 elements. An array
is interpreted as a range spanning all pages including and
between the specified pages. Ranges must be in ascending
order and must not overlap. Specified page numbers cannot be
less than minPage nor greater than maxPage.
For example:
(new int[][] { new int[] { 1, 3 }, new int[] { 5, 5 },
new int[] { 15, 19 } }),
specifies pages 1, 2, 3, 5, 15, 16, 17, 18, and 19. Note that
(new int[][] { new int[] { 1, 1 }, new int[] { 1, 2 } }),
is an invalid set of page ranges because the two ranges
overlap.IllegalArgumentException
- if one or more of the above
conditions is violated.public String getPrinter()
public void setPrinter(String printer)
printer
- the possibly null printer name.public JobAttributes.SidesType getSides()
public void setSides(JobAttributes.SidesType sides)
sides
- SidesType.ONE_SIDED, SidesType.TWO_SIDED_LONG_EDGE, or
SidesType.TWO_SIDED_SHORT_EDGE.IllegalArgumentException
- if sides is null.public void setSidesToDefault()
public int getToPage()
getDefaultSelection
method is DefaultSelectionType.RANGE. An
application should honor the return value of getPageRanges
over the return value of this method, if possible.public void setToPage(int toPage)
toPage
- an integer greater than zero and greater than or equal
to fromPage and greater than or equal to minPage
and less than or equal to maxPage.IllegalArgumentException
- if one or more of the above
conditions is violated.public boolean equals(Object obj)
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.
equals
in class Object
obj
- the object whose equality will be checked.public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.