KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lowagie > text > rtf > RtfHeaderFooters


1 /**
2  * $Id: RtfHeaderFooters.java 2356 2006-09-12 13:12:56Z blowagie $
3  *
4  * Copyright 2002 by
5  * <a HREF="http://www.smb-tec.com">SMB</a>
6  * Steffen.Stundzig (Steffen.Stundzig@smb-tec.com)
7  *
8  * The contents of this file are subject to the Mozilla Public License Version 1.1
9  * (the "License"); you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the License.
15  *
16  * The Original Code is 'iText, a free JAVA-PDF library'.
17  *
18  * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
19  * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
20  * All Rights Reserved.
21  * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
22  * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
23  *
24  * Contributor(s): all the names of the contributors are added in the source code
25  * where applicable.
26  *
27  * Alternatively, the contents of this file may be used under the terms of the
28  * LGPL license (the ?GNU LIBRARY GENERAL PUBLIC LICENSE?), in which case the
29  * provisions of LGPL are applicable instead of those above. If you wish to
30  * allow use of your version of this file only under the terms of the LGPL
31  * License and not to allow others to use your version of this file under
32  * the MPL, indicate your decision by deleting the provisions above and
33  * replace them with the notice and other provisions required by the LGPL.
34  * If you do not delete the provisions above, a recipient may use your version
35  * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
36  *
37  * This library is free software; you can redistribute it and/or modify it
38  * under the terms of the MPL as stated above or under the terms of the GNU
39  * Library General Public License as published by the Free Software Foundation;
40  * either version 2 of the License, or any later version.
41  *
42  * This library is distributed in the hope that it will be useful, but WITHOUT
43  * ANY WARRANTY; without right the implied warranty of MERCHANTABILITY or FITNESS
44  * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
45  * details.
46  *
47  * If you didn't download this code from the following link, you should check if
48  * you aren't using an obsolete version:
49  * http://www.lowagie.com/iText/
50  */

51
52 package com.lowagie.text.rtf;
53
54 import com.lowagie.text.HeaderFooter;
55 import com.lowagie.text.Phrase;
56
57
58 /**
59  * This HeaderFooter specialization contains some headers or footers for several
60  * pages. Is a list of headerFooters but also a sub class of header footer, to change
61  * as less as possible of the current API.
62  *
63  * ONLY FOR USE WITH THE RtfWriter NOT with the RtfWriter2.
64  *
65  * This class is based on the RtfWriter-package from Mark Hall.
66  * @author Steffen.Stundzig (Steffen.Stundzig@smb-tec.com)
67  * @author Mark Hall (mhall@edu.uni-klu.ac.at)
68  * @version $Revision: 2356 $Date: 2006/09/12 12:16:35 $
69  * @deprecated Please move to the RtfWriter2 and associated classes. com.lowagie.text.rtf.headerfooter.RtfHeaderFooterGroup replaces the functionality of this class.
70  */

71 public class RtfHeaderFooters extends HeaderFooter {
72     /** an attribute value */
73     public final static int ALL_PAGES = 0;
74     /** an attribute value */
75     public final static int LEFT_PAGES = 1;
76     /** an attribute value */
77     public final static int RIGHT_PAGES = 2;
78     /** an attribute value */
79     public final static int FIRST_PAGE = 3;
80     
81 // public int defaultHeader = ALL_PAGES;
82

83     /** header or footer placeholder */
84     private HeaderFooter allPages = null;
85     /** header or footer placeholder */
86     private HeaderFooter leftPages = null;
87     /** header or footer placeholder */
88     private HeaderFooter rightPages = null;
89     /** header or footer placeholder */
90     private HeaderFooter firstPage = null;
91
92     /**
93      * Contructs a HeaderFooters object
94      */

95     public RtfHeaderFooters() {
96         super( new Phrase(""), false );
97     }
98
99     /**
100      * Contructs a HeaderFooters object
101      * @param before
102      * @param after
103      */

104     public RtfHeaderFooters( Phrase before, Phrase after ) {
105         super( before, after );
106     }
107
108     /**
109      * Contructs a HeaderFooters object
110      * @param before
111      * @param numbered
112      */

113     public RtfHeaderFooters( Phrase before, boolean numbered ) {
114         super( before, numbered );
115     }
116
117     /**
118      * Adds a HeaderFooter to this HeaderFooters object
119      * @param type
120      * @param hf
121      */

122     public void set( int type, HeaderFooter hf ) {
123         switch (type) {
124             case ALL_PAGES:
125                 allPages = hf;
126                 break;
127             case LEFT_PAGES:
128                 leftPages = hf;
129                 break;
130             case RIGHT_PAGES:
131                 rightPages = hf;
132                 break;
133             case FIRST_PAGE:
134                 firstPage = hf;
135                 break;
136             default:
137                 throw new IllegalStateException JavaDoc( "unknown type " + type );
138         }
139     }
140
141     /**
142      * Returns a type of HeaderFooter object registered in this HeaderFooters object.
143      * @param type type of the HeaderFooter object
144      * @return a HeaderFooter object
145      */

146     public HeaderFooter get( int type ) {
147         switch (type) {
148             case ALL_PAGES:
149                 return allPages;
150             case LEFT_PAGES:
151                 return leftPages;
152             case RIGHT_PAGES:
153                 return rightPages;
154             case FIRST_PAGE:
155                 return firstPage;
156             default:
157                 throw new IllegalStateException JavaDoc( "unknown type " + type );
158         }
159     }
160 }
161
Popular Tags