1 /*
2 * Copyright (c) 2000, 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
29
30 import javax.print.attribute.Size2DSyntax;
31 import javax.print.attribute.Attribute;
32
33 /**
34 * Class MediaSize is a two-dimensional size valued printing attribute class
35 * that indicates the dimensions of the medium in a portrait orientation, with
36 * the X dimension running along the bottom edge and the Y dimension running
37 * along the left edge. Thus, the Y dimension must be greater than or equal to
38 * the X dimension. Class MediaSize declares many standard media size
39 * values, organized into nested classes for ISO, JIS, North American,
40 * engineering, and other media.
41 * <P>
42 * MediaSize is not yet used to specify media. Its current role is
43 * as a mapping for named media (see {@link MediaSizeName MediaSizeName}).
44 * Clients can use the mapping method
45 * <code>MediaSize.getMediaSizeForName(MediaSizeName)</code>
46 * to find the physical dimensions of the MediaSizeName instances
47 * enumerated in this API. This is useful for clients which need this
48 * information to format {@literal &} paginate printing.
49 * <P>
50 *
51 * @author Phil Race, Alan Kaminsky
52 */
53 public class MediaSize extends Size2DSyntax implements Attribute {
54
55 private static final long serialVersionUID = -1967958664615414771L;
56
57 private MediaSizeName mediaName;
58
59 private static HashMap mediaMap = new HashMap(100, 10);
60
61 private static Vector sizeVector = new Vector(100, 10);
62
63 /**
64 * Construct a new media size attribute from the given floating-point
65 * values.
66 *
67 * @param x X dimension.
68 * @param y Y dimension.
69 * @param units
|
1 /*
2 * Copyright (c) 2000, 2014, 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
29
30 import javax.print.attribute.Size2DSyntax;
31 import javax.print.attribute.Attribute;
32
33 /**
34 * Class MediaSize is a two-dimensional size valued printing attribute class
35 * that indicates the dimensions of the medium in a portrait orientation, with
36 * the X dimension running along the bottom edge and the Y dimension running
37 * along the left edge. Thus, the Y dimension must be greater than or equal to
38 * the X dimension. Class MediaSize declares many standard media size
39 * values, organized into nested classes for ISO, JIS, North American,
40 * engineering, and other media.
41 * <P>
42 * MediaSize is not yet used to specify media. Its current role is
43 * as a mapping for named media (see {@link MediaSizeName MediaSizeName}).
44 * Clients can use the mapping method
45 * <code>MediaSize.getMediaSizeForName(MediaSizeName)</code>
46 * to find the physical dimensions of the MediaSizeName instances
47 * enumerated in this API. This is useful for clients which need this
48 * information to format {@literal &} paginate printing.
49 *
50 * @author Phil Race, Alan Kaminsky
51 */
52 public class MediaSize extends Size2DSyntax implements Attribute {
53
54 private static final long serialVersionUID = -1967958664615414771L;
55
56 private MediaSizeName mediaName;
57
58 private static HashMap mediaMap = new HashMap(100, 10);
59
60 private static Vector sizeVector = new Vector(100, 10);
61
62 /**
63 * Construct a new media size attribute from the given floating-point
64 * values.
65 *
66 * @param x X dimension.
67 * @param y Y dimension.
68 * @param units
|