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