Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/print/attribute/standard/Finishings.java
38918 views
/*1* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package javax.print.attribute.standard;2526import javax.print.attribute.Attribute;27import javax.print.attribute.EnumSyntax;28import javax.print.attribute.DocAttribute;29import javax.print.attribute.PrintRequestAttribute;30import javax.print.attribute.PrintJobAttribute;3132/**33* Class Finishings is a printing attribute class, an enumeration, that34* identifies whether the printer applies a finishing operation of some kind35* of binding to each copy of each printed document in the job. For multidoc36* print jobs (jobs with multiple documents), the37* {@link MultipleDocumentHandling38* MultipleDocumentHandling} attribute determines what constitutes a "copy"39* for purposes of finishing.40* <P>41* Standard Finishings values are:42* <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">43* <TR>44* <TD STYLE="WIDTH:10%">45* 46* </TD>47* <TD STYLE="WIDTH:27%">48* {@link #NONE NONE}49* </TD>50* <TD STYLE="WIDTH:27%">51* {@link #STAPLE STAPLE}52* </TD>53* <TD STYLE="WIDTH:36%">54* {@link #EDGE_STITCH EDGE_STITCH}55* </TD>56* </TR>57* <TR>58* <TD>59* 60* </TD>61* <TD>62* {@link #BIND BIND}63* </TD>64* <TD>65* {@link #SADDLE_STITCH SADDLE_STITCH}66* </TD>67* <TD>68* {@link #COVER COVER}69* </TD>70* <TD>71* 72* </TD>73* </TR>74* </TABLE>75* <P>76* The following Finishings values are more specific; they indicate a77* corner or an edge as if the document were a portrait document:78* <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% SUMMARY="layout">79* <TR>80* <TD STYLE="WIDTH:10%">81* 82* </TD>83* <TD STYLE="WIDTH:27%">84* {@link #STAPLE_TOP_LEFT STAPLE_TOP_LEFT}85* </TD>86* <TD STYLE="WIDTH:27%">87* {@link #EDGE_STITCH_LEFT EDGE_STITCH_LEFT}88* </TD>89* <TD STYLE="WIDTH:27%">90* {@link #STAPLE_DUAL_LEFT STAPLE_DUAL_LEFT}91* </TD>92* <TD STYLE="WIDTH:9%">93* 94* </TD>95* </TR>96* <TR>97* <TD STYLE="WIDTH:10%">98* 99* </TD>100* <TD STYLE="WIDTH:27%">101* {@link #STAPLE_BOTTOM_LEFT STAPLE_BOTTOM_LEFT}102* </TD>103* <TD STYLE="WIDTH:27%">104* {@link #EDGE_STITCH_TOP EDGE_STITCH_TOP}105* </TD>106* <TD STYLE="WIDTH:27%">107* {@link #STAPLE_DUAL_TOP STAPLE_DUAL_TOP}108* </TD>109* <TD STYLE="WIDTH:9%">110* 111* </TD>112* </TR>113* <TR>114* <TD STYLE="WIDTH:10%">115* 116* </TD>117* <TD STYLE="WIDTH:27%">118* {@link #STAPLE_TOP_RIGHT STAPLE_TOP_RIGHT}119* </TD>120* <TD STYLE="WIDTH:27%">121* {@link #EDGE_STITCH_RIGHT EDGE_STITCH_RIGHT}122* </TD>123* <TD STYLE="WIDTH:27%">124* {@link #STAPLE_DUAL_RIGHT STAPLE_DUAL_RIGHT}125* </TD>126* <TD STYLE="WIDTH:9%">127* 128* </TD>129* </TR>130* <TR>131* <TD STYLE="WIDTH:10%">132* 133* </TD>134* <TD STYLE="WIDTH:27%">135* {@link #STAPLE_BOTTOM_RIGHT STAPLE_BOTTOM_RIGHT}136* </TD>137* <TD STYLE="WIDTH:27%">138* {@link #EDGE_STITCH_BOTTOM EDGE_STITCH_BOTTOM}139* </TD>140* <TD STYLE="WIDTH:27%">141* {@link #STAPLE_DUAL_BOTTOM STAPLE_DUAL_BOTTOM}142* </TD>143* <TD STYLE="WIDTH:9%">144* 145* </TD>146* </TR>147* </TABLE>148* <P>149* The STAPLE_<I>XXX</I> values are specified with respect to the150* document as if the document were a portrait document. If the document is151* actually a landscape or a reverse-landscape document, the client supplies the152* appropriate transformed value. For example, to position a staple in the upper153* left hand corner of a landscape document when held for reading, the client154* supplies the STAPLE_BOTTOM_LEFT value (since landscape is155* defined as a +90 degree rotation from portrait, i.e., anti-clockwise). On the156* other hand, to position a staple in the upper left hand corner of a157* reverse-landscape document when held for reading, the client supplies the158* STAPLE_TOP_RIGHT value (since reverse-landscape is defined as a159* -90 degree rotation from portrait, i.e., clockwise).160* <P>161* The angle (vertical, horizontal, angled) of each staple with respect to the162* document depends on the implementation which may in turn depend on the value163* of the attribute.164* <P>165* The effect of a Finishings attribute on a multidoc print job (a job166* with multiple documents) depends on whether all the docs have the same167* binding specified or whether different docs have different bindings168* specified, and on the (perhaps defaulted) value of the {@link169* MultipleDocumentHandling MultipleDocumentHandling} attribute.170* <UL>171* <LI>172* If all the docs have the same binding specified, then any value of {@link173* MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the174* printer's processing depends on the {@link MultipleDocumentHandling175* MultipleDocumentHandling} value:176* <UL>177* <LI>178* SINGLE_DOCUMENT -- All the input docs will be bound together as one output179* document with the specified binding.180* <P>181* <LI>182* SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be bound together as one183* output document with the specified binding, and the first impression of each184* input doc will always start on a new media sheet.185* <P>186* <LI>187* SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound188* separately with the specified binding.189* <P>190* <LI>191* SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately192* with the specified binding.193* </UL>194* <P>195* <LI>196* If different docs have different bindings specified, then only two values of197* {@link MultipleDocumentHandling MultipleDocumentHandling} make sense, and the198* printer reports an error when the job is submitted if any other value is199* specified:200* <UL>201* <LI>202* SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound203* separately with its own specified binding.204* <P>205* <LI>206* SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately207* with its own specified binding.208* </UL>209* </UL>210* <P>211* <B>IPP Compatibility:</B> Class Finishings encapsulates some of the212* IPP enum values that can be included in an IPP "finishings" attribute, which213* is a set of enums. The category name returned by214* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's215* integer value is the IPP enum value. The <code>toString()</code> method216* returns the IPP string representation of the attribute value.217* In IPP Finishings is a multi-value attribute, this API currently allows218* only one binding to be specified.219*220* @author Alan Kaminsky221*/222public class Finishings extends EnumSyntax223implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {224225private static final long serialVersionUID = -627840419548391754L;226227/**228* Perform no binding.229*/230public static final Finishings NONE = new Finishings(3);231232/**233* Bind the document(s) with one or more staples. The exact number and234* placement of the staples is site-defined.235*/236public static final Finishings STAPLE = new Finishings(4);237238/**239* This value is specified when it is desired to select a non-printed (or240* pre-printed) cover for the document. This does not supplant the241* specification of a printed cover (on cover stock medium) by the242* document itself.243*/244public static final Finishings COVER = new Finishings(6);245246/**247* This value indicates that a binding is to be applied to the document;248* the type and placement of the binding is site-defined.249*/250public static final Finishings BIND = new Finishings(7);251252/**253* Bind the document(s) with one or more staples (wire stitches) along the254* middle fold. The exact number and placement of the staples and the255* middle fold is implementation- and/or site-defined.256*/257public static final Finishings SADDLE_STITCH =258new Finishings(8);259260/**261* Bind the document(s) with one or more staples (wire stitches) along one262* edge. The exact number and placement of the staples is implementation-263* and/or site- defined.264*/265public static final Finishings EDGE_STITCH =266new Finishings(9);267268/**269* Bind the document(s) with one or more staples in the top left corner.270*/271public static final Finishings STAPLE_TOP_LEFT =272new Finishings(20);273274/**275* Bind the document(s) with one or more staples in the bottom left276* corner.277*/278public static final Finishings STAPLE_BOTTOM_LEFT =279new Finishings(21);280281/**282* Bind the document(s) with one or more staples in the top right corner.283*/284public static final Finishings STAPLE_TOP_RIGHT =285new Finishings(22);286287/**288* Bind the document(s) with one or more staples in the bottom right289* corner.290*/291public static final Finishings STAPLE_BOTTOM_RIGHT =292new Finishings(23);293294/**295* Bind the document(s) with one or more staples (wire stitches) along the296* left edge. The exact number and placement of the staples is297* implementation- and/or site-defined.298*/299public static final Finishings EDGE_STITCH_LEFT =300new Finishings(24);301302/**303* Bind the document(s) with one or more staples (wire stitches) along the304* top edge. The exact number and placement of the staples is305* implementation- and/or site-defined.306*/307public static final Finishings EDGE_STITCH_TOP =308new Finishings(25);309310/**311* Bind the document(s) with one or more staples (wire stitches) along the312* right edge. The exact number and placement of the staples is313* implementation- and/or site-defined.314*/315public static final Finishings EDGE_STITCH_RIGHT =316new Finishings(26);317318/**319* Bind the document(s) with one or more staples (wire stitches) along the320* bottom edge. The exact number and placement of the staples is321* implementation- and/or site-defined.322*/323public static final Finishings EDGE_STITCH_BOTTOM =324new Finishings(27);325326/**327* Bind the document(s) with two staples (wire stitches) along the left328* edge assuming a portrait document (see above).329*/330public static final Finishings STAPLE_DUAL_LEFT =331new Finishings(28);332333/**334* Bind the document(s) with two staples (wire stitches) along the top335* edge assuming a portrait document (see above).336*/337public static final Finishings STAPLE_DUAL_TOP =338new Finishings(29);339340/**341* Bind the document(s) with two staples (wire stitches) along the right342* edge assuming a portrait document (see above).343*/344public static final Finishings STAPLE_DUAL_RIGHT =345new Finishings(30);346347/**348* Bind the document(s) with two staples (wire stitches) along the bottom349* edge assuming a portrait document (see above).350*/351public static final Finishings STAPLE_DUAL_BOTTOM =352new Finishings(31);353354/**355* Construct a new finishings binding enumeration value with the given356* integer value.357*358* @param value Integer value.359*/360protected Finishings(int value) {361super(value);362}363364private static final String[] myStringTable =365{"none",366"staple",367null,368"cover",369"bind",370"saddle-stitch",371"edge-stitch",372null, // The next ten enum values are reserved.373null,374null,375null,376null,377null,378null,379null,380null,381null,382"staple-top-left",383"staple-bottom-left",384"staple-top-right",385"staple-bottom-right",386"edge-stitch-left",387"edge-stitch-top",388"edge-stitch-right",389"edge-stitch-bottom",390"staple-dual-left",391"staple-dual-top",392"staple-dual-right",393"staple-dual-bottom"394};395396private static final Finishings[] myEnumValueTable =397{NONE,398STAPLE,399null,400COVER,401BIND,402SADDLE_STITCH,403EDGE_STITCH,404null, // The next ten enum values are reserved.405null,406null,407null,408null,409null,410null,411null,412null,413null,414STAPLE_TOP_LEFT,415STAPLE_BOTTOM_LEFT,416STAPLE_TOP_RIGHT,417STAPLE_BOTTOM_RIGHT,418EDGE_STITCH_LEFT,419EDGE_STITCH_TOP,420EDGE_STITCH_RIGHT,421EDGE_STITCH_BOTTOM,422STAPLE_DUAL_LEFT,423STAPLE_DUAL_TOP,424STAPLE_DUAL_RIGHT,425STAPLE_DUAL_BOTTOM426};427428/**429* Returns the string table for class Finishings.430*/431protected String[] getStringTable() {432return (String[])myStringTable.clone();433}434435/**436* Returns the enumeration value table for class Finishings.437*/438protected EnumSyntax[] getEnumValueTable() {439return (EnumSyntax[])myEnumValueTable.clone();440}441442/**443* Returns the lowest integer value used by class Finishings.444*/445protected int getOffset() {446return 3;447}448449/**450* Get the printing attribute class which is to be used as the "category"451* for this printing attribute value.452* <P>453* For class Finishings and any vendor-defined subclasses, the454* category is class Finishings itself.455*456* @return Printing attribute class (category), an instance of class457* {@link java.lang.Class java.lang.Class}.458*/459public final Class<? extends Attribute> getCategory() {460return Finishings.class;461}462463/**464* Get the name of the category of which this attribute value is an465* instance.466* <P>467* For class Finishings and any vendor-defined subclasses, the468* category name is <CODE>"finishings"</CODE>.469*470* @return Attribute category name.471*/472public final String getName() {473return "finishings";474}475476}477478479