author | avstepan |
Mon, 11 Jan 2016 17:51:54 +0300 | |
changeset 35667 | ed476aba94de |
parent 25859 | 3317bb8137f4 |
child 47196 | a3211bb4daff |
permissions | -rw-r--r-- |
2 | 1 |
/* |
25770
d132697706ea
8037511: Tidy warnings cleanup for java.awt - 2d part
avstepan
parents:
22260
diff
changeset
|
2 |
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
package javax.print.attribute.standard; |
|
26 |
||
27 |
import javax.print.attribute.Attribute; |
|
28 |
import javax.print.attribute.ResolutionSyntax; |
|
29 |
import javax.print.attribute.DocAttribute; |
|
30 |
import javax.print.attribute.PrintRequestAttribute; |
|
31 |
import javax.print.attribute.PrintJobAttribute; |
|
32 |
||
33 |
/** |
|
34 |
* Class PrinterResolution is a printing attribute class that specifies an |
|
35 |
* exact resolution supported by a printer or to be used for a print job. |
|
36 |
* This attribute assumes that printers have a small set of device resolutions |
|
37 |
* at which they can operate rather than a continuum. |
|
38 |
* <p> |
|
39 |
* PrinterResolution is used in multiple ways: |
|
40 |
* <OL TYPE=1> |
|
41 |
* <LI> |
|
42 |
* When a client searches looking for a printer that supports the client's |
|
43 |
* desired resolution exactly (no more, no less), the client specifies |
|
44 |
* an instance of class PrinterResolution indicating the exact resolution the |
|
45 |
* client wants. Only printers supporting that exact resolution will match the |
|
46 |
* search. |
|
22260
c9185e010e03
8031082: Fix non-missing doclint problems in client libraries
darcy
parents:
19166
diff
changeset
|
47 |
* |
2 | 48 |
* <LI> |
49 |
* When a client needs to print a job using the client's desired resolution |
|
50 |
* exactly (no more, no less), the client specifies an instance of class |
|
51 |
* PrinterResolution as an attribute of the Print Job. This will fail if the |
|
52 |
* Print Job doesn't support that exact resolution, and Fidelity is set to |
|
53 |
* true. |
|
54 |
* </OL> |
|
55 |
* If a client wants to locate a printer supporting a resolution |
|
56 |
* greater than some required minimum, then it may be necessary to exclude |
|
57 |
* this attribute from a lookup request and to directly query the set of |
|
58 |
* supported resolutions, and specify the one that most closely meets |
|
59 |
* the client's requirements. |
|
60 |
* In some cases this may be more simply achieved by specifying a |
|
61 |
* PrintQuality attribute which often controls resolution. |
|
62 |
* <P> |
|
63 |
* <B>IPP Compatibility:</B> The information needed to construct an IPP |
|
35667 | 64 |
* {@code "printer-resolution"} attribute can be obtained by calling |
2 | 65 |
* methods on the PrinterResolution object. The category name returned by |
35667 | 66 |
* {@code getName()} gives the IPP attribute name. |
2 | 67 |
* |
68 |
* @author David Mendenhall |
|
69 |
* @author Alan Kaminsky |
|
70 |
*/ |
|
71 |
public final class PrinterResolution extends ResolutionSyntax |
|
72 |
implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { |
|
73 |
||
74 |
private static final long serialVersionUID = 13090306561090558L; |
|
75 |
||
76 |
/** |
|
77 |
* Construct a new printer resolution attribute from the given items. |
|
78 |
* |
|
79 |
* @param crossFeedResolution |
|
80 |
* Cross feed direction resolution. |
|
81 |
* @param feedResolution |
|
82 |
* Feed direction resolution. |
|
83 |
* @param units |
|
35667 | 84 |
* Unit conversion factor, e.g. {@code ResolutionSyntax.DPI} |
85 |
* or {@code ResolutionSyntax.DPCM}. |
|
2 | 86 |
* |
87 |
* @exception IllegalArgumentException |
|
19166 | 88 |
* (unchecked exception) Thrown if {@code crossFeedResolution < 1} or |
89 |
* {@code feedResolution < 1} or {@code units < 1}. |
|
2 | 90 |
*/ |
91 |
public PrinterResolution(int crossFeedResolution, int feedResolution, |
|
92 |
int units) { |
|
93 |
super (crossFeedResolution, feedResolution, units); |
|
94 |
} |
|
95 |
||
96 |
/** |
|
97 |
* Returns whether this printer resolution attribute is equivalent to the |
|
98 |
* passed in object. To be equivalent, all of the following conditions |
|
99 |
* must be true: |
|
100 |
* <OL TYPE=1> |
|
101 |
* <LI> |
|
35667 | 102 |
* {@code object} is not null. |
2 | 103 |
* <LI> |
35667 | 104 |
* {@code object} is an instance of class PrinterResolution. |
2 | 105 |
* <LI> |
106 |
* This attribute's cross feed direction resolution is equal to |
|
35667 | 107 |
* {@code object}'s cross feed direction resolution. |
2 | 108 |
* <LI> |
109 |
* This attribute's feed direction resolution is equal to |
|
35667 | 110 |
* {@code object}'s feed direction resolution. |
2 | 111 |
* </OL> |
112 |
* |
|
113 |
* @param object Object to compare to. |
|
114 |
* |
|
35667 | 115 |
* @return True if {@code object} is equivalent to this printer |
2 | 116 |
* resolution attribute, false otherwise. |
117 |
*/ |
|
118 |
public boolean equals(Object object) { |
|
119 |
return (super.equals (object) && |
|
120 |
object instanceof PrinterResolution); |
|
121 |
} |
|
122 |
||
123 |
/** |
|
124 |
* Get the printing attribute class which is to be used as the "category" |
|
125 |
* for this printing attribute value. |
|
126 |
* <P> |
|
127 |
* For class PrinterResolution, the category is class PrinterResolution itself. |
|
128 |
* |
|
129 |
* @return Printing attribute class (category), an instance of class |
|
130 |
* {@link java.lang.Class java.lang.Class}. |
|
131 |
*/ |
|
132 |
public final Class<? extends Attribute> getCategory() { |
|
133 |
return PrinterResolution.class; |
|
134 |
} |
|
135 |
||
136 |
/** |
|
137 |
* Get the name of the category of which this attribute value is an |
|
138 |
* instance. |
|
139 |
* <P> |
|
140 |
* For class PrinterResolution, the |
|
35667 | 141 |
* category name is {@code "printer-resolution"}. |
2 | 142 |
* |
143 |
* @return Attribute category name. |
|
144 |
*/ |
|
145 |
public final String getName() { |
|
146 |
return "printer-resolution"; |
|
147 |
} |
|
148 |
||
149 |
} |