ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/DBReporter/IndexMaker.java
Revision: 1.6
Committed: Thu Jan 11 19:03:04 2001 UTC (24 years, 11 months ago) by pjm2
Branch: MAIN
Changes since 1.5: +102 -102 lines
Log Message:
Working on the 4th level index page generation.

File Contents

# Content
1 //---PACKAGE DECLARATION---
2
3
4
5 //---IMPORTS---
6
7 import java.io.*;
8
9 import java.util.*;
10
11
12
13
14
15 /**
16
17 * Produces an SHTML index. This class should be extended.
18
19 *
20
21 * @author $Author: pjm2 $
22
23 * @version $Id: IndexMaker.java,v 1.5 2001/01/08 10:27:21 pjm2 Exp $
24
25 */
26
27 public class IndexMaker {
28
29
30
31 //---FINAL ATTRIBUTES---
32
33
34
35 /**
36
37 * The current CVS revision of this class
38
39 */
40
41 public final String REVISION = "$Revision: 1.5 $";
42
43
44
45 private final String _metaDescription = "";
46
47 private final String _metaKeywords = "";
48
49
50
51 //---STATIC METHODS---
52
53
54
55 //---CONSTRUCTORS---
56
57
58
59 public IndexMaker(LinkedList pages, String title){
60
61
62
63 _title = title;
64
65
66
67 Iterator it = pages.iterator();
68
69 while (it.hasNext()){
70
71 ReportPage rp = (ReportPage)it.next();
72
73 _filtered.add(rp);
74
75 }
76
77
78
79 }
80
81
82
83 //---PUBLIC METHODS---
84
85
86
87 public void writePage(String filename) throws IOException{
88
89
90
91 BufferedWriter bw = null;
92
93 try {
94
95 bw = new BufferedWriter(new FileWriter(filename));
96
97 }
98
99 catch (IOException e){
100
101 System.out.println("Could not write to the SHTML page: "+e);
102
103 }
104
105
106
107 // Use the layout functions in SHTMLLayout...
108
109
110
111 IscreamLayout.printDocType(bw);
112
113
114
115 IscreamLayout.printHeader(bw, _title, _metaDescription, _metaKeywords);
116
117
118
119 IscreamLayout.printLeftMenu(bw);
120
121
122
123 IscreamLayout.printTitle(bw, _title);
124
125
126
127 //IscreamLayout.printMachines(bw, _filtered);
128
129 makeCustomContents(bw, _filtered);
130
131
132
133 IscreamLayout.printBottom(bw);
134
135
136
137 bw.flush();
138
139 bw.close();
140
141
142
143 System.out.println("Written SHTML Index page");
144
145
146
147 }
148
149
150
151 /**
152
153 * Overrides the {@link java.lang.Object#toString() Object.toString()}
154
155 * method to provide clean logging (every class should have this).
156
157 *
158
159 * @return the name of this class and its CVS revision
160
161 */
162
163 public String toString() {
164
165 return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
166
167 }
168
169
170
171 //---PRIVATE METHODS---
172
173
174
175 // Override this method for customised index pages.
176
177 private static void makeCustomContents(BufferedWriter bw, LinkedList list) throws IOException{
178
179 IscreamLayout.printAllMachines(bw, list);
180
181 }
182
183
184
185 //---ACCESSOR/MUTATOR METHODS---
186
187
188
189 //---ATTRIBUTES---
190
191
192
193 private LinkedList _filtered = new LinkedList();
194
195 private String _title;
196
197
198
199 //---STATIC ATTRIBUTES---
200
201
202
203 }
204