Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/classes/sun/print/Win32MediaTray.java
32287 views
/*1* Copyright (c) 2002, 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*/2425package sun.print;2627import javax.print.attribute.standard.MediaTray;28import javax.print.attribute.EnumSyntax;29import java.util.ArrayList;3031/**32* Class Win32MediaTray is a subclass of MediaTray which declares33* Windows media trays or bins not covered by MediaTray's standard values.34* It also implements driver-defined trays.35**/3637public class Win32MediaTray extends MediaTray {3839static final Win32MediaTray ENVELOPE_MANUAL = new Win32MediaTray(0,406); //DMBIN_ENVMANUAL41static final Win32MediaTray AUTO = new Win32MediaTray(1,427); //DMBIN_AUTO43static final Win32MediaTray TRACTOR = new Win32MediaTray(2,448); //DMBIN_TRACTOR45static final Win32MediaTray SMALL_FORMAT = new Win32MediaTray(3,469); //DMBIN_SMALLFMT47static final Win32MediaTray LARGE_FORMAT = new Win32MediaTray(4,4810); //DMBIN_LARGEFMT49static final Win32MediaTray FORMSOURCE = new Win32MediaTray(5,5015); //DMBIN_FORMSOURCE5152private static ArrayList winStringTable = new ArrayList();53private static ArrayList winEnumTable = new ArrayList();54public int winID;5556private Win32MediaTray(int value, int id) {57super (value);58winID = id;59}6061private synchronized static int nextValue(String name) {62winStringTable.add(name);63return (getTraySize()-1);64}6566protected Win32MediaTray(int id, String name) {67super (nextValue(name));68winID = id;69winEnumTable.add(this);70}7172public int getDMBinID() {73return winID;74}7576private static final String[] myStringTable ={77"Manual-Envelope",78"Automatic-Feeder",79"Tractor-Feeder",80"Small-Format",81"Large-Format",82"Form-Source",83};8485private static final MediaTray[] myEnumValueTable = {86ENVELOPE_MANUAL,87AUTO,88TRACTOR,89SMALL_FORMAT,90LARGE_FORMAT,91FORMSOURCE,92};9394protected static int getTraySize() {95return (myStringTable.length+winStringTable.size());96}9798protected String[] getStringTable() {99ArrayList completeList = new ArrayList();100for (int i=0; i < myStringTable.length; i++) {101completeList.add(myStringTable[i]);102}103completeList.addAll(winStringTable);104String[] nameTable = new String[completeList.size()];105return (String[])completeList.toArray(nameTable);106}107108protected EnumSyntax[] getEnumValueTable() {109ArrayList completeList = new ArrayList();110for (int i=0; i < myEnumValueTable.length; i++) {111completeList.add(myEnumValueTable[i]);112}113completeList.addAll(winEnumTable);114MediaTray[] enumTable = new MediaTray[completeList.size()];115return (MediaTray[])completeList.toArray(enumTable);116}117}118119120