1378 lines · 50.8 KB · Java
RawDownload
/* * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.  Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.awt; import java.util.Locale; /** * A set of attributes which control the output of a printed page. * <p> * Instances of this class control the color state, paper size (media type), * orientation, logical origin, print quality, and resolution of every * page 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. * <p> * 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 color state to * monochrome, use the following code: * <pre> * import java.awt.PageAttributes; * * public class MonochromeExample { *     public void setMonochrome(PageAttributes pageAttributes) { *         pageAttributes.setColor(PageAttributes.ColorType.MONOCHROME); *     } * } * </pre> * <p> * Every IPP attribute which supports an <i>attributeName</i>-default value * has a corresponding <code>set<i>attributeName</i>ToDefault</code> method. * Default value fields are not provided. * * @author      David Mendenhall * @since 1.3 */public final class PageAttributes implements Cloneable {    /**     * A type-safe enumeration of possible color states.     * @since 1.3     */    public static final class ColorType extends AttributeValue {        private static final int I_COLOR = 0;        private static final int I_MONOCHROME = 1;         private static final String NAMES[] = {            "color", "monochrome"        };         /**         * The ColorType instance to use for specifying color printing.         */        public static final ColorType COLOR = new ColorType(I_COLOR);        /**         * The ColorType instance to use for specifying monochrome printing.         */        public static final ColorType MONOCHROME = new ColorType(I_MONOCHROME);         private ColorType(int type) {            super(type, NAMES);        }    }     /**     * A type-safe enumeration of possible paper sizes. These sizes are in     * compliance with IPP 1.1.     * @since 1.3     */    public static final class MediaType extends AttributeValue {        private static final int I_ISO_4A0 = 0;        private static final int I_ISO_2A0 = 1;        private static final int I_ISO_A0 = 2;        private static final int I_ISO_A1 = 3;        private static final int I_ISO_A2 = 4;        private static final int I_ISO_A3 = 5;        private static final int I_ISO_A4 = 6;        private static final int I_ISO_A5 = 7;        private static final int I_ISO_A6 = 8;        private static final int I_ISO_A7 = 9;        private static final int I_ISO_A8 = 10;        private static final int I_ISO_A9 = 11;        private static final int I_ISO_A10 = 12;        private static final int I_ISO_B0 = 13;        private static final int I_ISO_B1 = 14;        private static final int I_ISO_B2 = 15;        private static final int I_ISO_B3 = 16;        private static final int I_ISO_B4 = 17;        private static final int I_ISO_B5 = 18;        private static final int I_ISO_B6 = 19;        private static final int I_ISO_B7 = 20;        private static final int I_ISO_B8 = 21;        private static final int I_ISO_B9 = 22;        private static final int I_ISO_B10 = 23;        private static final int I_JIS_B0 = 24;        private static final int I_JIS_B1 = 25;        private static final int I_JIS_B2 = 26;        private static final int I_JIS_B3 = 27;        private static final int I_JIS_B4 = 28;        private static final int I_JIS_B5 = 29;        private static final int I_JIS_B6 = 30;        private static final int I_JIS_B7 = 31;        private static final int I_JIS_B8 = 32;        private static final int I_JIS_B9 = 33;        private static final int I_JIS_B10 = 34;        private static final int I_ISO_C0 = 35;        private static final int I_ISO_C1 = 36;        private static final int I_ISO_C2 = 37;        private static final int I_ISO_C3 = 38;        private static final int I_ISO_C4 = 39;        private static final int I_ISO_C5 = 40;        private static final int I_ISO_C6 = 41;        private static final int I_ISO_C7 = 42;        private static final int I_ISO_C8 = 43;        private static final int I_ISO_C9 = 44;        private static final int I_ISO_C10 = 45;        private static final int I_ISO_DESIGNATED_LONG = 46;        private static final int I_EXECUTIVE = 47;        private static final int I_FOLIO = 48;        private static final int I_INVOICE = 49;        private static final int I_LEDGER = 50;        private static final int I_NA_LETTER = 51;        private static final int I_NA_LEGAL = 52;        private static final int I_QUARTO = 53;        private static final int I_A = 54;        private static final int I_B = 55;        private static final int I_C = 56;        private static final int I_D = 57;        private static final int I_E = 58;        private static final int I_NA_10X15_ENVELOPE = 59;        private static final int I_NA_10X14_ENVELOPE = 60;        private static final int I_NA_10X13_ENVELOPE = 61;        private static final int I_NA_9X12_ENVELOPE = 62;        private static final int I_NA_9X11_ENVELOPE = 63;        private static final int I_NA_7X9_ENVELOPE = 64;        private static final int I_NA_6X9_ENVELOPE = 65;        private static final int I_NA_NUMBER_9_ENVELOPE = 66;        private static final int I_NA_NUMBER_10_ENVELOPE = 67;        private static final int I_NA_NUMBER_11_ENVELOPE = 68;        private static final int I_NA_NUMBER_12_ENVELOPE = 69;        private static final int I_NA_NUMBER_14_ENVELOPE = 70;        private static final int I_INVITE_ENVELOPE = 71;        private static final int I_ITALY_ENVELOPE = 72;        private static final int I_MONARCH_ENVELOPE = 73;        private static final int I_PERSONAL_ENVELOPE = 74;         private static final String NAMES[] = {            "iso-4a0", "iso-2a0", "iso-a0", "iso-a1", "iso-a2", "iso-a3",            "iso-a4", "iso-a5", "iso-a6", "iso-a7", "iso-a8", "iso-a9",            "iso-a10", "iso-b0", "iso-b1", "iso-b2", "iso-b3", "iso-b4",            "iso-b5", "iso-b6", "iso-b7", "iso-b8", "iso-b9", "iso-b10",            "jis-b0", "jis-b1", "jis-b2", "jis-b3", "jis-b4", "jis-b5",            "jis-b6", "jis-b7", "jis-b8", "jis-b9", "jis-b10", "iso-c0",            "iso-c1", "iso-c2", "iso-c3", "iso-c4", "iso-c5", "iso-c6",            "iso-c7", "iso-c8", "iso-c9", "iso-c10", "iso-designated-long",            "executive", "folio", "invoice", "ledger", "na-letter", "na-legal",            "quarto", "a", "b", "c", "d", "e", "na-10x15-envelope",            "na-10x14-envelope", "na-10x13-envelope", "na-9x12-envelope",            "na-9x11-envelope", "na-7x9-envelope", "na-6x9-envelope",            "na-number-9-envelope", "na-number-10-envelope",            "na-number-11-envelope", "na-number-12-envelope",            "na-number-14-envelope", "invite-envelope", "italy-envelope",            "monarch-envelope", "personal-envelope"        };         /**         * The MediaType instance for ISO/DIN & JIS 4A0, 1682 x 2378 mm.         */        public static final MediaType ISO_4A0 = new MediaType(I_ISO_4A0);        /**         * The MediaType instance for ISO/DIN & JIS 2A0, 1189 x 1682 mm.         */        public static final MediaType ISO_2A0 = new MediaType(I_ISO_2A0);        /**         * The MediaType instance for ISO/DIN & JIS A0, 841 x 1189 mm.         */        public static final MediaType ISO_A0 = new MediaType(I_ISO_A0);        /**         * The MediaType instance for ISO/DIN & JIS A1, 594 x 841 mm.         */        public static final MediaType ISO_A1 = new MediaType(I_ISO_A1);        /**         * The MediaType instance for ISO/DIN & JIS A2, 420 x 594 mm.         */        public static final MediaType ISO_A2 = new MediaType(I_ISO_A2);        /**         * The MediaType instance for ISO/DIN & JIS A3, 297 x 420 mm.         */        public static final MediaType ISO_A3 = new MediaType(I_ISO_A3);        /**         * The MediaType instance for ISO/DIN & JIS A4, 210 x 297 mm.         */        public static final MediaType ISO_A4 = new MediaType(I_ISO_A4);        /**         * The MediaType instance for ISO/DIN & JIS A5, 148 x 210 mm.         */        public static final MediaType ISO_A5 = new MediaType(I_ISO_A5);        /**         * The MediaType instance for ISO/DIN & JIS A6, 105 x 148 mm.         */        public static final MediaType ISO_A6 = new MediaType(I_ISO_A6);        /**         * The MediaType instance for ISO/DIN & JIS A7, 74 x 105 mm.         */        public static final MediaType ISO_A7 = new MediaType(I_ISO_A7);        /**         * The MediaType instance for ISO/DIN & JIS A8, 52 x 74 mm.         */        public static final MediaType ISO_A8 = new MediaType(I_ISO_A8);        /**         * The MediaType instance for ISO/DIN & JIS A9, 37 x 52 mm.         */        public static final MediaType ISO_A9 = new MediaType(I_ISO_A9);        /**         * The MediaType instance for ISO/DIN & JIS A10, 26 x 37 mm.         */        public static final MediaType ISO_A10 = new MediaType(I_ISO_A10);        /**         * The MediaType instance for ISO/DIN B0, 1000 x 1414 mm.         */        public static final MediaType ISO_B0 = new MediaType(I_ISO_B0);        /**         * The MediaType instance for ISO/DIN B1, 707 x 1000 mm.         */        public static final MediaType ISO_B1 = new MediaType(I_ISO_B1);        /**         * The MediaType instance for ISO/DIN B2, 500 x 707 mm.         */        public static final MediaType ISO_B2 = new MediaType(I_ISO_B2);        /**         * The MediaType instance for ISO/DIN B3, 353 x 500 mm.         */        public static final MediaType ISO_B3 = new MediaType(I_ISO_B3);        /**         * The MediaType instance for ISO/DIN B4, 250 x 353 mm.         */        public static final MediaType ISO_B4 = new MediaType(I_ISO_B4);        /**         * The MediaType instance for ISO/DIN B5, 176 x 250 mm.         */        public static final MediaType ISO_B5 = new MediaType(I_ISO_B5);        /**         * The MediaType instance for ISO/DIN B6, 125 x 176 mm.         */        public static final MediaType ISO_B6 = new MediaType(I_ISO_B6);        /**         * The MediaType instance for ISO/DIN B7, 88 x 125 mm.         */        public static final MediaType ISO_B7 = new MediaType(I_ISO_B7);        /**         * The MediaType instance for ISO/DIN B8, 62 x 88 mm.         */        public static final MediaType ISO_B8 = new MediaType(I_ISO_B8);        /**         * The MediaType instance for ISO/DIN B9, 44 x 62 mm.         */        public static final MediaType ISO_B9 = new MediaType(I_ISO_B9);        /**         * The MediaType instance for ISO/DIN B10, 31 x 44 mm.         */        public static final MediaType ISO_B10 = new MediaType(I_ISO_B10);        /**         * The MediaType instance for JIS B0, 1030 x 1456 mm.         */        public static final MediaType JIS_B0 = new MediaType(I_JIS_B0);        /**         * The MediaType instance for JIS B1, 728 x 1030 mm.         */        public static final MediaType JIS_B1 = new MediaType(I_JIS_B1);        /**         * The MediaType instance for JIS B2, 515 x 728 mm.         */        public static final MediaType JIS_B2 = new MediaType(I_JIS_B2);        /**         * The MediaType instance for JIS B3, 364 x 515 mm.         */        public static final MediaType JIS_B3 = new MediaType(I_JIS_B3);        /**         * The MediaType instance for JIS B4, 257 x 364 mm.         */        public static final MediaType JIS_B4 = new MediaType(I_JIS_B4);        /**         * The MediaType instance for JIS B5, 182 x 257 mm.         */        public static final MediaType JIS_B5 = new MediaType(I_JIS_B5);        /**         * The MediaType instance for JIS B6, 128 x 182 mm.         */        public static final MediaType JIS_B6 = new MediaType(I_JIS_B6);        /**         * The MediaType instance for JIS B7, 91 x 128 mm.         */        public static final MediaType JIS_B7 = new MediaType(I_JIS_B7);        /**         * The MediaType instance for JIS B8, 64 x 91 mm.         */        public static final MediaType JIS_B8 = new MediaType(I_JIS_B8);        /**         * The MediaType instance for JIS B9, 45 x 64 mm.         */        public static final MediaType JIS_B9 = new MediaType(I_JIS_B9);        /**         * The MediaType instance for JIS B10, 32 x 45 mm.         */        public static final MediaType JIS_B10 = new MediaType(I_JIS_B10);        /**         * The MediaType instance for ISO/DIN C0, 917 x 1297 mm.         */        public static final MediaType ISO_C0 = new MediaType(I_ISO_C0);        /**         * The MediaType instance for ISO/DIN C1, 648 x 917 mm.         */        public static final MediaType ISO_C1 = new MediaType(I_ISO_C1);        /**         * The MediaType instance for ISO/DIN C2, 458 x 648 mm.         */        public static final MediaType ISO_C2 = new MediaType(I_ISO_C2);        /**         * The MediaType instance for ISO/DIN C3, 324 x 458 mm.         */        public static final MediaType ISO_C3 = new MediaType(I_ISO_C3);        /**         * The MediaType instance for ISO/DIN C4, 229 x 324 mm.         */        public static final MediaType ISO_C4 = new MediaType(I_ISO_C4);        /**         * The MediaType instance for ISO/DIN C5, 162 x 229 mm.         */        public static final MediaType ISO_C5 = new MediaType(I_ISO_C5);        /**         * The MediaType instance for ISO/DIN C6, 114 x 162 mm.         */        public static final MediaType ISO_C6 = new MediaType(I_ISO_C6);        /**         * The MediaType instance for ISO/DIN C7, 81 x 114 mm.         */        public static final MediaType ISO_C7 = new MediaType(I_ISO_C7);        /**         * The MediaType instance for ISO/DIN C8, 57 x 81 mm.         */        public static final MediaType ISO_C8 = new MediaType(I_ISO_C8);        /**         * The MediaType instance for ISO/DIN C9, 40 x 57 mm.         */        public static final MediaType ISO_C9 = new MediaType(I_ISO_C9);        /**         * The MediaType instance for ISO/DIN C10, 28 x 40 mm.         */        public static final MediaType ISO_C10 = new MediaType(I_ISO_C10);        /**         * The MediaType instance for ISO Designated Long, 110 x 220 mm.         */        public static final MediaType ISO_DESIGNATED_LONG =            new MediaType(I_ISO_DESIGNATED_LONG);        /**         * The MediaType instance for Executive, 7 1/4 x 10 1/2 in.         */        public static final MediaType EXECUTIVE = new MediaType(I_EXECUTIVE);        /**         * The MediaType instance for Folio, 8 1/2 x 13 in.         */        public static final MediaType FOLIO = new MediaType(I_FOLIO);        /**         * The MediaType instance for Invoice, 5 1/2 x 8 1/2 in.         */        public static final MediaType INVOICE = new MediaType(I_INVOICE);        /**         * The MediaType instance for Ledger, 11 x 17 in.         */        public static final MediaType LEDGER = new MediaType(I_LEDGER);        /**         * The MediaType instance for North American Letter, 8 1/2 x 11 in.         */        public static final MediaType NA_LETTER = new MediaType(I_NA_LETTER);        /**         * The MediaType instance for North American Legal, 8 1/2 x 14 in.         */        public static final MediaType NA_LEGAL = new MediaType(I_NA_LEGAL);        /**         * The MediaType instance for Quarto, 215 x 275 mm.         */        public static final MediaType QUARTO = new MediaType(I_QUARTO);        /**         * The MediaType instance for Engineering A, 8 1/2 x 11 in.         */        public static final MediaType A = new MediaType(I_A);        /**         * The MediaType instance for Engineering B, 11 x 17 in.         */        public static final MediaType B = new MediaType(I_B);        /**         * The MediaType instance for Engineering C, 17 x 22 in.         */        public static final MediaType C = new MediaType(I_C);        /**         * The MediaType instance for Engineering D, 22 x 34 in.         */        public static final MediaType D = new MediaType(I_D);        /**         * The MediaType instance for Engineering E, 34 x 44 in.         */        public static final MediaType E = new MediaType(I_E);        /**         * The MediaType instance for North American 10 x 15 in.         */        public static final MediaType NA_10X15_ENVELOPE =            new MediaType(I_NA_10X15_ENVELOPE);        /**         * The MediaType instance for North American 10 x 14 in.         */        public static final MediaType NA_10X14_ENVELOPE =            new MediaType(I_NA_10X14_ENVELOPE);        /**         * The MediaType instance for North American 10 x 13 in.         */        public static final MediaType NA_10X13_ENVELOPE =            new MediaType(I_NA_10X13_ENVELOPE);        /**         * The MediaType instance for North American 9 x 12 in.         */        public static final MediaType NA_9X12_ENVELOPE =            new MediaType(I_NA_9X12_ENVELOPE);        /**         * The MediaType instance for North American 9 x 11 in.         */        public static final MediaType NA_9X11_ENVELOPE =            new MediaType(I_NA_9X11_ENVELOPE);        /**         * The MediaType instance for North American 7 x 9 in.         */        public static final MediaType NA_7X9_ENVELOPE =            new MediaType(I_NA_7X9_ENVELOPE);        /**         * The MediaType instance for North American 6 x 9 in.         */        public static final MediaType NA_6X9_ENVELOPE =            new MediaType(I_NA_6X9_ENVELOPE);        /**         * The MediaType instance for North American #9 Business Envelope,         * 3 7/8 x 8 7/8 in.         */        public static final MediaType NA_NUMBER_9_ENVELOPE =            new MediaType(I_NA_NUMBER_9_ENVELOPE);        /**         * The MediaType instance for North American #10 Business Envelope,         * 4 1/8 x 9 1/2 in.         */        public static final MediaType NA_NUMBER_10_ENVELOPE =            new MediaType(I_NA_NUMBER_10_ENVELOPE);        /**         * The MediaType instance for North American #11 Business Envelope,         * 4 1/2 x 10 3/8 in.         */        public static final MediaType NA_NUMBER_11_ENVELOPE =            new MediaType(I_NA_NUMBER_11_ENVELOPE);        /**         * The MediaType instance for North American #12 Business Envelope,         * 4 3/4 x 11 in.         */        public static final MediaType NA_NUMBER_12_ENVELOPE =            new MediaType(I_NA_NUMBER_12_ENVELOPE);        /**         * The MediaType instance for North American #14 Business Envelope,         * 5 x 11 1/2 in.         */        public static final MediaType NA_NUMBER_14_ENVELOPE =            new MediaType(I_NA_NUMBER_14_ENVELOPE);        /**         * The MediaType instance for Invitation Envelope, 220 x 220 mm.         */        public static final MediaType INVITE_ENVELOPE =            new MediaType(I_INVITE_ENVELOPE);        /**         * The MediaType instance for Italy Envelope, 110 x 230 mm.         */        public static final MediaType ITALY_ENVELOPE =            new MediaType(I_ITALY_ENVELOPE);

Lines 1–500 of 1378.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t