2362N/A * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Class MediaSize is a two-dimensional size valued printing attribute class 0N/A * that indicates the dimensions of the medium in a portrait orientation, with 0N/A * the X dimension running along the bottom edge and the Y dimension running 0N/A * along the left edge. Thus, the Y dimension must be greater than or equal to 0N/A * the X dimension. Class MediaSize declares many standard media size 0N/A * values, organized into nested classes for ISO, JIS, North American, 0N/A * engineering, and other media. 0N/A * MediaSize is not yet used to specify media. Its current role is 0N/A * as a mapping for named media (see {@link MediaSizeName MediaSizeName}). 0N/A * Clients can use the mapping method 0N/A * <code>MediaSize.getMediaSizeForName(MediaSizeName)</code> 0N/A * to find the physical dimensions of the MediaSizeName instances 0N/A * enumerated in this API. This is useful for clients which need this 0N/A * information to format & paginate printing. 0N/A * @author Phil Race, Alan Kaminsky 0N/A * Construct a new media size attribute from the given floating-point 0N/A * @param x X dimension. 0N/A * @param y Y dimension. 0N/A * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or 0N/A * <CODE>Size2DSyntax.MM</CODE>. 0N/A * @exception IllegalArgumentException 0N/A * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> 0N/A * < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>. 0N/A * Construct a new media size attribute from the given integer values. 0N/A * @param x X dimension. 0N/A * @param y Y dimension. 0N/A * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or 0N/A * <CODE>Size2DSyntax.MM</CODE>. 0N/A * @exception IllegalArgumentException 0N/A * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> 0N/A * < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>. 0N/A * Construct a new media size attribute from the given floating-point 0N/A * @param x X dimension. 0N/A * @param y Y dimension. 0N/A * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or 0N/A * <CODE>Size2DSyntax.MM</CODE>. 0N/A * @param media a media name to associate with this MediaSize 0N/A * @exception IllegalArgumentException 0N/A * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> 0N/A * < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>. 0N/A * Construct a new media size attribute from the given integer values. 0N/A * @param x X dimension. 0N/A * @param y Y dimension. 0N/A * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or 0N/A * <CODE>Size2DSyntax.MM</CODE>. 0N/A * @param media a media name to associate with this MediaSize 0N/A * @exception IllegalArgumentException 0N/A * (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> 0N/A * < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>. 0N/A * Get the media name, if any, for this size. 0N/A * @return the name for this media size, or null if no name was 0N/A * associated with this size (an anonymous size). 0N/A * Get the MediaSize for the specified named media. 0N/A * @param media - the name of the media for which the size is sought 0N/A * @return size of the media, or null if this media is not associated 0N/A * The specified dimensions are used to locate a matching MediaSize 0N/A * instance from amongst all the standard MediaSize instances. 0N/A * If there is no exact match, the closest match is used. 0N/A * The MediaSize is in turn used to locate the MediaSizeName object. 0N/A * This method may return null if the closest matching MediaSize 0N/A * has no corresponding Media instance. 0N/A * This method is useful for clients which have only dimensions and 0N/A * want to find a Media which corresponds to the dimensions. 0N/A * @param x - X dimension 0N/A * @param y - Y dimension. 0N/A * Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or 0N/A * <CODE>Size2DSyntax.MM</CODE> 0N/A * @return MediaSizeName matching these dimensions, or null. 0N/A * @exception IllegalArgumentException if x <= 0, y <= 0, or units < 1 0N/A if (x <=
0.0f || y <=
0.0f ||
units <
1) {
0N/A double ls = x * x + y * y;
0N/A * Returns whether this media size attribute is equivalent to the passed 0N/A * To be equivalent, all of the following conditions must be true: 0N/A * <CODE>object</CODE> is not null. 0N/A * <CODE>object</CODE> is an instance of class MediaSize. 0N/A * This media size attribute's X dimension is equal to 0N/A * <CODE>object</CODE>'s X dimension. 0N/A * This media size attribute's Y dimension is equal to 0N/A * <CODE>object</CODE>'s Y dimension. 0N/A * @param object Object to compare to. 0N/A * @return True if <CODE>object</CODE> is equivalent to this media size 0N/A * attribute, false otherwise. 0N/A * Get the printing attribute class which is to be used as the "category" 0N/A * for this printing attribute value. 0N/A * For class MediaSize and any vendor-defined subclasses, the category is 0N/A * class MediaSize itself. 0N/A * @return Printing attribute class (category), an instance of class 0N/A * {@link java.lang.Class java.lang.Class}. 0N/A * Get the name of the category of which this attribute value is an 0N/A * For class MediaSize and any vendor-defined subclasses, the category 0N/A * name is <CODE>"media-size"</CODE>. 0N/A * @return Attribute category name. 0N/A return "media-size";
0N/A * Class MediaSize.ISO includes {@link MediaSize MediaSize} values for ISO 0N/A public final static class ISO {
0N/A * Specifies the ISO A0 size, 841 mm by 1189 mm. 0N/A * Specifies the ISO A1 size, 594 mm by 841 mm. 0N/A * Specifies the ISO A2 size, 420 mm by 594 mm. 0N/A * Specifies the ISO A3 size, 297 mm by 420 mm. 0N/A * Specifies the ISO A4 size, 210 mm by 297 mm. 0N/A * Specifies the ISO A5 size, 148 mm by 210 mm. 0N/A * Specifies the ISO A6 size, 105 mm by 148 mm. 0N/A * Specifies the ISO A7 size, 74 mm by 105 mm. 0N/A * Specifies the ISO A8 size, 52 mm by 74 mm. 0N/A * Specifies the ISO A9 size, 37 mm by 52 mm. 0N/A * Specifies the ISO A10 size, 26 mm by 37 mm. 0N/A * Specifies the ISO B0 size, 1000 mm by 1414 mm. 0N/A * Specifies the ISO B1 size, 707 mm by 1000 mm. 0N/A * Specifies the ISO B2 size, 500 mm by 707 mm. 0N/A * Specifies the ISO B3 size, 353 mm by 500 mm. 0N/A * Specifies the ISO B4 size, 250 mm by 353 mm. 0N/A * Specifies the ISO B5 size, 176 mm by 250 mm. 0N/A * Specifies the ISO B6 size, 125 mm by 176 mm. 0N/A * Specifies the ISO B7 size, 88 mm by 125 mm. 0N/A * Specifies the ISO B8 size, 62 mm by 88 mm. 0N/A * Specifies the ISO B9 size, 44 mm by 62 mm. 0N/A * Specifies the ISO B10 size, 31 mm by 44 mm. 0N/A * Specifies the ISO C3 size, 324 mm by 458 mm. 0N/A * Specifies the ISO C4 size, 229 mm by 324 mm. 0N/A * Specifies the ISO C5 size, 162 mm by 229 mm. 0N/A * Specifies the ISO C6 size, 114 mm by 162 mm. 0N/A * Specifies the ISO Designated Long size, 110 mm by 220 mm. 0N/A * Hide all constructors. 0N/A * Class MediaSize.JIS includes {@link MediaSize MediaSize} values for JIS 0N/A * (Japanese) media. * 0N/A public final static class JIS {
0N/A * Specifies the JIS B0 size, 1030 mm by 1456 mm. 0N/A * Specifies the JIS B1 size, 728 mm by 1030 mm. 0N/A * Specifies the JIS B2 size, 515 mm by 728 mm. 0N/A * Specifies the JIS B3 size, 364 mm by 515 mm. 0N/A * Specifies the JIS B4 size, 257 mm by 364 mm. 0N/A * Specifies the JIS B5 size, 182 mm by 257 mm. 0N/A * Specifies the JIS B6 size, 128 mm by 182 mm. 0N/A * Specifies the JIS B7 size, 91 mm by 128 mm. 0N/A * Specifies the JIS B8 size, 64 mm by 91 mm. 0N/A * Specifies the JIS B9 size, 45 mm by 64 mm. 0N/A * Specifies the JIS B10 size, 32 mm by 45 mm. 0N/A * Specifies the JIS Chou ("long") #1 envelope size, 142 mm by 332 mm. 0N/A * Specifies the JIS Chou ("long") #2 envelope size, 119 mm by 277 mm. 0N/A * Specifies the JIS Chou ("long") #3 envelope size, 120 mm by 235 mm. 0N/A * Specifies the JIS Chou ("long") #4 envelope size, 90 mm by 205 mm. 0N/A * Specifies the JIS Chou ("long") #30 envelope size, 92 mm by 235 mm. 0N/A * Specifies the JIS Chou ("long") #40 envelope size, 90 mm by 225 mm. 0N/A * Specifies the JIS Kaku ("square") #0 envelope size, 287 mm by 382 mm. 0N/A * Specifies the JIS Kaku ("square") #1 envelope size, 270 mm by 382 mm. 0N/A * Specifies the JIS Kaku ("square") #2 envelope size, 240 mm by 332 mm. 0N/A * Specifies the JIS Kaku ("square") #3 envelope size, 216 mm by 277 mm. 0N/A * Specifies the JIS Kaku ("square") #4 envelope size, 197 mm by 267 mm. 0N/A * Specifies the JIS Kaku ("square") #5 envelope size, 190 mm by 240 mm. 0N/A * Specifies the JIS Kaku ("square") #6 envelope size, 162 mm by 229 mm. 0N/A * Specifies the JIS Kaku ("square") #7 envelope size, 142 mm by 205 mm. 0N/A * Specifies the JIS Kaku ("square") #8 envelope size, 119 mm by 197 mm. 0N/A * Specifies the JIS Kaku ("square") #20 envelope size, 229 mm by 324 mm. 0N/A * Specifies the JIS Kaku ("square") A4 envelope size, 228 mm by 312 mm. 0N/A * Specifies the JIS You ("Western") #1 envelope size, 120 mm by 176 mm. 0N/A * Specifies the JIS You ("Western") #2 envelope size, 114 mm by 162 mm. 0N/A * Specifies the JIS You ("Western") #3 envelope size, 98 mm by 148 mm. 0N/A * Specifies the JIS You ("Western") #4 envelope size, 105 mm by 235 mm. 0N/A * Specifies the JIS You ("Western") #5 envelope size, 95 mm by 217 mm. 0N/A * Specifies the JIS You ("Western") #6 envelope size, 98 mm by 190 mm. 0N/A * Specifies the JIS You ("Western") #7 envelope size, 92 mm by 165 mm. 0N/A * Hide all constructors. 0N/A * Class MediaSize.NA includes {@link MediaSize MediaSize} values for North 0N/A public final static class NA {
0N/A * Specifies the North American letter size, 8.5 inches by 11 inches. 0N/A * Specifies the North American legal size, 8.5 inches by 14 inches. 0N/A * Specifies the North American 5 inch by 7 inch paper. 0N/A * Specifies the North American 8 inch by 10 inch paper. 0N/A * Specifies the North American Number 9 business envelope size, 0N/A * 3.875 inches by 8.875 inches. 0N/A * Specifies the North American Number 10 business envelope size, 0N/A * 4.125 inches by 9.5 inches. 0N/A * Specifies the North American Number 11 business envelope size, 0N/A * 4.5 inches by 10.375 inches. 0N/A * Specifies the North American Number 12 business envelope size, 0N/A * 4.75 inches by 11 inches. 0N/A * Specifies the North American Number 14 business envelope size, 0N/A * 5 inches by 11.5 inches. 0N/A * Specifies the North American 6 inch by 9 inch envelope size. 0N/A * Specifies the North American 7 inch by 9 inch envelope size. 0N/A * Specifies the North American 9 inch by 11 inch envelope size. 0N/A * Specifies the North American 9 inch by 12 inch envelope size. 0N/A * Specifies the North American 10 inch by 13 inch envelope size. 0N/A * Specifies the North American 10 inch by 14 inch envelope size. 0N/A * Specifies the North American 10 inch by 15 inch envelope size. 0N/A * Hide all constructors. 0N/A * Class MediaSize.Engineering includes {@link MediaSize MediaSize} values 0N/A * for engineering media. 0N/A * Specifies the engineering A size, 8.5 inch by 11 inch. 0N/A * Specifies the engineering B size, 11 inch by 17 inch. 0N/A * Specifies the engineering C size, 17 inch by 22 inch. 0N/A * Specifies the engineering D size, 22 inch by 34 inch. 0N/A * Specifies the engineering E size, 34 inch by 44 inch. 0N/A * Hide all constructors. 0N/A * Class MediaSize.Other includes {@link MediaSize MediaSize} values for 0N/A * miscellaneous media. 0N/A * Specifies the executive size, 7.25 inches by 10.5 inches. 0N/A * Specifies the ledger size, 11 inches by 17 inches. 0N/A * Specifies the tabloid size, 11 inches by 17 inches. 0N/A * Specifies the invoice size, 5.5 inches by 8.5 inches. 0N/A * Specifies the folio size, 8.5 inches by 13 inches. 0N/A * Specifies the quarto size, 8.5 inches by 10.83 inches. 0N/A * Specifies the Italy envelope size, 110 mm by 230 mm. 0N/A * Specifies the Monarch envelope size, 3.87 inch by 7.5 inch. 0N/A * Specifies the Personal envelope size, 3.625 inch by 6.5 inch. 0N/A * Specifies the Japanese postcard size, 100 mm by 148 mm. 0N/A * Specifies the Japanese Double postcard size, 148 mm by 200 mm. 0N/A * Hide all constructors. 0N/A /* force loading of all the subclasses so that the instances 0N/A * are created and inserted into the hashmap.