| 1 |
pjm2 |
1.1 |
//---PACKAGE DECLARATION--- |
| 2 |
|
|
|
| 3 |
|
|
//---IMPORTS--- |
| 4 |
|
|
import java.io.*; |
| 5 |
|
|
|
| 6 |
|
|
|
| 7 |
|
|
/** |
| 8 |
pjm2 |
1.2 |
* Produces an SHTML document. |
| 9 |
pjm2 |
1.1 |
* |
| 10 |
|
|
* @author $Author: pjm2 $ |
| 11 |
pjm2 |
1.3 |
* @version $Id: SHTMLMaker.java,v 1.2 2000/12/11 16:42:04 pjm2 Exp $ |
| 12 |
pjm2 |
1.1 |
*/ |
| 13 |
|
|
public class SHTMLMaker { |
| 14 |
|
|
|
| 15 |
|
|
//---FINAL ATTRIBUTES--- |
| 16 |
|
|
|
| 17 |
|
|
/** |
| 18 |
|
|
* The current CVS revision of this class |
| 19 |
|
|
*/ |
| 20 |
pjm2 |
1.3 |
public final String REVISION = "$Revision: 1.2 $"; |
| 21 |
pjm2 |
1.1 |
|
| 22 |
|
|
//---STATIC METHODS--- |
| 23 |
|
|
|
| 24 |
|
|
//---CONSTRUCTORS--- |
| 25 |
|
|
|
| 26 |
|
|
public SHTMLMaker(String metaDescription, String metaKeywords, String title, String graphFile, int width, int height, PlotData pd){ |
| 27 |
|
|
|
| 28 |
|
|
_metaDescription = metaDescription; |
| 29 |
|
|
_metaKeywords = metaKeywords; |
| 30 |
|
|
_title = title; |
| 31 |
|
|
_graphFile = graphFile; |
| 32 |
|
|
_width = width; |
| 33 |
|
|
_height = height; |
| 34 |
|
|
_pd = pd; |
| 35 |
|
|
|
| 36 |
pjm2 |
1.3 |
} |
| 37 |
pjm2 |
1.1 |
|
| 38 |
|
|
public void writePage(String filename) throws IOException{ |
| 39 |
|
|
|
| 40 |
|
|
BufferedWriter bw = null; |
| 41 |
|
|
try { |
| 42 |
|
|
bw = new BufferedWriter(new FileWriter(filename)); |
| 43 |
|
|
} |
| 44 |
|
|
catch (IOException e){ |
| 45 |
|
|
System.out.println("Could not write to the SHTML page: "+e); |
| 46 |
|
|
} |
| 47 |
|
|
|
| 48 |
|
|
// Use the layout functions in SHTMLLayout... |
| 49 |
|
|
|
| 50 |
|
|
IscreamLayout.printDocType(bw); |
| 51 |
|
|
|
| 52 |
|
|
IscreamLayout.printHeader(bw, _title, _metaDescription, _metaKeywords); |
| 53 |
|
|
|
| 54 |
|
|
IscreamLayout.printLeftMenu(bw); |
| 55 |
|
|
|
| 56 |
|
|
IscreamLayout.printTitle(bw, _title); |
| 57 |
|
|
|
| 58 |
|
|
IscreamLayout.printGraph(bw, _graphFile, _width, _height); |
| 59 |
|
|
|
| 60 |
|
|
IscreamLayout.printTable(bw, _pd); |
| 61 |
|
|
|
| 62 |
|
|
IscreamLayout.printBottom(bw); |
| 63 |
|
|
|
| 64 |
|
|
bw.flush(); |
| 65 |
|
|
bw.close(); |
| 66 |
|
|
|
| 67 |
|
|
System.out.println(" - Written SHTML page"); |
| 68 |
|
|
|
| 69 |
|
|
} |
| 70 |
|
|
|
| 71 |
|
|
//---PUBLIC METHODS--- |
| 72 |
|
|
|
| 73 |
|
|
|
| 74 |
|
|
/** |
| 75 |
|
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
| 76 |
|
|
* method to provide clean logging (every class should have this). |
| 77 |
|
|
* |
| 78 |
|
|
* @return the name of this class and its CVS revision |
| 79 |
|
|
*/ |
| 80 |
|
|
public String toString() { |
| 81 |
|
|
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
| 82 |
|
|
} |
| 83 |
|
|
|
| 84 |
|
|
//---PRIVATE METHODS--- |
| 85 |
|
|
|
| 86 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
| 87 |
|
|
|
| 88 |
|
|
//---ATTRIBUTES--- |
| 89 |
|
|
|
| 90 |
|
|
private String _metaDescription; |
| 91 |
|
|
private String _metaKeywords; |
| 92 |
|
|
private String _title; |
| 93 |
|
|
private String _graphFile; |
| 94 |
|
|
private int _width; |
| 95 |
|
|
private int _height; |
| 96 |
|
|
private PlotData _pd; |
| 97 |
|
|
|
| 98 |
|
|
//---STATIC ATTRIBUTES--- |
| 99 |
|
|
|
| 100 |
|
|
} |