Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/print/CustomMediaTray.java
38829 views
/*1* Copyright (c) 2003, 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.EnumSyntax;28import javax.print.attribute.standard.MediaTray;29import javax.print.attribute.standard.Media;30import java.util.ArrayList;3132class CustomMediaTray extends MediaTray {33private static ArrayList customStringTable = new ArrayList();34private static ArrayList customEnumTable = new ArrayList();35private String choiceName;3637private CustomMediaTray(int x) {38super(x);3940}4142private synchronized static int nextValue(String name) {43customStringTable.add(name);44return (customStringTable.size()-1);45}464748public CustomMediaTray(String name, String choice) {49super(nextValue(name));50choiceName = choice;51customEnumTable.add(this);52}5354/**55* Version ID for serialized form.56*/57private static final long serialVersionUID = 1019451298193987013L;585960/**61* Returns the command string for this media tray.62*/63public String getChoiceName() {64return choiceName;65}666768/**69* Returns the string table for super class MediaTray.70*/71public Media[] getSuperEnumTable() {72return (Media[])super.getEnumValueTable();73}747576/**77* Returns the string table for class CustomMediaTray.78*/79protected String[] getStringTable() {80String[] nameTable = new String[customStringTable.size()];81return (String[])customStringTable.toArray(nameTable);82}8384/**85* Returns the enumeration value table for class CustomMediaTray.86*/87protected EnumSyntax[] getEnumValueTable() {88MediaTray[] enumTable = new MediaTray[customEnumTable.size()];89return (MediaTray[])customEnumTable.toArray(enumTable);90}9192}939495