OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [gnu/] [javax/] [print/] [CupsMediaMapping.java] - Blame information for rev 769

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 769 jeremybenn
/* CupsMediaMapping.java --
2
   Copyright (C) 2006 Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package gnu.javax.print;
40
 
41
import java.util.Collections;
42
import java.util.HashMap;
43
import java.util.Map;
44
 
45
import javax.print.attribute.standard.MediaSizeName;
46
 
47
/**
48
 * Provides the currently known mappings of the media attribute
49
 * values of the CUPS printing system to the IPP standard values.
50
 * <p>
51
 * The mapping is used to build up print service specific mappings
52
 * for use of media attribute translation between Java JPS API and
53
 * CUPS.
54
 * </p>
55
 *
56
 * @author Wolfgang Baer (WBaer@gmx.de)
57
 */
58
public class CupsMediaMapping
59
{
60
  // the mapping map
61
  private static final HashMap ippByCups = new HashMap();
62
 
63
  /**
64
   * Initialize currently known mappings.
65
   */
66
  static
67
    {
68
      ippByCups.put("Postcard", MediaSizeName.JAPANESE_POSTCARD);
69
      ippByCups.put("Statement", MediaSizeName.INVOICE);
70
 
71
      ippByCups.put("Letter", MediaSizeName.NA_LETTER);
72
      ippByCups.put("Executive", MediaSizeName.EXECUTIVE);
73
      ippByCups.put("Legal", MediaSizeName.NA_LEGAL);
74
 
75
      ippByCups.put("A0", MediaSizeName.ISO_A0);
76
      ippByCups.put("A1", MediaSizeName.ISO_A1);
77
      ippByCups.put("A2", MediaSizeName.ISO_A2);
78
      ippByCups.put("A3", MediaSizeName.ISO_A3);
79
      ippByCups.put("A4", MediaSizeName.ISO_A4);
80
      ippByCups.put("A5", MediaSizeName.ISO_A5);
81
      ippByCups.put("A6", MediaSizeName.ISO_A6);
82
      ippByCups.put("A7", MediaSizeName.ISO_A7);
83
      ippByCups.put("A8", MediaSizeName.ISO_A8);
84
      ippByCups.put("A9", MediaSizeName.ISO_A9);
85
      ippByCups.put("A10", MediaSizeName.ISO_A10);
86
 
87
      ippByCups.put("B0", MediaSizeName.JIS_B0);
88
      ippByCups.put("B1", MediaSizeName.JIS_B1);
89
      ippByCups.put("B2", MediaSizeName.JIS_B2);
90
      ippByCups.put("B3", MediaSizeName.JIS_B3);
91
      ippByCups.put("B4", MediaSizeName.JIS_B4);
92
      ippByCups.put("B5", MediaSizeName.JIS_B5);
93
      ippByCups.put("B6", MediaSizeName.JIS_B6);
94
      ippByCups.put("B7", MediaSizeName.JIS_B7);
95
      ippByCups.put("B8", MediaSizeName.JIS_B8);
96
      ippByCups.put("B9", MediaSizeName.JIS_B9);
97
      ippByCups.put("B10", MediaSizeName.JIS_B10);
98
 
99
      ippByCups.put("ISOB0", MediaSizeName.ISO_B0);
100
      ippByCups.put("ISOB1", MediaSizeName.ISO_B1);
101
      ippByCups.put("ISOB2", MediaSizeName.ISO_B2);
102
      ippByCups.put("ISOB3", MediaSizeName.ISO_B3);
103
      ippByCups.put("ISOB4", MediaSizeName.ISO_B4);
104
      ippByCups.put("ISOB5", MediaSizeName.ISO_B5);
105
      ippByCups.put("ISOB6", MediaSizeName.ISO_B6);
106
      ippByCups.put("ISOB7", MediaSizeName.ISO_B7);
107
      ippByCups.put("ISOB8", MediaSizeName.ISO_B8);
108
      ippByCups.put("ISOB9", MediaSizeName.ISO_B9);
109
      ippByCups.put("ISOB10", MediaSizeName.ISO_B10);
110
      ippByCups.put("EnvISOB0", MediaSizeName.ISO_B0);
111
      ippByCups.put("EnvISOB1", MediaSizeName.ISO_B1);
112
      ippByCups.put("EnvISOB2", MediaSizeName.ISO_B2);
113
      ippByCups.put("EnvISOB3", MediaSizeName.ISO_B3);
114
      ippByCups.put("EnvISOB4", MediaSizeName.ISO_B4);
115
      ippByCups.put("EnvISOB5", MediaSizeName.ISO_B5);
116
      ippByCups.put("EnvISOB6", MediaSizeName.ISO_B6);
117
      ippByCups.put("EnvISOB7", MediaSizeName.ISO_B7);
118
      ippByCups.put("EnvISOB8", MediaSizeName.ISO_B8);
119
      ippByCups.put("EnvISOB9", MediaSizeName.ISO_B9);
120
      ippByCups.put("EnvISOB10", MediaSizeName.ISO_B10);
121
 
122
      ippByCups.put("C0", MediaSizeName.ISO_C0);
123
      ippByCups.put("C1", MediaSizeName.ISO_C1);
124
      ippByCups.put("C2", MediaSizeName.ISO_C2);
125
      ippByCups.put("C3", MediaSizeName.ISO_C3);
126
      ippByCups.put("C4", MediaSizeName.ISO_C4);
127
      ippByCups.put("C5", MediaSizeName.ISO_C5);
128
      ippByCups.put("C6", MediaSizeName.ISO_C6);
129
 
130
      ippByCups.put("EnvPersonal", MediaSizeName.PERSONAL_ENVELOPE);
131
      ippByCups.put("EnvMonarch", MediaSizeName.MONARCH_ENVELOPE);
132
      ippByCups.put("Monarch", MediaSizeName.MONARCH_ENVELOPE);
133
      ippByCups.put("Env9", MediaSizeName.NA_NUMBER_9_ENVELOPE);
134
      ippByCups.put("Env10", MediaSizeName.NA_NUMBER_10_ENVELOPE);
135
      ippByCups.put("Env11", MediaSizeName.NA_NUMBER_11_ENVELOPE);
136
      ippByCups.put("Env12", MediaSizeName.NA_NUMBER_12_ENVELOPE);
137
      ippByCups.put("Env14", MediaSizeName.NA_NUMBER_14_ENVELOPE);
138
      ippByCups.put("c8x10", MediaSizeName.NA_8X10);
139
 
140
      ippByCups.put("EnvDL", MediaSizeName.ISO_DESIGNATED_LONG);
141
      ippByCups.put("DL", MediaSizeName.ISO_DESIGNATED_LONG);
142
      ippByCups.put("EnvC0", MediaSizeName.ISO_C0);
143
      ippByCups.put("EnvC1", MediaSizeName.ISO_C1);
144
      ippByCups.put("EnvC2", MediaSizeName.ISO_C2);
145
      ippByCups.put("EnvC3", MediaSizeName.ISO_C3);
146
      ippByCups.put("EnvC4", MediaSizeName.ISO_C4);
147
      ippByCups.put("EnvC5", MediaSizeName.ISO_C5);
148
      ippByCups.put("EnvC6", MediaSizeName.ISO_C6);
149
    }
150
 
151
  /**
152
   * Returns the IPP media name of the given cups name.
153
   *
154
   * @param cupsName the name in cups
155
   * @return The IPP name if a mapping is known, <code>null</code> otherwise.
156
   */
157
  public static final String getIppName(String cupsName)
158
  {
159
    return (String) ippByCups.get(cupsName);
160
  }
161
 
162
  /**
163
   * Returns the mapping map for iteration.
164
   *
165
   * @return The mapping map as unmodifiable map.
166
   */
167
  public static final Map getMappingMap()
168
  {
169
    return Collections.unmodifiableMap(ippByCups);
170
  }
171
 
172
  private CupsMediaMapping()
173
  {
174
    // not to be instantiated
175
  }
176
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.