57 58 /** 59 * Create a Pageable with an unknown number of pages 60 * where every page shares the same format and 61 * Printable. 62 */ 63 OpenBook(PageFormat format, Printable painter) { 64 mFormat = format; 65 mPainter = painter; 66 } 67 68 /** 69 * This object does not know the number of pages. 70 */ 71 public int getNumberOfPages(){ 72 return UNKNOWN_NUMBER_OF_PAGES; 73 } 74 75 /** 76 * Return the PageFormat of the page specified by 'pageIndex'. 77 * @param int The zero based index of the page whose 78 * PageFormat is being requested. 79 * @return The PageFormat describing the size and orientation 80 */ 81 public PageFormat getPageFormat(int pageIndex) { 82 return mFormat; 83 } 84 85 /** 86 * Return the Printable instance responsible for rendering 87 * the page specified by 'pageIndex'. 88 * @param int The zero based index of the page whose 89 * Printable is being requested. 90 * @return The Printable that will draw the page. 91 */ 92 public Printable getPrintable(int pageIndex) 93 throws IndexOutOfBoundsException 94 { 95 return mPainter; 96 } 97 } | 57 58 /** 59 * Create a Pageable with an unknown number of pages 60 * where every page shares the same format and 61 * Printable. 62 */ 63 OpenBook(PageFormat format, Printable painter) { 64 mFormat = format; 65 mPainter = painter; 66 } 67 68 /** 69 * This object does not know the number of pages. 70 */ 71 public int getNumberOfPages(){ 72 return UNKNOWN_NUMBER_OF_PAGES; 73 } 74 75 /** 76 * Return the PageFormat of the page specified by 'pageIndex'. 77 * @param pageIndex The zero based index of the page whose 78 * PageFormat is being requested. 79 * @return The PageFormat describing the size and orientation 80 */ 81 public PageFormat getPageFormat(int pageIndex) { 82 return mFormat; 83 } 84 85 /** 86 * Return the Printable instance responsible for rendering 87 * the page specified by 'pageIndex'. 88 * @param pageIndex The zero based index of the page whose 89 * Printable is being requested. 90 * @return The Printable that will draw the page. 91 */ 92 public Printable getPrintable(int pageIndex) 93 throws IndexOutOfBoundsException 94 { 95 return mPainter; 96 } 97 } |