0N/A/*
2362N/A * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage sun.print;
0N/A
0N/Aimport javax.print.attribute.standard.MediaTray;
0N/Aimport javax.print.attribute.EnumSyntax;
0N/Aimport java.util.ArrayList;
0N/A
0N/A/**
0N/A * Class Win32MediaTray is a subclass of MediaTray which declares
0N/A * Windows media trays or bins not covered by MediaTray's standard values.
0N/A * It also implements driver-defined trays.
0N/A **/
0N/A
0N/Apublic class Win32MediaTray extends MediaTray {
0N/A
0N/A static final Win32MediaTray ENVELOPE_MANUAL = new Win32MediaTray(0,
0N/A 6); //DMBIN_ENVMANUAL
0N/A static final Win32MediaTray AUTO = new Win32MediaTray(1,
0N/A 7); //DMBIN_AUTO
0N/A static final Win32MediaTray TRACTOR = new Win32MediaTray(2,
0N/A 8); //DMBIN_TRACTOR
0N/A static final Win32MediaTray SMALL_FORMAT = new Win32MediaTray(3,
0N/A 9); //DMBIN_SMALLFMT
0N/A static final Win32MediaTray LARGE_FORMAT = new Win32MediaTray(4,
0N/A 10); //DMBIN_LARGEFMT
0N/A static final Win32MediaTray FORMSOURCE = new Win32MediaTray(5,
0N/A 15); //DMBIN_FORMSOURCE
0N/A
0N/A private static ArrayList winStringTable = new ArrayList();
0N/A private static ArrayList winEnumTable = new ArrayList();
0N/A public int winID;
0N/A
0N/A private Win32MediaTray(int value, int id) {
0N/A super (value);
0N/A winID = id;
0N/A }
0N/A
0N/A private synchronized static int nextValue(String name) {
0N/A winStringTable.add(name);
0N/A return (getTraySize()-1);
0N/A }
0N/A
0N/A protected Win32MediaTray(int id, String name) {
0N/A super (nextValue(name));
0N/A winID = id;
0N/A winEnumTable.add(this);
0N/A }
0N/A
0N/A private static final String[] myStringTable ={
0N/A "Manual-Envelope",
0N/A "Automatic-Feeder",
0N/A "Tractor-Feeder",
0N/A "Small-Format",
0N/A "Large-Format",
0N/A "Form-Source",
0N/A };
0N/A
0N/A private static final MediaTray[] myEnumValueTable = {
0N/A ENVELOPE_MANUAL,
0N/A AUTO,
0N/A TRACTOR,
0N/A SMALL_FORMAT,
0N/A LARGE_FORMAT,
0N/A FORMSOURCE,
0N/A };
0N/A
0N/A protected static int getTraySize() {
0N/A return (myStringTable.length+winStringTable.size());
0N/A }
0N/A
0N/A protected String[] getStringTable() {
0N/A ArrayList completeList = new ArrayList();
0N/A for (int i=0; i < myStringTable.length; i++) {
0N/A completeList.add(myStringTable[i]);
0N/A }
0N/A completeList.addAll(winStringTable);
0N/A String[] nameTable = new String[completeList.size()];
0N/A return (String[])completeList.toArray(nameTable);
0N/A }
0N/A
0N/A protected EnumSyntax[] getEnumValueTable() {
0N/A ArrayList completeList = new ArrayList();
0N/A for (int i=0; i < myEnumValueTable.length; i++) {
0N/A completeList.add(myEnumValueTable[i]);
0N/A }
0N/A completeList.addAll(winEnumTable);
0N/A MediaTray[] enumTable = new MediaTray[completeList.size()];
0N/A return (MediaTray[])completeList.toArray(enumTable);
0N/A }
0N/A}