public final class JobAttributes extends Object implements Cloneable
此类的实例控制副本的数量、默认选择、目标、打印对话框、文件和打印机名称、页面范围、多文档处理(包括排序规则)和使用实例的每一个打印作业的多页征收(如双面打印)。属性名是符合互联网打印协议(IPP)1.1可能。属性值在可能的情况下部分兼容。
要使用一个方法,它需要一个内部类类型,通过引用一个内部类的常量字段。客户端代码无法创建内部类类型的新实例,因为这些类中没有一个有公共构造函数。例如,设置打印对话框类型的跨平台,纯java打印对话框,使用以下代码:
进口java.awt.jobattributes;公共课purejavaprintdialogexample {公共无效setpurejavaprintdialog(jobattributes jobattributes){jobattributes。setdialog(jobattributes。dialogtype。常见);}}
每一个IPP属性支持空属性-默认值有相应的setattributeNameToDefault方法。未提供默认值字段。
| Modifier and Type | Class and Description |
|---|---|
static class |
JobAttributes.DefaultSelectionType
一种可能的默认选择状态的类型安全枚举。
|
static class |
JobAttributes.DestinationType
一种可能的作业目的地的类型安全枚举。
|
static class |
JobAttributes.DialogType
类型安全枚举可能的对话框显示给用户。
|
static class |
JobAttributes.MultipleDocumentHandlingType
一种可能的多个拷贝处理状态的类型安全枚举。
|
static class |
JobAttributes.SidesType
类型安全枚举可能的多页拼版。
|
| Constructor and Description |
|---|
JobAttributes()
构建了一个
JobAttributes实例为每个属性的默认值。
|
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)
构建了一个
JobAttributes实例为每个属性指定的值。
|
JobAttributes(JobAttributes obj)
构建了一个
JobAttributes实例这是一份提供的
JobAttributes。
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
创建并返回一个拷贝这个
JobAttributes。
|
boolean |
equals(Object obj)
确定两个jobattributes相等。
|
int |
getCopies()
返回应用程序应使用这些属性为工作提供的副本的数量。
|
JobAttributes.DefaultSelectionType |
getDefaultSelection()
指定是否使用这些属性的工作,应用程序应该打印所有页面,通过
getPageRanges返回值指定的范围,或当前的选择。
|
JobAttributes.DestinationType |
getDestination()
指定是否将输出到打印机或使用这些属性的作业的文件。
|
JobAttributes.DialogType |
getDialog()
返回是否使用这些属性的作业,用户应该看到一个打印对话框来修改打印设置,并显示哪些类型的打印对话框。
|
String |
getFileName()
指定使用这些属性的作业的输出文件的文件名。
|
int |
getFromPage()
使用这些属性的工作,如果要打印一个范围的页面,则使用这些属性的第一个页面。
|
int |
getMaxPage()
指定用户可以指定为使用这些属性打印作业的最后一页的最大值。
|
int |
getMinPage()
指定用户可以指定为使用这些属性打印的第一页的最小值。
|
JobAttributes.MultipleDocumentHandlingType |
getMultipleDocumentHandling()
指定使用这些属性的作业的多个副本的处理。
|
int[][] |
getPageRanges()
指定使用这些属性的作业,如果要打印一系列的页,则要打印的页的范围。
|
String |
getPrinter()
使用这些属性返回作业的目标打印机。
|
JobAttributes.SidesType |
getSides()
返回如何使用这些属性对打印介质的两侧施加连续的页面。
|
int |
getToPage()
返回,使用这些属性的作业,最后一页(包含)将被打印,如果一个范围的页面将被打印。
|
int |
hashCode()
返回此jobattributes哈希代码值。
|
void |
set(JobAttributes obj)
集所有这
JobAttributes属性相同的值作为对象的属性。
|
void |
setCopies(int copies)
指定应用程序应使用这些属性的副本的数量。
|
void |
setCopiesToDefault()
设置应用程序应该使用这些属性的默认值的副本的数量。
|
void |
setDefaultSelection(JobAttributes.DefaultSelectionType defaultSelection)
指定是否使用这些属性的工作,应用程序应该打印所有页面,通过
getPageRanges返回值指定的范围,或当前的选择。
|
void |
setDestination(JobAttributes.DestinationType destination)
指定是否将输出到打印机或使用这些属性的作业的文件。
|
void |
setDialog(JobAttributes.DialogType dialog)
指定是否使用这些属性的作业,用户应该看到一个打印对话框来修改打印设置,并显示哪些类型的打印对话框。
|
void |
setFileName(String fileName)
指定使用这些属性的作业的输出文件的文件名。
|
void |
setFromPage(int fromPage)
指定使用这些属性的作业,如果要打印一个范围的页面,则要打印第一页。
|
void |
setMaxPage(int maxPage)
指定用户可以指定为使用这些属性打印作业的最后一页的最大值。
|
void |
setMinPage(int minPage)
指定用户可以指定为使用这些属性打印的第一页的最小值。
|
void |
setMultipleDocumentHandling(JobAttributes.MultipleDocumentHandlingType multipleDocumentHandling)
指定使用这些属性的作业的多个副本的处理。
|
void |
setMultipleDocumentHandlingToDefault()
设置使用这些属性的默认值的多个副本的处理。
|
void |
setPageRanges(int[][] pageRanges)
指定使用这些属性的作业,如果要打印一系列的页,则要打印的页的范围。
|
void |
setPrinter(String printer)
指定使用这些属性的作业的目标打印机。
|
void |
setSides(JobAttributes.SidesType sides)
指定使用这些属性的作业的打印介质的两侧应如何施加连续的页。
|
void |
setSidesToDefault()
设置如何使用这些属性的默认打印介质的打印介质的两侧上的连续页。
|
void |
setToPage(int toPage)
指定使用这些属性的作业,如果要打印一个范围内的页面,则要打印最后一页(包含)。
|
String |
toString()
返回该jobattributes字符串表示形式。
|
public JobAttributes()
JobAttributes实例为每个属性的默认值。对话框的默认
DialogType.NATIVE。最小页面默认为
1。马克斯页的默认
Integer.MAX_VALUE。目的地默认
DestinationType.PRINTER。选择默认
DefaultSelectionType.ALL份默认
1数。多文档处理默认
MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES。双方默认
SidesType.ONE_SIDED。文件名默认为
null。
public JobAttributes(JobAttributes obj)
JobAttributes实例这是一份提供的
JobAttributes。
obj -
JobAttributes复制
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)
JobAttributes实例为每个属性指定的值。
copies -大于0的整数
defaultSelection -
DefaultSelectionType.ALL,
DefaultSelectionType.RANGE,或
DefaultSelectionType.SELECTION
destination -
DesintationType.FILE或
DesintationType.PRINTER
dialog -
DialogType.COMMON,
DialogType.NATIVE,或
DialogType.NONE
fileName -可能
null文件名
maxPage -大于零的整数,大于或等于nullminpage
minPage整数大于零、小于或等于nullmaxpage
multipleDocumentHandling -
MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES或
MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
pageRanges -二元整数数组的数组;数组被解释为一个跨越所有页面包括指定页面之间的范围;范围必须以升序和不能重叠;指定的页面数不能少于nullminpage也大于nullmaxpage;例如:
(新国际[ ] [ ] {新国际[ ] { 1,3 },新国际[ ] { 5,5 },新国际[ ] { 15,19 } }),指定1,2,3,5,15,16,17,18页,19。注意:(
new int[][] { new int[] { 1, 1 }, new int[] { 1, 2 } }),是一个无效的设置页面范围因为两范围重叠
printer -可能
null打印机名称
sides -
SidesType.ONE_SIDED,
SidesType.TWO_SIDED_LONG_EDGE,或
SidesType.TWO_SIDED_SHORT_EDGE
IllegalArgumentException如果上述一个或多个条件被违反
public Object clone()
JobAttributes。
public void set(JobAttributes obj)
JobAttributes属性相同的值作为对象的属性。
obj -
JobAttributes复制
public int getCopies()
public void setCopies(int copies)
1。
copies -大于0的整数
IllegalArgumentException -如果
copies小于或等于0
public void setCopiesToDefault()
public JobAttributes.DefaultSelectionType getDefaultSelection()
getPageRanges返回值指定的范围,或当前的选择。此属性被更新为由用户选择的值。
public void setDefaultSelection(JobAttributes.DefaultSelectionType defaultSelection)
getPageRanges返回值指定的范围,或当前的选择。不指定此属性相当于指定defaultselectiontype.all。
defaultSelection - DefaultSelectionType.ALL,defaultselectiontype.range,或defaultselectiontype.selection。
null defaultselection
IllegalArgumentException
public JobAttributes.DestinationType getDestination()
public void setDestination(JobAttributes.DestinationType destination)
destination - desintationtype.file或desintationtype.printer。
IllegalArgumentException -如果目标是空的。
public JobAttributes.DialogType getDialog()
DialogType.COMMON,
DialogType.NATIVE,或
DialogType.NONE
public void setDialog(JobAttributes.DialogType dialog)
dialog - DialogType.COMMON,dialogtype.native,或dialogtype.none。
IllegalArgumentException如果对话框是空的。
public String getFileName()
null文件名
public void setFileName(String fileName)
fileName -可能的空文件名。
public int getFromPage()
getDefaultSelection方法的返回值是DefaultSelectionType.RANGE。应用程序应该尊重
getPageRanges返回值对该方法的返回值,如果可能的话。
public void setFromPage(int fromPage)
fromPage整数大于零、小于或等于零页大于或等于nullminpage和小于或等于nullmaxpage。
IllegalArgumentException如果上述一个或多个条件被违反。
public int getMaxPage()
public void setMaxPage(int maxPage)
Integer.MAX_VALUE。
maxPage -大于零的整数,大于或等于nullminpage
IllegalArgumentException如果上述一个或多个条件被违反
public int getMinPage()
public void setMinPage(int minPage)
1。
minPage整数大于零、小于或等于nullmaxpage。
IllegalArgumentException如果上述一个或多个条件被违反。
public JobAttributes.MultipleDocumentHandlingType getMultipleDocumentHandling()
public void setMultipleDocumentHandling(JobAttributes.MultipleDocumentHandlingType multipleDocumentHandling)
multipleDocumentHandling - multipledocumenthandlingtype.separate_documents_collated_copies或multipledocumenthandlingtype.separate_documents_uncollated_copies。
IllegalArgumentException -如果multipledocumenthandling是空的。
public void setMultipleDocumentHandlingToDefault()
public int[][] getPageRanges()
getDefaultSelection方法的返回值是DefaultSelectionType.RANGE。
public void setPageRanges(int[][] pageRanges)
pageRanges - 2元整数数组的数组。一个数组被解释为一个范围,包括所有的页面,包括在指定的页面之间。范围必须是在上升的秩序,必须不重叠。指定的页面数不能小于或大于nullmaxpage nullminpage。例如:(新国际[ ] [ ] {新国际[ ] { 1,3 },新国际[ ] { 5,5 },新国际[ ] { 15,19 } }),指定页1,2,3,5,15,16,17,18,和19。注:(新国际[ ] [ ] {新国际[ ] { 1,1 },新国际[ ] { 1,2 } }),是一个无效的设置页面范围因为两范围重叠。
IllegalArgumentException如果上述一个或多个条件被违反。
public String getPrinter()
public void setPrinter(String printer)
printer -可能的空打印机名称。
public JobAttributes.SidesType getSides()
public void setSides(JobAttributes.SidesType sides)
sides - sidestype.one_sided,sidestype.two_sided_long_edge,或sidestype.two_sided_short_edge。
IllegalArgumentException如果双方是空的。
public void setSidesToDefault()
public int getToPage()
getDefaultSelection方法的返回值是DefaultSelectionType.RANGE。应用程序应该尊重
getPageRanges返回值对该方法的返回值,如果可能的话。
public void setToPage(int toPage)
toPage -大于零的整数,大于或等于零页大于或等于nullminpage和小于或等于nullmaxpage。
IllegalArgumentException如果上述一个或多个条件被违反。
public boolean equals(Object obj)
两jobattributes相等当且仅当它们的属性都是平等的。当且仅当字段引用同一个唯一枚举对象时,枚举类型的属性是相等的。若集长度相等的一组页面范围是平等的,每个范围列举了相同的页面,和范围都是以相同的顺序。
equals 方法重写,继承类
Object
obj的平等将被检查的对象。
Object.hashCode(),
HashMap
public int hashCode()
hashCode 方法重写,继承类
Object
Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.