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
  67      *          the <code>Pageable</code> does not contain the requested
  68      *          page.
  69      */
  70     PageFormat getPageFormat(int pageIndex)
  71         throws IndexOutOfBoundsException;
  72 
  73     /**
  74      * Returns the <code>Printable</code> instance responsible for
  75      * rendering the page specified by <code>pageIndex</code>.
  76      * @param pageIndex the zero based index of the page whose
  77      *            <code>Printable</code> is being requested
  78      * @return the <code>Printable</code> that renders the page.
  79      * @throws IndexOutOfBoundsException if
  80      *            the <code>Pageable</code> does not contain the requested
  81      *            page.
  82      */
  83     Printable getPrintable(int pageIndex)
  84         throws IndexOutOfBoundsException;
  85 }
--- EOF ---