1. /*
  2. * @(#)Pageable.java 1.9 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.awt.print;
  11. /**
  12. * The <code>Pageable</code> implementation represents a set of
  13. * pages to be printed. The <code>Pageable</code> object returns
  14. * the total number of pages in the set as well as the
  15. * {@link PageFormat} and {@link Printable} for a specified page.
  16. * @see java.awt.print.PageFormat
  17. * @see java.awt.print.Printable
  18. */
  19. public interface Pageable {
  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. * Returns the number of pages in the set.
  29. * To enable advanced printing features,
  30. * it is recommended that <code>Pageable</code>
  31. * implementations return the true number of pages
  32. * rather than the
  33. * UNKNOWN_NUMBER_OF_PAGES constant.
  34. * @return the number of pages in this <code>Pageable</code>.
  35. */
  36. int getNumberOfPages();
  37. /**
  38. * Returns the <code>PageFormat</code> of the page specified by
  39. * <code>pageIndex</code>.
  40. * @param pageIndex the zero based index of the page whose
  41. * <code>PageFormat</code> is being requested
  42. * @return the <code>PageFormat</code> describing the size and
  43. * orientation.
  44. * @exception <code>IndexOutOfBoundsException</code>
  45. * the <code>Pageable</code> does not contain the requested
  46. * page.
  47. */
  48. PageFormat getPageFormat(int pageIndex)
  49. throws IndexOutOfBoundsException;
  50. /**
  51. * Returns the <code>Printable</code> instance responsible for
  52. * rendering the page specified by <code>pageIndex</code>.
  53. * @param pageIndex the zero based index of the page whose
  54. * <code>Printable</code> is being requested
  55. * @return the <code>Printable</code> that renders the page.
  56. * @exception <code>IndexOutOfBoundsException</code>
  57. * the <code>Pageable</code> does not contain the requested
  58. * page.
  59. */
  60. Printable getPrintable(int pageIndex)
  61. throws IndexOutOfBoundsException;
  62. }