1 /* 2 * Copyright (c) 1998, 2000, 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 23 * questions. 24 */ 25 26 package java.awt.print; 27 28 import javax.tools.annotation.GenerateNativeHeader; 29 30 /** 31 * The <code>Pageable</code> implementation represents a set of 32 * pages to be printed. The <code>Pageable</code> object returns 33 * the total number of pages in the set as well as the 34 * {@link PageFormat} and {@link Printable} for a specified page. 35 * @see java.awt.print.PageFormat 36 * @see java.awt.print.Printable 37 */ 38 /* No native methods here, but the constants are needed in the supporting JNI code */ 39 @GenerateNativeHeader 40 public interface Pageable { 41 42 /** 43 * This constant is returned from the 44 * {@link #getNumberOfPages() getNumberOfPages} 45 * method if a <code>Pageable</code> implementation does not know 46 * the number of pages in its set. 47 */ 48 int UNKNOWN_NUMBER_OF_PAGES = -1; 49 50 /** 51 * Returns the number of pages in the set. 52 * To enable advanced printing features, 53 * it is recommended that <code>Pageable</code> 54 * implementations return the true number of pages 55 * rather than the 56 * UNKNOWN_NUMBER_OF_PAGES constant. 57 * @return the number of pages in this <code>Pageable</code>. 58 */ 59 int getNumberOfPages(); 60 61 /** 62 * Returns the <code>PageFormat</code> of the page specified by 63 * <code>pageIndex</code>. 64 * @param pageIndex the zero based index of the page whose 65 * <code>PageFormat</code> is being requested 66 * @return the <code>PageFormat</code> describing the size and 67 * orientation. 68 * @throws IndexOutOfBoundsException if | 1 /* 2 * Copyright (c) 1998, 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 23 * questions. 24 */ 25 26 package java.awt.print; 27 28 import java.lang.annotation.Native; 29 30 /** 31 * The <code>Pageable</code> implementation represents a set of 32 * pages to be printed. The <code>Pageable</code> object returns 33 * the total number of pages in the set as well as the 34 * {@link PageFormat} and {@link Printable} for a specified page. 35 * @see java.awt.print.PageFormat 36 * @see java.awt.print.Printable 37 */ 38 public interface Pageable { 39 40 /** 41 * This constant is returned from the 42 * {@link #getNumberOfPages() getNumberOfPages} 43 * method if a <code>Pageable</code> implementation does not know 44 * the number of pages in its set. 45 */ 46 @Native int UNKNOWN_NUMBER_OF_PAGES = -1; 47 48 /** 49 * Returns the number of pages in the set. 50 * To enable advanced printing features, 51 * it is recommended that <code>Pageable</code> 52 * implementations return the true number of pages 53 * rather than the 54 * UNKNOWN_NUMBER_OF_PAGES constant. 55 * @return the number of pages in this <code>Pageable</code>. 56 */ 57 int getNumberOfPages(); 58 59 /** 60 * Returns the <code>PageFormat</code> of the page specified by 61 * <code>pageIndex</code>. 62 * @param pageIndex the zero based index of the page whose 63 * <code>PageFormat</code> is being requested 64 * @return the <code>PageFormat</code> describing the size and 65 * orientation. 66 * @throws IndexOutOfBoundsException if |