ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/DBReporter/IndexMaker.java
Revision: 1.5
Committed: Mon Jan 8 10:27:21 2001 UTC (24 years, 11 months ago) by pjm2
Branch: MAIN
Changes since 1.4: +3 -3 lines
Log Message:
The report of all machines now includes the time as well as the machine
name.

File Contents

# Content
1 //---PACKAGE DECLARATION---
2
3 //---IMPORTS---
4 import java.io.*;
5 import java.util.*;
6
7
8 /**
9 * Produces an SHTML index. This class should be extended.
10 *
11 * @author $Author: pjm2 $
12 * @version $Id: IndexMaker.java,v 1.4 2001/01/08 10:23:06 pjm2 Exp $
13 */
14 public class IndexMaker {
15
16 //---FINAL ATTRIBUTES---
17
18 /**
19 * The current CVS revision of this class
20 */
21 public final String REVISION = "$Revision: 1.4 $";
22
23 private final String _metaDescription = "";
24 private final String _metaKeywords = "";
25
26 //---STATIC METHODS---
27
28 //---CONSTRUCTORS---
29
30 public IndexMaker(LinkedList pages, String title){
31
32 _title = title;
33
34 Iterator it = pages.iterator();
35 while (it.hasNext()){
36 ReportPage rp = (ReportPage)it.next();
37 _filtered.add(rp);
38 }
39
40 }
41
42 //---PUBLIC METHODS---
43
44 public void writePage(String filename) throws IOException{
45
46 BufferedWriter bw = null;
47 try {
48 bw = new BufferedWriter(new FileWriter(filename));
49 }
50 catch (IOException e){
51 System.out.println("Could not write to the SHTML page: "+e);
52 }
53
54 // Use the layout functions in SHTMLLayout...
55
56 IscreamLayout.printDocType(bw);
57
58 IscreamLayout.printHeader(bw, _title, _metaDescription, _metaKeywords);
59
60 IscreamLayout.printLeftMenu(bw);
61
62 IscreamLayout.printTitle(bw, _title);
63
64 //IscreamLayout.printMachines(bw, _filtered);
65 makeCustomContents(bw, _filtered);
66
67 IscreamLayout.printBottom(bw);
68
69 bw.flush();
70 bw.close();
71
72 System.out.println("Written SHTML Index page");
73
74 }
75
76 /**
77 * Overrides the {@link java.lang.Object#toString() Object.toString()}
78 * method to provide clean logging (every class should have this).
79 *
80 * @return the name of this class and its CVS revision
81 */
82 public String toString() {
83 return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
84 }
85
86 //---PRIVATE METHODS---
87
88 // Override this method for customised index pages.
89 private static void makeCustomContents(BufferedWriter bw, LinkedList list) throws IOException{
90 IscreamLayout.printAllMachines(bw, list);
91 }
92
93 //---ACCESSOR/MUTATOR METHODS---
94
95 //---ATTRIBUTES---
96
97 private LinkedList _filtered = new LinkedList();
98 private String _title;
99
100 //---STATIC ATTRIBUTES---
101
102 }