01 /*
02 * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package java.awt.print;
27
28 /**
29 * The <code>Pageable</code> implementation represents a set of
30 * pages to be printed. The <code>Pageable</code> object returns
31 * the total number of pages in the set as well as the
32 * {@link PageFormat} and {@link Printable} for a specified page.
33 * @see java.awt.print.PageFormat
34 * @see java.awt.print.Printable
35 */
36 public interface Pageable {
37
38 /**
39 * This constant is returned from the
40 * {@link #getNumberOfPages() getNumberOfPages}
41 * method if a <code>Pageable</code> implementation does not know
42 * the number of pages in its set.
43 */
44 int UNKNOWN_NUMBER_OF_PAGES = -1;
45
46 /**
47 * Returns the number of pages in the set.
48 * To enable advanced printing features,
49 * it is recommended that <code>Pageable</code>
50 * implementations return the true number of pages
51 * rather than the
52 * UNKNOWN_NUMBER_OF_PAGES constant.
53 * @return the number of pages in this <code>Pageable</code>.
54 */
55 int getNumberOfPages();
56
57 /**
58 * Returns the <code>PageFormat</code> of the page specified by
59 * <code>pageIndex</code>.
60 * @param pageIndex the zero based index of the page whose
61 * <code>PageFormat</code> is being requested
62 * @return the <code>PageFormat</code> describing the size and
63 * orientation.
64 * @throws IndexOutOfBoundsException if
65 * the <code>Pageable</code> does not contain the requested
66 * page.
67 */
68 PageFormat getPageFormat(int pageIndex)
69 throws IndexOutOfBoundsException;
70
71 /**
72 * Returns the <code>Printable</code> instance responsible for
73 * rendering the page specified by <code>pageIndex</code>.
74 * @param pageIndex the zero based index of the page whose
75 * <code>Printable</code> is being requested
76 * @return the <code>Printable</code> that renders the page.
77 * @throws IndexOutOfBoundsException if
78 * the <code>Pageable</code> does not contain the requested
79 * page.
80 */
81 Printable getPrintable(int pageIndex)
82 throws IndexOutOfBoundsException;
83 }
|