| 1 |
//---PACKAGE DECLARATION--- |
| 2 |
|
| 3 |
//---IMPORTS--- |
| 4 |
import java.io.*; |
| 5 |
|
| 6 |
|
| 7 |
/** |
| 8 |
* Produces an SHTML document. |
| 9 |
* |
| 10 |
* @author $Author: pjm2 $ |
| 11 |
* @version $Id: SHTMLMaker.java,v 1.12 2001/01/11 19:03:04 pjm2 Exp $ |
| 12 |
*/ |
| 13 |
public class SHTMLWriter { |
| 14 |
|
| 15 |
//---FINAL ATTRIBUTES--- |
| 16 |
|
| 17 |
/** |
| 18 |
* The current CVS revision of this class |
| 19 |
*/ |
| 20 |
public final String REVISION = "$Revision: 1.12 $"; |
| 21 |
|
| 22 |
//---STATIC METHODS--- |
| 23 |
|
| 24 |
//---CONSTRUCTORS--- |
| 25 |
|
| 26 |
public SHTMLWriter(String metaDescription, String metaKeywords, String friendlyName, String graphFile, long startDate, long endDate){ |
| 27 |
_friendlyName = friendlyName; |
| 28 |
_graphFile = graphFile; |
| 29 |
_startDate = startDate; |
| 30 |
_endDate = endDate; |
| 31 |
} |
| 32 |
|
| 33 |
public void writePage(String filename) throws IOException{ |
| 34 |
|
| 35 |
BufferedWriter bw = new BufferedWriter(new FileWriter(filename)); |
| 36 |
|
| 37 |
// Use the layout functions in SHTMLLayout... |
| 38 |
|
| 39 |
SHTMLLayout.printDocType(bw); |
| 40 |
|
| 41 |
SHTMLLayout.printHeader(bw, "title", "meta", "meta"); |
| 42 |
|
| 43 |
SHTMLLayout.printLeftMenu(bw); |
| 44 |
|
| 45 |
SHTMLLayout.printTitle(bw, _friendlyName); |
| 46 |
|
| 47 |
SHTMLLayout.printGraph(bw, _graphFile, SHTMLLayout.CHART_WIDTH, SHTMLLayout.CHART_HEIGHT, _startDate, _endDate); |
| 48 |
|
| 49 |
SHTMLLayout.printBottom(bw); |
| 50 |
|
| 51 |
bw.flush(); |
| 52 |
bw.close(); |
| 53 |
|
| 54 |
System.out.println(" - Written SHTML page"); |
| 55 |
|
| 56 |
} |
| 57 |
|
| 58 |
//---PUBLIC METHODS--- |
| 59 |
|
| 60 |
|
| 61 |
/** |
| 62 |
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
| 63 |
* method to provide clean logging (every class should have this). |
| 64 |
* |
| 65 |
* @return the name of this class and its CVS revision |
| 66 |
*/ |
| 67 |
public String toString() { |
| 68 |
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
| 69 |
} |
| 70 |
|
| 71 |
//---PRIVATE METHODS--- |
| 72 |
|
| 73 |
//---ACCESSOR/MUTATOR METHODS--- |
| 74 |
|
| 75 |
//---ATTRIBUTES--- |
| 76 |
|
| 77 |
private String _friendlyName; |
| 78 |
private String _graphFile; |
| 79 |
private long _startDate; |
| 80 |
private long _endDate; |
| 81 |
|
| 82 |
//---STATIC ATTRIBUTES--- |
| 83 |
|
| 84 |
} |