ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/DBReporter2/SHTMLLayout.java
Revision: 1.3
Committed: Fri Mar 23 23:47:28 2001 UTC (23 years, 2 months ago) by pjm2
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -2 lines
State: FILE REMOVED
Log Message:
I thought I'd deleted these weeks ago(!)

File Contents

# Content
1 //---PACKAGE DECLARATION---
2
3 //---IMPORTS---
4 import java.io.*;
5 import java.util.*;
6 import java.awt.geom.*;
7
8 /**
9 * Provides common i-screamed SHTML layout themes for the historical reports.
10 *
11 * @author $Author: pjm2 $
12 * @version $Id: SHTMLLayout.java,v 1.2 2001/02/03 17:26:07 pjm2 Exp $
13 */
14 public class SHTMLLayout {
15
16 //---FINAL ATTRIBUTES---
17
18 /**
19 * The current CVS revision of this class
20 */
21 public final String REVISION = "$Revision: 1.2 $";
22
23 public static final int CHART_WIDTH = 500;
24 public static final int CHART_HEIGHT = 250;
25
26 //---STATIC METHODS---
27
28 public static void printDocType(BufferedWriter bw) throws IOException {
29 bw.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
30 bw.newLine();
31 bw.newLine();
32 bw.flush();
33 }
34
35 public static void printHeader(BufferedWriter bw, String title, String metaDescription, String metaKeywords) throws IOException {
36 bw.write("<html>");
37 bw.write("<head>");
38 bw.write("<title>"+title+"</title>");
39 bw.write("<meta http-equiv=\"pragma\" content=\"no-cache\">");
40 bw.write("<meta http-equiv=\"cache-control\" content=\"no-cache\">");
41 bw.write("<meta name=\"description\" content=\""+metaDescription+"\">");
42 bw.write("<meta name=\"keywords\" content=\""+metaKeywords+"\">");
43 bw.write("<meta name=\"generator\" content=\"pjm2's DBReporterMain\">");
44 bw.write("</head>");
45 bw.write("<body bgcolor=\"#ffffff\" link=\"#0000ff\" alink=\"#3333cc\" vlink=\"#3333cc\" text=\"#000066\">");
46 bw.write("<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" align=\"center\">");
47 bw.write(" <tr>");
48 bw.write(" <td valign=\"top\">");
49 bw.write("");
50 bw.newLine();
51 bw.flush();
52 }
53
54 public static void printLeftMenu(BufferedWriter bw) throws IOException {
55 bw.newLine();
56 bw.write("<!--#include virtual=\"../left.inc\" -->");
57 bw.newLine();
58 bw.flush();
59 }
60
61 public static void printTitle(BufferedWriter bw, String title) throws IOException {
62 bw.newLine();
63 bw.write("<!--#include virtual=\"../title.inc\" -->");
64 bw.newLine();
65 bw.newLine();
66 bw.write("<h3>"+title+"</h3>");
67 bw.newLine();
68 bw.flush();
69 }
70
71 public static void printGraph(BufferedWriter bw, String imgFile, int width, int height, long startDate, long endDate) throws IOException {
72
73 String graphTitle = "Unknown time period";
74 String xAxisTitle = "Time";
75 String yAxisTitle = "Value";
76 String scaleRow = " <tr><td>&nbsp;</td><td align=\"left\">"+DateUtils.dateString(startDate)+"</td><td align=\"right\">"+DateUtils.dateString(endDate)+"</td></tr>";
77 int colspan = 2;
78
79 bw.write("<table border=\"0\">");
80 bw.write(" <tr><td>&nbsp;</td><td colspan=\""+colspan+"\"><b>"+graphTitle+"</b></td></tr>");
81 bw.write(" <tr><td valign=\"top\" align=\"right\">max</td><td colspan=\""+colspan+"\" rowspan=\"3\"><img src=\""+imgFile+"\" width=\""+width+"\" height=\""+height+"\"></td></tr><tr><td valign=\"middle\" align=\"right\">"+yAxisTitle+"</td></tr><tr><td valign=\"bottom\" align=\"right\">min</td></tr>");
82 bw.write(scaleRow);
83 bw.write("</table>");
84 bw.newLine();
85 bw.flush();
86 }
87
88 // deprecated.
89 public static void printTable(BufferedWriter bw, PlotData pd) throws IOException {
90
91 bw.write("<table border=\"0\" align=\"center\">");
92
93 bw.write("<tr bgcolor=\"black\"><td><font color=\"white\">Date</font></td><td><font color=\"white\">Value</font></td></tr>");
94
95 // Alternating row colours.
96 String rowColour1 = "#ccccff";
97 String rowColour2 = "#ffffff";
98
99 String rowColour = rowColour1;
100
101 Iterator it = pd.iterator();
102 while (it.hasNext()){
103 Point2D p = (Point2D)it.next();
104 double x = p.getX();
105 double y = p.getY();
106
107 if (rowColour.equals(rowColour1)){
108 rowColour = rowColour2;
109 }
110 else {
111 rowColour = rowColour1;
112 }
113
114 bw.write("<tr bgcolor=\""+rowColour+"\"><td>"+x+"</td><td>"+y+"</td></tr>");
115 }
116
117 bw.write("</table>");
118 bw.flush();
119 }
120
121 public static void printBottom(BufferedWriter bw) throws IOException {
122 bw.newLine();
123 bw.write("<!--#include virtual=\"../bottom.inc\" -->");
124 bw.newLine();
125 bw.newLine();
126 bw.flush();
127 }
128
129
130
131 //---CONSTRUCTORS---
132
133
134 //---PUBLIC METHODS---
135
136 /**
137 * Overrides the {@link java.lang.Object#toString() Object.toString()}
138 * method to provide clean logging (every class should have this).
139 *
140 * @return the name of this class and its CVS revision
141 */
142 public String toString() {
143 return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
144 }
145
146 //---PRIVATE METHODS---
147
148 //---ACCESSOR/MUTATOR METHODS---
149
150 //---ATTRIBUTES---
151
152 //---STATIC ATTRIBUTES---
153
154 }