ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/DBReporter/IndexMaker.java
(Generate patch)

Comparing projects/cms/source/reports/DBReporter/IndexMaker.java (file contents):
Revision 1.5 by pjm2, Mon Jan 8 10:27:21 2001 UTC vs.
Revision 1.6 by pjm2, Thu Jan 11 19:03:04 2001 UTC

# Line 1 | Line 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 < * @author  $Author$
12 < * @version $Id$
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$";
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 < }
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$
22  
23 + * @version $Id$
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$";
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines