1 /* 2 * @(#)Pageable.java 1.14 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.awt.print; 9 10 /** 11 * The <code>Pageable</code> implementation represents a set of 12 * pages to be printed. The <code>Pageable</code> object returns 13 * the total number of pages in the set as well as the 14 * {@link PageFormat} and {@link Printable} for a specified page. 15 * @see java.awt.print.PageFormat 16 * @see java.awt.print.Printable 17 */ 18 public interface Pageable { 19 20 /** 21 * This constant is returned from the 22 * {@link #getNumberOfPages() getNumberOfPages} 23 * method if a <code>Pageable</code> implementation does not know 24 * the number of pages in its set. 25 */ 26 int UNKNOWN_NUMBER_OF_PAGES = -1; 27 28 /** 29 * Returns the number of pages in the set. 30 * To enable advanced printing features, 31 * it is recommended that <code>Pageable</code> 32 * implementations return the true number of pages 33 * rather than the 34 * UNKNOWN_NUMBER_OF_PAGES constant. 35 * @return the number of pages in this <code>Pageable</code>. 36 */ 37 int getNumberOfPages(); 38 39 /** 40 * Returns the <code>PageFormat</code> of the page specified by 41 * <code>pageIndex</code>. 42 * @param pageIndex the zero based index of the page whose 43 * <code>PageFormat</code> is being requested 44 * @return the <code>PageFormat</code> describing the size and 45 * orientation. 46 * @throws IndexOutOfBoundsException if 47 * the <code>Pageable</code> does not contain the requested 48 * page. 49 */ 50 PageFormat getPageFormat(int pageIndex) 51 throws IndexOutOfBoundsException; 52 53 /** 54 * Returns the <code>Printable</code> instance responsible for 55 * rendering the page specified by <code>pageIndex</code>. 56 * @param pageIndex the zero based index of the page whose 57 * <code>Printable</code> is being requested 58 * @return the <code>Printable</code> that renders the page. 59 * @throws IndexOutOfBoundsException if 60 * the <code>Pageable</code> does not contain the requested 61 * page. 62 */ 63 Printable getPrintable(int pageIndex) 64 throws IndexOutOfBoundsException; 65 } 66 67