Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/classes/sun/print/Win32MediaTray.java
32287 views
1
/*
2
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package sun.print;
27
28
import javax.print.attribute.standard.MediaTray;
29
import javax.print.attribute.EnumSyntax;
30
import java.util.ArrayList;
31
32
/**
33
* Class Win32MediaTray is a subclass of MediaTray which declares
34
* Windows media trays or bins not covered by MediaTray's standard values.
35
* It also implements driver-defined trays.
36
**/
37
38
public class Win32MediaTray extends MediaTray {
39
40
static final Win32MediaTray ENVELOPE_MANUAL = new Win32MediaTray(0,
41
6); //DMBIN_ENVMANUAL
42
static final Win32MediaTray AUTO = new Win32MediaTray(1,
43
7); //DMBIN_AUTO
44
static final Win32MediaTray TRACTOR = new Win32MediaTray(2,
45
8); //DMBIN_TRACTOR
46
static final Win32MediaTray SMALL_FORMAT = new Win32MediaTray(3,
47
9); //DMBIN_SMALLFMT
48
static final Win32MediaTray LARGE_FORMAT = new Win32MediaTray(4,
49
10); //DMBIN_LARGEFMT
50
static final Win32MediaTray FORMSOURCE = new Win32MediaTray(5,
51
15); //DMBIN_FORMSOURCE
52
53
private static ArrayList winStringTable = new ArrayList();
54
private static ArrayList winEnumTable = new ArrayList();
55
public int winID;
56
57
private Win32MediaTray(int value, int id) {
58
super (value);
59
winID = id;
60
}
61
62
private synchronized static int nextValue(String name) {
63
winStringTable.add(name);
64
return (getTraySize()-1);
65
}
66
67
protected Win32MediaTray(int id, String name) {
68
super (nextValue(name));
69
winID = id;
70
winEnumTable.add(this);
71
}
72
73
public int getDMBinID() {
74
return winID;
75
}
76
77
private static final String[] myStringTable ={
78
"Manual-Envelope",
79
"Automatic-Feeder",
80
"Tractor-Feeder",
81
"Small-Format",
82
"Large-Format",
83
"Form-Source",
84
};
85
86
private static final MediaTray[] myEnumValueTable = {
87
ENVELOPE_MANUAL,
88
AUTO,
89
TRACTOR,
90
SMALL_FORMAT,
91
LARGE_FORMAT,
92
FORMSOURCE,
93
};
94
95
protected static int getTraySize() {
96
return (myStringTable.length+winStringTable.size());
97
}
98
99
protected String[] getStringTable() {
100
ArrayList completeList = new ArrayList();
101
for (int i=0; i < myStringTable.length; i++) {
102
completeList.add(myStringTable[i]);
103
}
104
completeList.addAll(winStringTable);
105
String[] nameTable = new String[completeList.size()];
106
return (String[])completeList.toArray(nameTable);
107
}
108
109
protected EnumSyntax[] getEnumValueTable() {
110
ArrayList completeList = new ArrayList();
111
for (int i=0; i < myEnumValueTable.length; i++) {
112
completeList.add(myEnumValueTable[i]);
113
}
114
completeList.addAll(winEnumTable);
115
MediaTray[] enumTable = new MediaTray[completeList.size()];
116
return (MediaTray[])completeList.toArray(enumTable);
117
}
118
}
119
120