KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > area > PageSequence


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 /* $Id$ */
19
20 package org.apache.fop.area;
21
22 import java.util.List JavaDoc;
23
24 /**
25  * Represents a page sequence in the area tree.
26  */

27 public class PageSequence {
28
29     private List JavaDoc pages = new java.util.ArrayList JavaDoc();
30     private LineArea title;
31     
32     /**
33      * Main constructor
34      * @param title the title for the page-sequence, may be null
35      */

36     public PageSequence(LineArea title) {
37         this.title = title;
38     }
39     
40     /**
41      * @return the title of the page sequence in form of a line area, or null if there's no title
42      */

43     public LineArea getTitle() {
44         return this.title;
45     }
46     
47     /**
48      * Adds a new page to the page sequence
49      * @param page the page to be added
50      */

51     public void addPage(PageViewport page) {
52         this.pages.add(page);
53     }
54     
55     /**
56      * @return the number of pages currently in this page sequence
57      */

58     public int getPageCount() {
59         return this.pages.size();
60     }
61
62     /**
63      * Returns the page at the given index.
64      * @param idx the index of the requested page
65      * @return the requested page or null if it was not found
66      */

67     public PageViewport getPage(int idx) {
68         return (PageViewport)this.pages.get(idx);
69     }
70     
71     /**
72      * Indicates whether a page is the first in this page sequence.
73      * @param page the page to be inspected
74      * @return true if the page is the first in this page sequence, false otherwise
75      */

76     public boolean isFirstPage(PageViewport page) {
77         return page.equals(getPage(0));
78     }
79 }
80
Popular Tags