OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [java/] [awt/] [print/] [Book.java] - Blame information for rev 771

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 771 jeremybenn
/* Book.java -- A mixed group of pages to print.
2
   Copyright (C) 1999, 2004  Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package java.awt.print;
40
 
41
import java.util.Vector;
42
 
43
/**
44
 * This class allows documents to be created with different paper types,
45
 * page formatters, and painters.
46
 *
47
 * @author Aaron M. Renn (arenn@urbanophile.com)
48
 */
49
public class Book implements Pageable
50
{
51
  /**
52
   * Painter objects for the book.
53
   */
54
  Vector printables = new Vector();
55
 
56
  /**
57
   * Page formats for the book.
58
   */
59
  Vector page_formats = new Vector();
60
 
61
  /**
62
   * Initializes a new instance of <code>Book</code> that is empty.
63
   */
64
  public Book()
65
  {
66
  }
67
 
68
  /**
69
   * Returns the number of pages in this book.
70
   *
71
   * @return The number of pages in this book.
72
   */
73
  public int getNumberOfPages()
74
  {
75
    return printables.size();
76
  }
77
 
78
  /**
79
   * This method returns the <code>PageFormat</code> object for the
80
   * specified page.
81
   *
82
   * @param page_number The number of the page to get information for, where
83
   * page numbers start at 0.
84
   *
85
   * @return The <code>PageFormat</code> object for the specified page.
86
   *
87
   * @exception IndexOutOfBoundsException If the page number is not valid.
88
   */
89
  public PageFormat getPageFormat(int page_number)
90
  {
91
    return (PageFormat) page_formats.elementAt(page_number);
92
  }
93
 
94
  /**
95
   * This method returns the <code>Printable</code> object for the
96
   * specified page.
97
   *
98
   * @param page_number The number of the page to get information for, where
99
   * page numbers start at 0.
100
   *
101
   * @return The <code>Printable</code> object for the specified page.
102
   *
103
   * @exception IndexOutOfBoundsException If the page number is not valid.
104
   */
105
  public Printable getPrintable(int page_number)
106
  {
107
    return (Printable) printables.elementAt(page_number);
108
  }
109
 
110
  /**
111
   * This method appends a page to the end of the book.
112
   *
113
   * @param printable The <code>Printable</code> for this page.
114
   * @param page_format The <code>PageFormat</code> for this page.
115
   *
116
   * @exception NullPointerException If either argument is <code>null</code>.
117
   */
118
  public void append(Printable printable, PageFormat page_format)
119
  {
120
    append(printable, page_format, 1);
121
  }
122
 
123
  /**
124
   * This method appends the specified number of pages to the end of the book.
125
   * Each one will be associated with the specified <code>Printable</code>
126
   * and <code>PageFormat</code>.
127
   *
128
   * @param printable The <code>Printable</code> for this page.
129
   * @param page_format The <code>PageFormat</code> for this page.
130
   * @param num_pages The number of pages to append.
131
   *
132
   * @exception NullPointerException If any argument is <code>null</code>.
133
   */
134
  public void append(Printable printable, PageFormat page_format, int num_pages)
135
  {
136
    for (int i = 0; i < num_pages; i++)
137
      {
138
        printables.addElement(printable);
139
        page_formats.addElement(page_format);
140
      }
141
  }
142
 
143
  /**
144
   * This method changes the <code>Printable</code> and <code>PageFormat</code>
145
   * for the specified page.  The page must already exist or an exception
146
   * will be thrown.
147
   *
148
   * @param page_num The page number to alter.
149
   * @param printable The new <code>Printable</code> for the page.
150
   * @param page_format The new <code>PageFormat</code> for the page.
151
   *
152
   * @throws IndexOutOfBoundsException If the specified page does not exist.
153
   */
154
  public void setPage(int page_num, Printable printable, PageFormat page_format)
155
  {
156
    printables.setElementAt(printable, page_num);
157
    page_formats.setElementAt(page_format, page_num);
158
  }
159
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.