ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/DBReporter/IndexMaker.java
Revision: 1.4
Committed: Mon Jan 8 10:23:06 2001 UTC (24 years, 11 months ago) by pjm2
Branch: MAIN
Changes since 1.3: +13 -8 lines
Log Message:
IndexMaker now provides an overrideable method for customising which
reports are show (and how).

File Contents

# User Rev Content
1 pjm2 1.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 pjm2 1.4 * @author $Author: pjm2 $
12     * @version $Id: IndexMaker.java,v 1.3 2001/01/07 20:03:33 pjm2 Exp $
13 pjm2 1.1 */
14     public class IndexMaker {
15    
16     //---FINAL ATTRIBUTES---
17    
18     /**
19     * The current CVS revision of this class
20     */
21 pjm2 1.4 public final String REVISION = "$Revision: 1.3 $";
22 pjm2 1.1
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 pjm2 1.4 //---PUBLIC METHODS---
43    
44 pjm2 1.1 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 pjm2 1.4 //IscreamLayout.printMachines(bw, _filtered);
65     makeCustomContents(bw, _filtered);
66 pjm2 1.1
67     IscreamLayout.printBottom(bw);
68    
69     bw.flush();
70     bw.close();
71    
72 pjm2 1.4 System.out.println("Written SHTML Index page");
73 pjm2 1.1
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 pjm2 1.4
88     // Override this method for customised index pages.
89     private static void makeCustomContents(BufferedWriter bw, LinkedList list) throws IOException{
90     IscreamLayout.printMachines(bw, list);
91     }
92 pjm2 1.1
93     //---ACCESSOR/MUTATOR METHODS---
94    
95     //---ATTRIBUTES---
96    
97 pjm2 1.2 private LinkedList _filtered = new LinkedList();
98 pjm2 1.1 private String _title;
99    
100     //---STATIC ATTRIBUTES---
101    
102     }