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

Comparing projects/cms/source/reports/DBReporter/IscreamLayout.java (file contents):
Revision 1.1 by pjm2, Mon Dec 11 16:34:16 2000 UTC vs.
Revision 1.8 by pjm2, Sun Jan 7 13:49:54 2001 UTC

# Line 48 | Line 48 | public class IscreamLayout {
48      
49      public static void printLeftMenu(BufferedWriter bw) throws IOException{
50          bw.newLine();
51 <        bw.write("<!--#include virtual=\"left.inc\" -->");
51 >        bw.write("<!--#include virtual=\"../left.inc\" -->");
52          bw.newLine();
53          bw.write("</td><td valign=\"top\">");
54          bw.newLine();
# Line 57 | Line 57 | public class IscreamLayout {
57      
58      public static void printTitle(BufferedWriter bw, String title) throws IOException{
59          bw.newLine();
60 <        bw.write("<!--#include virtual=\"title.inc\" -->");
60 >        bw.write("<!--#include virtual=\"../title.inc\" -->");
61          bw.newLine();
62          bw.newLine();
63          bw.write("<h3>"+title+"</h3>");
# Line 65 | Line 65 | public class IscreamLayout {
65          bw.flush();
66      }
67      
68 <    public static void printGraph(BufferedWriter bw, String filename, int width, int height) throws IOException{
68 >    public static void printGraph(BufferedWriter bw, String filename, int width, int height, int type, long startDate, long endDate) throws IOException{
69 >        
70 >        String graphTitle = "Unknown time period";
71 >        String xAxisTitle = "Time";
72 >        String yAxisTitle = "Value";
73 >        String scaleRow = " <tr><td>&nbsp;</td><td align=\"left\">"+DateUtils.dateString(startDate)+"</td><td align=\"right\">"+DateUtils.dateString(endDate)+"</td></tr>";
74 >        
75 >        switch (type) {
76 >            case ReportPage.HOUR:
77 >                graphTitle = "Hourly report from "+DateUtils.dateString(startDate)+" to "+DateUtils.dateString(endDate);
78 >                scaleRow = " <tr>";
79 >                for (long i = startDate; i < endDate; i+=DateUtils.secsPerHour/6){
80 >                    scaleRow += "<td>"+DateUtils.timeString(i)+"</td>";
81 >                }
82 >                scaleRow += "</tr>";
83 >                break;
84 >            case ReportPage.DAY:
85 >                graphTitle = "24 hour report from "+DateUtils.dateString(startDate)+" to "+DateUtils.dateString(endDate);
86 >                scaleRow = " <tr>";
87 >                for (int i = 0; i < 24; i++){
88 >                    scaleRow += "<td>"+i+"</td>";
89 >                }
90 >                scaleRow += "</tr>";
91 >                break;
92 >            case ReportPage.WEEK:
93 >                graphTitle = "7 day report from "+DateUtils.shortDateString(startDate)+" to "+DateUtils.shortDateString(endDate);
94 >                scaleRow = " <tr>";
95 >                for (long i = startDate; i < endDate; i+=DateUtils.secsPerDay){
96 >                    scaleRow += "<td>"+i+"</td>";
97 >                }
98 >                scaleRow += "</tr>";
99 >                break;
100 >            case ReportPage.MONTH:
101 >                graphTitle = "30 day report from "+DateUtils.shortDateString(startDate)+" to "+DateUtils.shortDateString(endDate);
102 >                scaleRow = " <tr><td>&nbsp;</td><td align=\"left\">"+DateUtils.shortDateString(startDate)+"</td><td align=\"right\">"+DateUtils.shortDateString(endDate)+"</td></tr>";
103 >                break;
104 >            default:
105 >                // Do nothing, leave values as they are.
106 >        }
107 >        
108          bw.write("<table border=\"0\">");
109 <        bw.write(" <tr><td>&nbsp;</td><td colspan=\"2\"><b>Visual representation of the last 7 days</b></td></tr>");
110 <        bw.write(" <tr><td>y axis</td><td colspan=\"2\"><img src=\""+filename+"\" width=\""+width+"\" height=\""+height+"\"></td></tr>");
111 <        bw.write(" <tr><td>&nbsp;</td><td align=\"left\">7 days ago</td><td align=\"right\">now</td>");
109 >        bw.write(" <tr><td>&nbsp;</td><td colspan=\"2\"><b>"+graphTitle+"</b></td></tr>");
110 >        bw.write(" <tr><td>"+yAxisTitle+"</td><td colspan=\"2\"><img src=\""+filename+"\" width=\""+width+"\" height=\""+height+"\"></td></tr>");
111 >        bw.write(scaleRow);
112          bw.write("</table>");
113          bw.newLine();
114          bw.flush();
115      }
116      
117      public static void printTable(BufferedWriter bw, PlotData pd) throws IOException{
118 +
119          bw.write("<table border=\"0\"  align=\"center\">");
120          
121          bw.write("<tr bgcolor=\"black\"><td><font color=\"white\">Date</font></td><td><font color=\"white\">Value</font></td></tr>");
122          
123 +        // Alternating row colours.
124          String rowColour1 = "#ccccff";
125          String rowColour2 = "#ffffff";
126          
# Line 107 | Line 148 | public class IscreamLayout {
148      
149      public static void printBottom(BufferedWriter bw) throws IOException{
150          bw.newLine();
151 <        bw.write("<!--#include virtual=\"bottom.inc\" -->");
151 >        bw.write("<!--#include virtual=\"../bottom.inc\" -->");
152          bw.newLine();
153          bw.newLine();
154          bw.flush();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines