Source Code Cross Referenced for MediaSize.java in  » 6.0-JDK-Core » print » javax » print » attribute » standard » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » print » javax.print.attribute.standard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025        package javax.print.attribute.standard;
026
027        import java.util.HashMap;
028        import java.util.Vector;
029
030        import javax.print.attribute.Size2DSyntax;
031        import javax.print.attribute.Attribute;
032
033        /**
034         * Class MediaSize is a two-dimensional size valued printing attribute class 
035         * that indicates the dimensions of the medium in a portrait orientation, with 
036         * the X dimension running along the bottom edge and the Y dimension running 
037         * along the left edge. Thus, the Y dimension must be greater than or equal to 
038         * the X dimension. Class MediaSize declares many standard media size
039         * values, organized into nested classes for ISO, JIS, North American,
040         * engineering, and other media. 
041         * <P>
042         * MediaSize is not yet used to specify media. Its current role is
043         * as a mapping for named media (see {@link MediaSizeName MediaSizeName}).
044         * Clients can use the mapping method
045         * <code>MediaSize.getMediaSizeForName(MediaSizeName)</code>
046         * to find the physical dimensions of the MediaSizeName instances
047         * enumerated in this API. This is useful for clients which need this 
048         * information to format & paginate printing.
049         * <P>
050         *
051         * @author  Phil Race, Alan Kaminsky
052         */
053        public class MediaSize extends Size2DSyntax implements  Attribute {
054
055            private static final long serialVersionUID = -1967958664615414771L;
056
057            private MediaSizeName mediaName;
058
059            private static HashMap mediaMap = new HashMap(100, 10);
060
061            private static Vector sizeVector = new Vector(100, 10);
062
063            /**
064             * Construct a new media size attribute from the given floating-point 
065             * values. 
066             *
067             * @param  x  X dimension.
068             * @param  y  Y dimension.
069             * @param  units
070             *     Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or
071             *     <CODE>Size2DSyntax.MM</CODE>. 
072             *
073             * @exception  IllegalArgumentException
074             *   (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> 
075             *     < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>.
076             */
077            public MediaSize(float x, float y, int units) {
078                super (x, y, units);
079                if (x > y) {
080                    throw new IllegalArgumentException(
081                            "X dimension > Y dimension");
082                }
083                sizeVector.add(this );
084            }
085
086            /**
087             * Construct a new media size attribute from the given integer values. 
088             *
089             * @param  x  X dimension.
090             * @param  y  Y dimension.
091             * @param  units
092             *     Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or
093             *     <CODE>Size2DSyntax.MM</CODE>. 
094             *
095             * @exception  IllegalArgumentException
096             *   (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> 
097             *     < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>.
098             */
099            public MediaSize(int x, int y, int units) {
100                super (x, y, units);
101                if (x > y) {
102                    throw new IllegalArgumentException(
103                            "X dimension > Y dimension");
104                }
105                sizeVector.add(this );
106            }
107
108            /**
109             * Construct a new media size attribute from the given floating-point 
110             * values. 
111             *
112             * @param  x  X dimension.
113             * @param  y  Y dimension.
114             * @param  units
115             *     Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or
116             *     <CODE>Size2DSyntax.MM</CODE>. 
117             * @param media a media name to associate with this MediaSize
118             *
119             * @exception  IllegalArgumentException
120             *   (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> 
121             *     < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>.
122             */
123            public MediaSize(float x, float y, int units, MediaSizeName media) {
124                super (x, y, units);
125                if (x > y) {
126                    throw new IllegalArgumentException(
127                            "X dimension > Y dimension");
128                }
129                mediaName = media;
130                mediaMap.put(mediaName, this );
131                sizeVector.add(this );
132            }
133
134            /**
135             * Construct a new media size attribute from the given integer values. 
136             *
137             * @param  x  X dimension.
138             * @param  y  Y dimension.
139             * @param  units
140             *     Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or
141             *     <CODE>Size2DSyntax.MM</CODE>. 
142             * @param media a media name to associate with this MediaSize
143             *
144             * @exception  IllegalArgumentException
145             *   (Unchecked exception) Thrown if <CODE>x</CODE> < 0 or <CODE>y</CODE> 
146             *     < 0 or <CODE>units</CODE> < 1 or <CODE>x</CODE> > <CODE>y</CODE>.
147             */
148            public MediaSize(int x, int y, int units, MediaSizeName media) {
149                super (x, y, units);
150                if (x > y) {
151                    throw new IllegalArgumentException(
152                            "X dimension > Y dimension");
153                }
154                mediaName = media;
155                mediaMap.put(mediaName, this );
156                sizeVector.add(this );
157            }
158
159            /**
160             * Get the media name, if any, for this size.
161             *
162             * @return the name for this media size, or null if no name was
163             * associated with this size (an anonymous size).
164             */
165            public MediaSizeName getMediaSizeName() {
166                return mediaName;
167            }
168
169            /**
170             * Get the MediaSize for the specified named media.
171             *
172             * @param media - the name of the media for which the size is sought
173             * @return size of the media, or null if this media is not associated
174             * with any size.
175             */
176            public static MediaSize getMediaSizeForName(MediaSizeName media) {
177                return (MediaSize) mediaMap.get(media);
178            }
179
180            /**
181             * The specified dimensions are used to locate a matching MediaSize
182             * instance from amongst all the standard MediaSize instances.
183             * If there is no exact match, the closest match is used.
184             * <p>
185             * The MediaSize is in turn used to locate the MediaSizeName object.
186             * This method may return null if the closest matching MediaSize
187             * has no corresponding Media instance.
188             * <p>
189             * This method is useful for clients which have only dimensions and
190             * want to find a Media which corresponds to the dimensions.
191             * @param x - X dimension
192             * @param y - Y dimension.
193             * @param  units
194             *     Unit conversion factor, e.g. <CODE>Size2DSyntax.INCH</CODE> or
195             *     <CODE>Size2DSyntax.MM</CODE>
196             * @return MediaSizeName matching these dimensions, or null.
197             * @exception IllegalArgumentException if x <= 0, y <= 0, or units < 1
198             * 
199             */
200            public static MediaSizeName findMedia(float x, float y, int units) {
201
202                MediaSize match = MediaSize.ISO.A4;
203
204                if (x <= 0.0f || y <= 0.0f || units < 1) {
205                    throw new IllegalArgumentException(
206                            "args must be +ve values");
207                }
208
209                double ls = x * x + y * y;
210                double tmp_ls;
211                float[] dim;
212                float diffx = x;
213                float diffy = y;
214
215                for (int i = 0; i < sizeVector.size(); i++) {
216                    MediaSize mediaSize = (MediaSize) sizeVector.elementAt(i);
217                    dim = mediaSize.getSize(units);
218                    if (x == dim[0] && y == dim[1]) {
219                        match = mediaSize;
220                        break;
221                    } else {
222                        diffx = x - dim[0];
223                        diffy = y - dim[1];
224                        tmp_ls = diffx * diffx + diffy * diffy;
225                        if (tmp_ls < ls) {
226                            ls = tmp_ls;
227                            match = mediaSize;
228                        }
229                    }
230                }
231
232                return match.getMediaSizeName();
233            }
234
235            /**
236             * Returns whether this media size attribute is equivalent to the passed 
237             * in object.
238             * To be equivalent, all of the following conditions must be true: 
239             * <OL TYPE=1>
240             * <LI>
241             * <CODE>object</CODE> is not null.
242             * <LI>
243             * <CODE>object</CODE> is an instance of class MediaSize.
244             * <LI>
245             * This media size attribute's X dimension is equal to 
246             * <CODE>object</CODE>'s X dimension. 
247             * <LI>
248             * This media size attribute's Y dimension is equal to 
249             * <CODE>object</CODE>'s Y dimension. 
250             * </OL>
251             *
252             * @param  object  Object to compare to.
253             *
254             * @return  True if <CODE>object</CODE> is equivalent to this media size
255             *          attribute, false otherwise. 
256             */
257            public boolean equals(Object object) {
258                return (super .equals(object) && object instanceof  MediaSize);
259            }
260
261            /**
262             * Get the printing attribute class which is to be used as the "category" 
263             * for this printing attribute value.
264             * <P>
265             * For class MediaSize and any vendor-defined subclasses, the category is 
266             * class MediaSize itself. 
267             *
268             * @return  Printing attribute class (category), an instance of class
269             *          {@link java.lang.Class java.lang.Class}.
270             */
271            public final Class<? extends Attribute> getCategory() {
272                return MediaSize.class;
273            }
274
275            /**
276             * Get the name of the category of which this attribute value is an 
277             * instance. 
278             * <P>
279             * For class MediaSize and any vendor-defined subclasses, the category
280             * name is <CODE>"media-size"</CODE>. 
281             *
282             * @return  Attribute category name.
283             */
284            public final String getName() {
285                return "media-size";
286            }
287
288            /**
289             * Class MediaSize.ISO includes {@link MediaSize MediaSize} values for ISO 
290             * media. 
291             * <P>
292             */
293            public final static class ISO {
294                /**
295                 * Specifies the ISO A0 size, 841 mm by 1189 mm. 
296                 */
297                public static final MediaSize A0 = new MediaSize(841, 1189,
298                        Size2DSyntax.MM, MediaSizeName.ISO_A0);
299                /**
300                 * Specifies the ISO A1 size, 594 mm by 841 mm. 
301                 */
302                public static final MediaSize A1 = new MediaSize(594, 841,
303                        Size2DSyntax.MM, MediaSizeName.ISO_A1);
304                /**
305                 * Specifies the ISO A2 size, 420 mm by 594 mm. 
306                 */
307                public static final MediaSize A2 = new MediaSize(420, 594,
308                        Size2DSyntax.MM, MediaSizeName.ISO_A2);
309                /**
310                 * Specifies the ISO A3 size, 297 mm by 420 mm. 
311                 */
312                public static final MediaSize A3 = new MediaSize(297, 420,
313                        Size2DSyntax.MM, MediaSizeName.ISO_A3);
314                /**
315                 * Specifies the ISO A4 size, 210 mm by 297 mm. 
316                 */
317                public static final MediaSize A4 = new MediaSize(210, 297,
318                        Size2DSyntax.MM, MediaSizeName.ISO_A4);
319                /**
320                 * Specifies the ISO A5 size, 148 mm by 210 mm. 
321                 */
322                public static final MediaSize A5 = new MediaSize(148, 210,
323                        Size2DSyntax.MM, MediaSizeName.ISO_A5);
324                /**
325                 * Specifies the ISO A6 size, 105 mm by 148 mm. 
326                 */
327                public static final MediaSize A6 = new MediaSize(105, 148,
328                        Size2DSyntax.MM, MediaSizeName.ISO_A6);
329                /**
330                 * Specifies the ISO A7 size, 74 mm by 105 mm. 
331                 */
332                public static final MediaSize A7 = new MediaSize(74, 105,
333                        Size2DSyntax.MM, MediaSizeName.ISO_A7);
334                /**
335                 * Specifies the ISO A8 size, 52 mm by 74 mm. 
336                 */
337                public static final MediaSize A8 = new MediaSize(52, 74,
338                        Size2DSyntax.MM, MediaSizeName.ISO_A8);
339                /**
340                 * Specifies the ISO A9 size, 37 mm by 52 mm. 
341                 */
342                public static final MediaSize A9 = new MediaSize(37, 52,
343                        Size2DSyntax.MM, MediaSizeName.ISO_A9);
344                /**
345                 * Specifies the ISO A10 size, 26 mm by 37 mm. 
346                 */
347                public static final MediaSize A10 = new MediaSize(26, 37,
348                        Size2DSyntax.MM, MediaSizeName.ISO_A10);
349                /**
350                 * Specifies the ISO B0 size, 1000 mm by 1414 mm. 
351                 */
352                public static final MediaSize B0 = new MediaSize(1000, 1414,
353                        Size2DSyntax.MM, MediaSizeName.ISO_B0);
354                /**
355                 * Specifies the ISO B1 size, 707 mm by 1000 mm. 
356                 */
357                public static final MediaSize B1 = new MediaSize(707, 1000,
358                        Size2DSyntax.MM, MediaSizeName.ISO_B1);
359                /**
360                 * Specifies the ISO B2 size, 500 mm by 707 mm. 
361                 */
362                public static final MediaSize B2 = new MediaSize(500, 707,
363                        Size2DSyntax.MM, MediaSizeName.ISO_B2);
364                /**
365                 * Specifies the ISO B3 size, 353 mm by 500 mm. 
366                 */
367                public static final MediaSize B3 = new MediaSize(353, 500,
368                        Size2DSyntax.MM, MediaSizeName.ISO_B3);
369                /**
370                 * Specifies the ISO B4 size, 250 mm by 353 mm. 
371                 */
372                public static final MediaSize B4 = new MediaSize(250, 353,
373                        Size2DSyntax.MM, MediaSizeName.ISO_B4);
374                /**
375                 * Specifies the ISO B5 size, 176 mm by 250 mm. 
376                 */
377                public static final MediaSize B5 = new MediaSize(176, 250,
378                        Size2DSyntax.MM, MediaSizeName.ISO_B5);
379                /**
380                 * Specifies the ISO B6 size, 125 mm by 176 mm. 
381                 */
382                public static final MediaSize B6 = new MediaSize(125, 176,
383                        Size2DSyntax.MM, MediaSizeName.ISO_B6);
384                /**
385                 * Specifies the ISO B7 size, 88 mm by 125 mm. 
386                 */
387                public static final MediaSize B7 = new MediaSize(88, 125,
388                        Size2DSyntax.MM, MediaSizeName.ISO_B7);
389                /**
390                 * Specifies the ISO B8 size, 62 mm by 88 mm. 
391                 */
392                public static final MediaSize B8 = new MediaSize(62, 88,
393                        Size2DSyntax.MM, MediaSizeName.ISO_B8);
394                /**
395                 * Specifies the ISO B9 size, 44 mm by 62 mm. 
396                 */
397                public static final MediaSize B9 = new MediaSize(44, 62,
398                        Size2DSyntax.MM, MediaSizeName.ISO_B9);
399                /**
400                 * Specifies the ISO B10 size, 31 mm by 44 mm. 
401                 */
402                public static final MediaSize B10 = new MediaSize(31, 44,
403                        Size2DSyntax.MM, MediaSizeName.ISO_B10);
404                /**
405                 * Specifies the ISO C3 size, 324 mm by 458 mm. 
406                 */
407                public static final MediaSize C3 = new MediaSize(324, 458,
408                        Size2DSyntax.MM, MediaSizeName.ISO_C3);
409                /**
410                 * Specifies the ISO C4 size, 229 mm by 324 mm. 
411                 */
412                public static final MediaSize C4 = new MediaSize(229, 324,
413                        Size2DSyntax.MM, MediaSizeName.ISO_C4);
414                /**
415                 * Specifies the ISO C5 size, 162 mm by 229 mm. 
416                 */
417                public static final MediaSize C5 = new MediaSize(162, 229,
418                        Size2DSyntax.MM, MediaSizeName.ISO_C5);
419                /**
420                 * Specifies the ISO C6 size, 114 mm by 162 mm. 
421                 */
422                public static final MediaSize C6 = new MediaSize(114, 162,
423                        Size2DSyntax.MM, MediaSizeName.ISO_C6);
424                /**
425                 * Specifies the ISO Designated Long size, 110 mm by 220 mm. 
426                 */
427                public static final MediaSize DESIGNATED_LONG = new MediaSize(
428                        110, 220, Size2DSyntax.MM,
429                        MediaSizeName.ISO_DESIGNATED_LONG);
430
431                /**
432                 * Hide all constructors.
433                 */
434                private ISO() {
435                }
436            }
437
438            /**
439             * Class MediaSize.JIS includes {@link MediaSize MediaSize} values for JIS 
440             * (Japanese) media.      *
441             */
442            public final static class JIS {
443
444                /**
445                 * Specifies the JIS B0 size, 1030 mm by 1456 mm. 
446                 */
447                public static final MediaSize B0 = new MediaSize(1030, 1456,
448                        Size2DSyntax.MM, MediaSizeName.JIS_B0);
449                /**
450                 * Specifies the JIS B1 size, 728 mm by 1030 mm. 
451                 */
452                public static final MediaSize B1 = new MediaSize(728, 1030,
453                        Size2DSyntax.MM, MediaSizeName.JIS_B1);
454                /**
455                 * Specifies the JIS B2 size, 515 mm by 728 mm. 
456                 */
457                public static final MediaSize B2 = new MediaSize(515, 728,
458                        Size2DSyntax.MM, MediaSizeName.JIS_B2);
459                /**
460                 * Specifies the JIS B3 size, 364 mm by 515 mm. 
461                 */
462                public static final MediaSize B3 = new MediaSize(364, 515,
463                        Size2DSyntax.MM, MediaSizeName.JIS_B3);
464                /**
465                 * Specifies the JIS B4 size, 257 mm by 364 mm. 
466                 */
467                public static final MediaSize B4 = new MediaSize(257, 364,
468                        Size2DSyntax.MM, MediaSizeName.JIS_B4);
469                /**
470                 * Specifies the JIS B5 size, 182 mm by 257 mm. 
471                 */
472                public static final MediaSize B5 = new MediaSize(182, 257,
473                        Size2DSyntax.MM, MediaSizeName.JIS_B5);
474                /**
475                 * Specifies the JIS B6 size, 128 mm by 182 mm. 
476                 */
477                public static final MediaSize B6 = new MediaSize(128, 182,
478                        Size2DSyntax.MM, MediaSizeName.JIS_B6);
479                /**
480                 * Specifies the JIS B7 size, 91 mm by 128 mm. 
481                 */
482                public static final MediaSize B7 = new MediaSize(91, 128,
483                        Size2DSyntax.MM, MediaSizeName.JIS_B7);
484                /**
485                 * Specifies the JIS B8 size, 64 mm by 91 mm. 
486                 */
487                public static final MediaSize B8 = new MediaSize(64, 91,
488                        Size2DSyntax.MM, MediaSizeName.JIS_B8);
489                /**
490                 * Specifies the JIS B9 size, 45 mm by 64 mm. 
491                 */
492                public static final MediaSize B9 = new MediaSize(45, 64,
493                        Size2DSyntax.MM, MediaSizeName.JIS_B9);
494                /**
495                 * Specifies the JIS B10 size, 32 mm by 45 mm. 
496                 */
497                public static final MediaSize B10 = new MediaSize(32, 45,
498                        Size2DSyntax.MM, MediaSizeName.JIS_B10);
499                /**
500                 * Specifies the JIS Chou ("long") #1 envelope size, 142 mm by 332 mm. 
501                 */
502                public static final MediaSize CHOU_1 = new MediaSize(142, 332,
503                        Size2DSyntax.MM);
504                /**
505                 * Specifies the JIS Chou ("long") #2 envelope size, 119 mm by 277 mm. 
506                 */
507                public static final MediaSize CHOU_2 = new MediaSize(119, 277,
508                        Size2DSyntax.MM);
509                /**
510                 * Specifies the JIS Chou ("long") #3 envelope size, 120 mm by 235 mm. 
511                 */
512                public static final MediaSize CHOU_3 = new MediaSize(120, 235,
513                        Size2DSyntax.MM);
514                /**
515                 * Specifies the JIS Chou ("long") #4 envelope size, 90 mm by 205 mm. 
516                 */
517                public static final MediaSize CHOU_4 = new MediaSize(90, 205,
518                        Size2DSyntax.MM);
519                /**
520                 * Specifies the JIS Chou ("long") #30 envelope size, 92 mm by 235 mm. 
521                 */
522                public static final MediaSize CHOU_30 = new MediaSize(92, 235,
523                        Size2DSyntax.MM);
524                /**
525                 * Specifies the JIS Chou ("long") #40 envelope size, 90 mm by 225 mm. 
526                 */
527                public static final MediaSize CHOU_40 = new MediaSize(90, 225,
528                        Size2DSyntax.MM);
529                /**
530                 * Specifies the JIS Kaku ("square") #0 envelope size, 287 mm by 382 mm. 
531                 */
532                public static final MediaSize KAKU_0 = new MediaSize(287, 382,
533                        Size2DSyntax.MM);
534                /**
535                 * Specifies the JIS Kaku ("square") #1 envelope size, 270 mm by 382 mm. 
536                 */
537                public static final MediaSize KAKU_1 = new MediaSize(270, 382,
538                        Size2DSyntax.MM);
539                /**
540                 * Specifies the JIS Kaku ("square") #2 envelope size, 240 mm by 332 mm. 
541                 */
542                public static final MediaSize KAKU_2 = new MediaSize(240, 332,
543                        Size2DSyntax.MM);
544                /**
545                 * Specifies the JIS Kaku ("square") #3 envelope size, 216 mm by 277 mm. 
546                 */
547                public static final MediaSize KAKU_3 = new MediaSize(216, 277,
548                        Size2DSyntax.MM);
549                /**
550                 * Specifies the JIS Kaku ("square") #4 envelope size, 197 mm by 267 mm. 
551                 */
552                public static final MediaSize KAKU_4 = new MediaSize(197, 267,
553                        Size2DSyntax.MM);
554                /**
555                 * Specifies the JIS Kaku ("square") #5 envelope size, 190 mm by 240 mm. 
556                 */
557                public static final MediaSize KAKU_5 = new MediaSize(190, 240,
558                        Size2DSyntax.MM);
559                /**
560                 * Specifies the JIS Kaku ("square") #6 envelope size, 162 mm by 229 mm. 
561                 */
562                public static final MediaSize KAKU_6 = new MediaSize(162, 229,
563                        Size2DSyntax.MM);
564                /**
565                 * Specifies the JIS Kaku ("square") #7 envelope size, 142 mm by 205 mm. 
566                 */
567                public static final MediaSize KAKU_7 = new MediaSize(142, 205,
568                        Size2DSyntax.MM);
569                /**
570                 * Specifies the JIS Kaku ("square") #8 envelope size, 119 mm by 197 mm. 
571                 */
572                public static final MediaSize KAKU_8 = new MediaSize(119, 197,
573                        Size2DSyntax.MM);
574                /**
575                 * Specifies the JIS Kaku ("square") #20 envelope size, 229 mm by 324 mm. 
576                 */
577                public static final MediaSize KAKU_20 = new MediaSize(229, 324,
578                        Size2DSyntax.MM);
579                /**
580                 * Specifies the JIS Kaku ("square") A4 envelope size, 228 mm by 312 mm. 
581                 */
582                public static final MediaSize KAKU_A4 = new MediaSize(228, 312,
583                        Size2DSyntax.MM);
584                /**
585                 * Specifies the JIS You ("Western") #1 envelope size, 120 mm by 176 mm. 
586                 */
587                public static final MediaSize YOU_1 = new MediaSize(120, 176,
588                        Size2DSyntax.MM);
589                /**
590                 * Specifies the JIS You ("Western") #2 envelope size, 114 mm by 162 mm. 
591                 */
592                public static final MediaSize YOU_2 = new MediaSize(114, 162,
593                        Size2DSyntax.MM);
594                /**
595                 * Specifies the JIS You ("Western") #3 envelope size, 98 mm by 148 mm. 
596                 */
597                public static final MediaSize YOU_3 = new MediaSize(98, 148,
598                        Size2DSyntax.MM);
599                /**
600                 * Specifies the JIS You ("Western") #4 envelope size, 105 mm by 235 mm. 
601                 */
602                public static final MediaSize YOU_4 = new MediaSize(105, 235,
603                        Size2DSyntax.MM);
604                /**
605                 * Specifies the JIS You ("Western") #5 envelope size, 95 mm by 217 mm. 
606                 */
607                public static final MediaSize YOU_5 = new MediaSize(95, 217,
608                        Size2DSyntax.MM);
609                /**
610                 * Specifies the JIS You ("Western") #6 envelope size, 98 mm by 190 mm. 
611                 */
612                public static final MediaSize YOU_6 = new MediaSize(98, 190,
613                        Size2DSyntax.MM);
614                /**
615                 * Specifies the JIS You ("Western") #7 envelope size, 92 mm by 165 mm. 
616                 */
617                public static final MediaSize YOU_7 = new MediaSize(92, 165,
618                        Size2DSyntax.MM);
619
620                /**
621                 * Hide all constructors.
622                 */
623                private JIS() {
624                }
625            }
626
627            /**
628             * Class MediaSize.NA includes {@link MediaSize MediaSize} values for North 
629             * American media. 
630             */
631            public final static class NA {
632
633                /**
634                 * Specifies the North American letter size, 8.5 inches by 11 inches.
635                 */
636                public static final MediaSize LETTER = new MediaSize(8.5f,
637                        11.0f, Size2DSyntax.INCH, MediaSizeName.NA_LETTER);
638                /**
639                 * Specifies the North American legal size, 8.5 inches by 14 inches.
640                 */
641                public static final MediaSize LEGAL = new MediaSize(8.5f,
642                        14.0f, Size2DSyntax.INCH, MediaSizeName.NA_LEGAL);
643                /**
644                 * Specifies the North American 5 inch by 7 inch paper.
645                 */
646                public static final MediaSize NA_5X7 = new MediaSize(5, 7,
647                        Size2DSyntax.INCH, MediaSizeName.NA_5X7);
648                /**
649                 * Specifies the North American 8 inch by 10 inch paper.
650                 */
651                public static final MediaSize NA_8X10 = new MediaSize(8, 10,
652                        Size2DSyntax.INCH, MediaSizeName.NA_8X10);
653                /**
654                 * Specifies the North American Number 9 business envelope size,
655                 * 3.875 inches by 8.875 inches. 
656                 */
657                public static final MediaSize NA_NUMBER_9_ENVELOPE = new MediaSize(
658                        3.875f, 8.875f, Size2DSyntax.INCH,
659                        MediaSizeName.NA_NUMBER_9_ENVELOPE);
660                /**
661                 * Specifies the North American Number 10 business envelope size,
662                 * 4.125 inches by 9.5 inches. 
663                 */
664                public static final MediaSize NA_NUMBER_10_ENVELOPE = new MediaSize(
665                        4.125f, 9.5f, Size2DSyntax.INCH,
666                        MediaSizeName.NA_NUMBER_10_ENVELOPE);
667                /**
668                 * Specifies the North American Number 11 business envelope size,
669                 * 4.5 inches by 10.375 inches. 
670                 */
671                public static final MediaSize NA_NUMBER_11_ENVELOPE = new MediaSize(
672                        4.5f, 10.375f, Size2DSyntax.INCH,
673                        MediaSizeName.NA_NUMBER_11_ENVELOPE);
674                /**
675                 * Specifies the North American Number 12 business envelope size,
676                 * 4.75 inches by 11 inches. 
677                 */
678                public static final MediaSize NA_NUMBER_12_ENVELOPE = new MediaSize(
679                        4.75f, 11.0f, Size2DSyntax.INCH,
680                        MediaSizeName.NA_NUMBER_12_ENVELOPE);
681                /**
682                 * Specifies the North American Number 14 business envelope size,
683                 * 5 inches by 11.5 inches. 
684                 */
685                public static final MediaSize NA_NUMBER_14_ENVELOPE = new MediaSize(
686                        5.0f, 11.5f, Size2DSyntax.INCH,
687                        MediaSizeName.NA_NUMBER_14_ENVELOPE);
688
689                /**
690                 * Specifies the North American 6 inch by 9 inch envelope size.
691                 */
692                public static final MediaSize NA_6X9_ENVELOPE = new MediaSize(
693                        6.0f, 9.0f, Size2DSyntax.INCH,
694                        MediaSizeName.NA_6X9_ENVELOPE);
695                /**
696                 * Specifies the North American 7 inch by 9 inch envelope size.
697                 */
698                public static final MediaSize NA_7X9_ENVELOPE = new MediaSize(
699                        7.0f, 9.0f, Size2DSyntax.INCH,
700                        MediaSizeName.NA_7X9_ENVELOPE);
701                /**
702                 * Specifies the North American 9 inch by 11 inch envelope size.
703                 */
704                public static final MediaSize NA_9x11_ENVELOPE = new MediaSize(
705                        9.0f, 11.0f, Size2DSyntax.INCH,
706                        MediaSizeName.NA_9X11_ENVELOPE);
707                /**
708                 * Specifies the North American 9 inch by 12 inch envelope size.
709                 */
710                public static final MediaSize NA_9x12_ENVELOPE = new MediaSize(
711                        9.0f, 12.0f, Size2DSyntax.INCH,
712                        MediaSizeName.NA_9X12_ENVELOPE);
713                /**
714                 * Specifies the North American 10 inch by 13 inch envelope size.
715                 */
716                public static final MediaSize NA_10x13_ENVELOPE = new MediaSize(
717                        10.0f, 13.0f, Size2DSyntax.INCH,
718                        MediaSizeName.NA_10X13_ENVELOPE);
719                /**
720                 * Specifies the North American 10 inch by 14 inch envelope size.
721                 */
722                public static final MediaSize NA_10x14_ENVELOPE = new MediaSize(
723                        10.0f, 14.0f, Size2DSyntax.INCH,
724                        MediaSizeName.NA_10X14_ENVELOPE);
725                /**
726                 * Specifies the North American 10 inch by 15 inch envelope size.
727                 */
728                public static final MediaSize NA_10X15_ENVELOPE = new MediaSize(
729                        10.0f, 15.0f, Size2DSyntax.INCH,
730                        MediaSizeName.NA_10X15_ENVELOPE);
731
732                /**
733                 * Hide all constructors.
734                 */
735                private NA() {
736                }
737            }
738
739            /**
740             * Class MediaSize.Engineering includes {@link MediaSize MediaSize} values 
741             * for engineering media. 
742             */
743            public final static class Engineering {
744
745                /**
746                 * Specifies the engineering A size, 8.5 inch by 11 inch. 
747                 */
748                public static final MediaSize A = new MediaSize(8.5f, 11.0f,
749                        Size2DSyntax.INCH, MediaSizeName.A);
750                /**
751                 * Specifies the engineering B size, 11 inch by 17 inch. 
752                 */
753                public static final MediaSize B = new MediaSize(11.0f, 17.0f,
754                        Size2DSyntax.INCH, MediaSizeName.B);
755                /**
756                 * Specifies the engineering C size, 17 inch by 22 inch. 
757                 */
758                public static final MediaSize C = new MediaSize(17.0f, 22.0f,
759                        Size2DSyntax.INCH, MediaSizeName.C);
760                /**
761                 * Specifies the engineering D size, 22 inch by 34 inch. 
762                 */
763                public static final MediaSize D = new MediaSize(22.0f, 34.0f,
764                        Size2DSyntax.INCH, MediaSizeName.D);
765                /**
766                 * Specifies the engineering E size, 34 inch by 44 inch. 
767                 */
768                public static final MediaSize E = new MediaSize(34.0f, 44.0f,
769                        Size2DSyntax.INCH, MediaSizeName.E);
770
771                /**
772                 * Hide all constructors.
773                 */
774                private Engineering() {
775                }
776            }
777
778            /**
779             * Class MediaSize.Other includes {@link MediaSize MediaSize} values for 
780             * miscellaneous media. 
781             */
782            public final static class Other {
783                /**
784                 * Specifies the executive size, 7.25 inches by 10.5 inches.
785                 */
786                public static final MediaSize EXECUTIVE = new MediaSize(7.25f,
787                        10.5f, Size2DSyntax.INCH, MediaSizeName.EXECUTIVE);
788                /**
789                 * Specifies the ledger size, 11 inches by 17 inches.
790                 */
791                public static final MediaSize LEDGER = new MediaSize(11.0f,
792                        17.0f, Size2DSyntax.INCH, MediaSizeName.LEDGER);
793
794                /**
795                 * Specifies the tabloid size, 11 inches by 17 inches.
796                 * @since 1.5
797                 */
798                public static final MediaSize TABLOID = new MediaSize(11.0f,
799                        17.0f, Size2DSyntax.INCH, MediaSizeName.TABLOID);
800
801                /**
802                 * Specifies the invoice size, 5.5 inches by 8.5 inches.
803                 */
804                public static final MediaSize INVOICE = new MediaSize(5.5f,
805                        8.5f, Size2DSyntax.INCH, MediaSizeName.INVOICE);
806                /**
807                 * Specifies the folio size, 8.5 inches by 13 inches.
808                 */
809                public static final MediaSize FOLIO = new MediaSize(8.5f,
810                        13.0f, Size2DSyntax.INCH, MediaSizeName.FOLIO);
811                /**
812                 * Specifies the quarto size, 8.5 inches by 10.83 inches.
813                 */
814                public static final MediaSize QUARTO = new MediaSize(8.5f,
815                        10.83f, Size2DSyntax.INCH, MediaSizeName.QUARTO);
816                /**
817                 * Specifies the Italy envelope size, 110 mm by 230 mm. 
818                 */
819                public static final MediaSize ITALY_ENVELOPE = new MediaSize(
820                        110, 230, Size2DSyntax.MM, MediaSizeName.ITALY_ENVELOPE);
821                /**
822                 * Specifies the Monarch envelope size, 3.87 inch by 7.5 inch. 
823                 */
824                public static final MediaSize MONARCH_ENVELOPE = new MediaSize(
825                        3.87f, 7.5f, Size2DSyntax.INCH,
826                        MediaSizeName.MONARCH_ENVELOPE);
827                /**
828                 * Specifies the Personal envelope size, 3.625 inch by 6.5 inch. 
829                 */
830                public static final MediaSize PERSONAL_ENVELOPE = new MediaSize(
831                        3.625f, 6.5f, Size2DSyntax.INCH,
832                        MediaSizeName.PERSONAL_ENVELOPE);
833                /**
834                 * Specifies the Japanese postcard size, 100 mm by 148 mm. 
835                 */
836                public static final MediaSize JAPANESE_POSTCARD = new MediaSize(
837                        100, 148, Size2DSyntax.MM,
838                        MediaSizeName.JAPANESE_POSTCARD);
839                /**
840                 * Specifies the Japanese Double postcard size, 148 mm by 200 mm. 
841                 */
842                public static final MediaSize JAPANESE_DOUBLE_POSTCARD = new MediaSize(
843                        148, 200, Size2DSyntax.MM,
844                        MediaSizeName.JAPANESE_DOUBLE_POSTCARD);
845
846                /**
847                 * Hide all constructors.
848                 */
849                private Other() {
850                }
851            }
852
853            /* force loading of all the subclasses so that the instances
854             * are created and inserted into the hashmap.
855             */
856            static {
857                MediaSize ISOA4 = ISO.A4;
858                MediaSize JISB5 = JIS.B5;
859                MediaSize NALETTER = NA.LETTER;
860                MediaSize EngineeringC = Engineering.C;
861                MediaSize OtherEXECUTIVE = Other.EXECUTIVE;
862            }
863        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.