1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ef39d40dSAndrew Rist  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ef39d40dSAndrew Rist  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19*ef39d40dSAndrew Rist  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package convwatch;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import java.io.File;
27cdf0e10cSrcweir import java.io.FileWriter;
28cdf0e10cSrcweir import helper.OSHelper;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir public class HTMLOutputter
31cdf0e10cSrcweir {
32cdf0e10cSrcweir     FileWriter m_aOut;
33cdf0e10cSrcweir     String m_sFilename;
34cdf0e10cSrcweir     String m_sNamePrefix;              // the HTML files used a suffix to build it's right name
35cdf0e10cSrcweir 
36cdf0e10cSrcweir     /**
37cdf0e10cSrcweir      * ls is the current line separator (carridge return)
38cdf0e10cSrcweir      */
39cdf0e10cSrcweir     String ls;
40cdf0e10cSrcweir 
HTMLOutputter()41cdf0e10cSrcweir     HTMLOutputter() {}
create( String _sOutputPath, String _sHTMLFilename, String _sNamePrefix, String _sTitle )42cdf0e10cSrcweir     public static HTMLOutputter create( String _sOutputPath, String _sHTMLFilename, String _sNamePrefix, String _sTitle )
43cdf0e10cSrcweir         {
44cdf0e10cSrcweir             FileHelper.makeDirectories("", _sOutputPath);
45cdf0e10cSrcweir             HTMLOutputter a = new HTMLOutputter();
46cdf0e10cSrcweir             String fs = System.getProperty("file.separator");
47cdf0e10cSrcweir             String sFilename = _sOutputPath + fs + _sHTMLFilename;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir             try
50cdf0e10cSrcweir             {
51cdf0e10cSrcweir                 File outputFile = new File(sFilename);
52cdf0e10cSrcweir                 a.m_aOut = new FileWriter(outputFile.toString());
53cdf0e10cSrcweir                 a.ls = System.getProperty("line.separator");
54cdf0e10cSrcweir             }
55cdf0e10cSrcweir             catch (java.io.IOException e)
56cdf0e10cSrcweir             {
57cdf0e10cSrcweir                 e.printStackTrace();
58cdf0e10cSrcweir                 GlobalLogWriter.get().println("ERROR: Can't create HTML Outputter");
59cdf0e10cSrcweir                 return null;
60cdf0e10cSrcweir             }
61cdf0e10cSrcweir             a.m_sFilename = sFilename;
62cdf0e10cSrcweir             a.m_sNamePrefix = _sNamePrefix;
63cdf0e10cSrcweir             return a;
64cdf0e10cSrcweir         }
getFilename()65cdf0e10cSrcweir     public String getFilename() {return m_sFilename;}
66cdf0e10cSrcweir 
header(String _sTitle)67cdf0e10cSrcweir     public void header(String _sTitle)
68cdf0e10cSrcweir         {
69cdf0e10cSrcweir             try
70cdf0e10cSrcweir             {
71cdf0e10cSrcweir                 m_aOut.write( "<html>" + ls);
72cdf0e10cSrcweir                 m_aOut.write( "<head>"  + ls);
73cdf0e10cSrcweir                 m_aOut.write( "<title>" + _sTitle + "</title>" + ls);
74cdf0e10cSrcweir                 m_aOut.write( "<link rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/xmloff.css\" media=\"screen\" />" + ls);
75cdf0e10cSrcweir                 m_aOut.write( "<link rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/style.css\" media=\"screen\" />" + ls);
76cdf0e10cSrcweir                 m_aOut.write( "</head>" + ls);
77cdf0e10cSrcweir                 m_aOut.write( "<body bgcolor=white>" + ls);
78cdf0e10cSrcweir                 m_aOut.flush();
79cdf0e10cSrcweir             }
80cdf0e10cSrcweir             catch (java.io.IOException e)
81cdf0e10cSrcweir             {
82cdf0e10cSrcweir             }
83cdf0e10cSrcweir         }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     final static String TEST_TABLETITLE = "Test";
86cdf0e10cSrcweir     final static String VISUAL_STATUS_TABLETITLE = "Visual status";
87cdf0e10cSrcweir     final static String VISUAL_STATUS_MESSAGE_TABLETITLE = "Message";
88cdf0e10cSrcweir 
indexSection(String _sOfficeInfo)89cdf0e10cSrcweir     public void indexSection(String _sOfficeInfo)
90cdf0e10cSrcweir         {
91cdf0e10cSrcweir             try
92cdf0e10cSrcweir             {
93cdf0e10cSrcweir                 m_aOut.write( "<h2>Results for " + _sOfficeInfo + "</h2>" + ls);
94cdf0e10cSrcweir                 m_aOut.write( "<p>Legend:<br>");
95cdf0e10cSrcweir                 m_aOut.write( stronghtml(FIRSTGFX_TABLETITLE) + " contains the output printed via 'ghostscript' as a jpeg picture.<br>");
96cdf0e10cSrcweir 
97cdf0e10cSrcweir                 m_aOut.write( "<table class=\"infotable\">" + ls);
98cdf0e10cSrcweir                 m_aOut.write( "<TR>");
99cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(TEST_TABLETITLE));
100cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(TEST_TABLETITLE));
101cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(VISUAL_STATUS_TABLETITLE));
102cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(VISUAL_STATUS_MESSAGE_TABLETITLE));
103cdf0e10cSrcweir                 m_aOut.write( "</TR>" + ls);
104cdf0e10cSrcweir                 m_aOut.flush();
105cdf0e10cSrcweir             }
106cdf0e10cSrcweir             catch (java.io.IOException e)
107cdf0e10cSrcweir             {
108cdf0e10cSrcweir             }
109cdf0e10cSrcweir         }
110cdf0e10cSrcweir 
getHREF(String _sHREF, String _sPathInfo)111cdf0e10cSrcweir     String getHREF(String _sHREF, String _sPathInfo)
112cdf0e10cSrcweir         {
113cdf0e10cSrcweir             StringBuffer a = new StringBuffer();
114cdf0e10cSrcweir             if (! OSHelper.isWindows())
115cdf0e10cSrcweir             {
116cdf0e10cSrcweir                 // System.out.println("Tu'nix system.");
117cdf0e10cSrcweir                 a.append("<A HREF=\"");
118cdf0e10cSrcweir                 a.append(_sHREF);
119cdf0e10cSrcweir                 a.append("\">");
120cdf0e10cSrcweir                 a.append(_sPathInfo);
121cdf0e10cSrcweir                 a.append("</A>");
122cdf0e10cSrcweir             }
123cdf0e10cSrcweir             else
124cdf0e10cSrcweir             {
125cdf0e10cSrcweir                 // System.out.println("Windows system.");
126cdf0e10cSrcweir                 //! this should be replaced by a better method
127cdf0e10cSrcweir                 //! name(WIN|UNIX)
128cdf0e10cSrcweir                 a.append("<A HREF=\"");
129cdf0e10cSrcweir                 a.append(_sHREF);
130cdf0e10cSrcweir                 a.append("\">");
131cdf0e10cSrcweir                 a.append(_sPathInfo);
132cdf0e10cSrcweir                 // a.append("(first)");
133cdf0e10cSrcweir                 a.append("</A>");
134cdf0e10cSrcweir                 // if (_sHREF.charAt(1) == ':' && (_sHREF.charAt(0) == 'x' || _sHREF.charAt(0) == 'X'))
135cdf0e10cSrcweir                 // int index = 0;
136cdf0e10cSrcweir                 // index = _sHREF.indexOf("X:");
137cdf0e10cSrcweir                 // if (index == -1)
138cdf0e10cSrcweir                 // {
139cdf0e10cSrcweir                 //     index = _sHREF.indexOf("x:");
140cdf0e10cSrcweir                 // }
141cdf0e10cSrcweir                 // if (index >= 0)
142cdf0e10cSrcweir                 // {
143cdf0e10cSrcweir                 //     // int index = 0;
144cdf0e10cSrcweir                 //     // remove "X:" and insert "/tausch"
145cdf0e10cSrcweir                 //     StringBuffer sbUNIXPath = new StringBuffer( _sHREF.substring(0, index) );
146cdf0e10cSrcweir                 //     sbUNIXPath.append("/tausch");
147cdf0e10cSrcweir                 //     sbUNIXPath.append(_sHREF.substring(index + 2));
148cdf0e10cSrcweir                 //     String sUNIXPath = sbUNIXPath.toString();
149cdf0e10cSrcweir                 //     sUNIXPath = utils.replaceAll13(sUNIXPath, "\\", "/");
150cdf0e10cSrcweir                 //
151cdf0e10cSrcweir                 //     a.append("<A HREF=\"");
152cdf0e10cSrcweir                 //     a.append(sUNIXPath);
153cdf0e10cSrcweir                 //     a.append("\">");
154cdf0e10cSrcweir                 //     a.append("(second)");
155cdf0e10cSrcweir                 //     a.append("</A>");
156cdf0e10cSrcweir                 // }
157cdf0e10cSrcweir                 // else
158cdf0e10cSrcweir                 // {
159cdf0e10cSrcweir                 //     System.out.println("Path is '" + _sHREF + "'");
160cdf0e10cSrcweir                 // }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir             }
163cdf0e10cSrcweir             return a.toString();
164cdf0e10cSrcweir         }
165cdf0e10cSrcweir 
tableDataCell(String _sValue)166cdf0e10cSrcweir     String tableDataCell(String _sValue)
167cdf0e10cSrcweir         {
168cdf0e10cSrcweir             StringBuffer a = new StringBuffer();
169cdf0e10cSrcweir             a.append("<TD>");
170cdf0e10cSrcweir             a.append(_sValue);
171cdf0e10cSrcweir             a.append("</TD>");
172cdf0e10cSrcweir             return a.toString();
173cdf0e10cSrcweir         }
174cdf0e10cSrcweir 
tableHeaderCell(String _sValue)175cdf0e10cSrcweir     String tableHeaderCell(String _sValue)
176cdf0e10cSrcweir         {
177cdf0e10cSrcweir             StringBuffer a = new StringBuffer();
178cdf0e10cSrcweir             a.append("<TH>");
179cdf0e10cSrcweir             a.append(_sValue);
180cdf0e10cSrcweir             a.append("</TH>");
181cdf0e10cSrcweir             return a.toString();
182cdf0e10cSrcweir         }
183cdf0e10cSrcweir 
indexLine(String _sHTMLFile, String _sHTMLName, String _sHTMLFile2, String _sHTMLName2, String _sStatusRunThrough, String _sStatusMessage)184cdf0e10cSrcweir     public void indexLine(String _sHTMLFile, String _sHTMLName, String _sHTMLFile2, String _sHTMLName2, String _sStatusRunThrough, String _sStatusMessage)
185cdf0e10cSrcweir         {
186cdf0e10cSrcweir             try
187cdf0e10cSrcweir             {
188cdf0e10cSrcweir                 m_aOut.write( "<TR>");
189cdf0e10cSrcweir                 m_aOut.write(tableDataCell( getHREF(_sHTMLFile, _sHTMLName) ) );
190cdf0e10cSrcweir                 if (_sHTMLFile2.length() > 0)
191cdf0e10cSrcweir                 {
192cdf0e10cSrcweir                     m_aOut.write(tableDataCell( getHREF(_sHTMLFile2, _sHTMLName2) ) );
193cdf0e10cSrcweir                 }
194cdf0e10cSrcweir                 else
195cdf0e10cSrcweir                 {
196cdf0e10cSrcweir                     m_aOut.write(tableDataCell( "" ) );
197cdf0e10cSrcweir                 }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir                 m_aOut.write( tableDataCell(_sStatusRunThrough) );
200cdf0e10cSrcweir                 m_aOut.write( tableDataCell(_sStatusMessage) );
201cdf0e10cSrcweir                 m_aOut.write( "</TR>" + ls);
202cdf0e10cSrcweir 
203cdf0e10cSrcweir                 m_aOut.flush();
204cdf0e10cSrcweir             }
205cdf0e10cSrcweir             catch (java.io.IOException e)
206cdf0e10cSrcweir             {
207cdf0e10cSrcweir             }
208cdf0e10cSrcweir         }
209cdf0e10cSrcweir 
close()210cdf0e10cSrcweir     public void close()
211cdf0e10cSrcweir         {
212cdf0e10cSrcweir             try
213cdf0e10cSrcweir             {
214cdf0e10cSrcweir                 m_aOut.write( "</TABLE>" + ls);
215cdf0e10cSrcweir                 m_aOut.write( "</BODY></HTML>" + ls);
216cdf0e10cSrcweir                 m_aOut.flush();
217cdf0e10cSrcweir                 m_aOut.close();
218cdf0e10cSrcweir             }
219cdf0e10cSrcweir             catch (java.io.IOException e)
220cdf0e10cSrcweir             {
221cdf0e10cSrcweir             }
222cdf0e10cSrcweir         }
223cdf0e10cSrcweir 
224cdf0e10cSrcweir // -----------------------------------------------------------------------------
stronghtml(String _sValue)225cdf0e10cSrcweir     String stronghtml(String _sValue)
226cdf0e10cSrcweir         {
227cdf0e10cSrcweir             StringBuffer a = new StringBuffer();
228cdf0e10cSrcweir             a.append("<STRONG>");
229cdf0e10cSrcweir             a.append(_sValue);
230cdf0e10cSrcweir             a.append("</STRONG>");
231cdf0e10cSrcweir             return a.toString();
232cdf0e10cSrcweir         }
233cdf0e10cSrcweir 
234cdf0e10cSrcweir     final static String FIRSTGFX_TABLETITLE = "Original print file as jpeg";
235cdf0e10cSrcweir     final static String SECONDGFX_TABLETITLE = "New print file as jpeg";
236cdf0e10cSrcweir     final static String DIFFER_TABLETITLE = "Difference file";
237cdf0e10cSrcweir     final static String STATUS_TABLETITLE = "Status";
238cdf0e10cSrcweir     final static String PIXELDIFF_TABLETITLE = "Pixel difference in %";
239cdf0e10cSrcweir 
240cdf0e10cSrcweir     final static String PIXELDIFF_BM_TABLETITLE = "P.diff. in % after remove border";
241cdf0e10cSrcweir     final static String DIFFER_BM_TABLETITLE = "Diff file (RB)";
242cdf0e10cSrcweir 
243cdf0e10cSrcweir     final static String OK_TABLETITLE = "OK?";
checkSection(String _sDocumentName)244cdf0e10cSrcweir     public void checkSection(String _sDocumentName)
245cdf0e10cSrcweir         {
246cdf0e10cSrcweir             try
247cdf0e10cSrcweir             {
248cdf0e10cSrcweir                 m_aOut.write( "<H2>Results for the document " + _sDocumentName + "</H2>" + ls);
249cdf0e10cSrcweir 
250cdf0e10cSrcweir                 m_aOut.write( "<p>Legend:<br>");
251cdf0e10cSrcweir                 m_aOut.write( stronghtml(FIRSTGFX_TABLETITLE) + " contains the output printed via 'ghostscript' as a jpeg picture.<br>");
252cdf0e10cSrcweir                 m_aOut.write( stronghtml(SECONDGFX_TABLETITLE) + " contains the same document opened within OpenOffice.org also printed via ghostscript as jpeg.<br>");
253cdf0e10cSrcweir                 m_aOut.write( stronghtml(DIFFER_TABLETITLE)+" is build via composite from original and new picture. The result should be a whole black picture, if there are no differences.<br>At the moment "+stronghtml(STATUS_TABLETITLE)+" is only ok, if the difference file contains only one color (black).</p>" );
254cdf0e10cSrcweir                 m_aOut.write( stronghtml(DIFFER_BM_TABLETITLE) + " is build via composite from original and new picture after the border of both pictures are removed, so differences based on center problems may solved here");
255cdf0e10cSrcweir                 m_aOut.write( "</p>");
256cdf0e10cSrcweir                 m_aOut.write( "<p>Some words about the percentage value<br>");
257cdf0e10cSrcweir                 m_aOut.write( "If a character is on the original page (a) and on the new page this character is moved to an other position only (b) , this means the difference is 100%.<br>");
258cdf0e10cSrcweir                 m_aOut.write( "If character (b) is also bigger than character (a) the percentage is grow over the 100% mark.<br>");
259cdf0e10cSrcweir                 m_aOut.write( "This tool count only the pixels which are differ to it's background color. It makes no sense to count all pixels, or the difference percentage will most the time in a very low percentage range.");
260cdf0e10cSrcweir                 m_aOut.write( "</p>");
261cdf0e10cSrcweir 
262cdf0e10cSrcweir                 m_aOut.write( "<table class=\"infotable\">" + ls);
263cdf0e10cSrcweir 
264cdf0e10cSrcweir                 m_aOut.write( "<TR>" + ls);
265cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell( FIRSTGFX_TABLETITLE) );
266cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell( SECONDGFX_TABLETITLE ) );
267cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(DIFFER_TABLETITLE ) );
268cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(PIXELDIFF_TABLETITLE ) );
269cdf0e10cSrcweir 
270cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(DIFFER_BM_TABLETITLE) );
271cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(PIXELDIFF_BM_TABLETITLE ) );
272cdf0e10cSrcweir 
273cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell( OK_TABLETITLE) );
274cdf0e10cSrcweir 
275cdf0e10cSrcweir                 m_aOut.write( "</TR>" + ls);
276cdf0e10cSrcweir                 m_aOut.flush();
277cdf0e10cSrcweir             }
278cdf0e10cSrcweir             catch (java.io.IOException e)
279cdf0e10cSrcweir             {
280cdf0e10cSrcweir             }
281cdf0e10cSrcweir         }
282cdf0e10cSrcweir 
checkLine(StatusHelper _aStatus, boolean _bCurrentResult)283cdf0e10cSrcweir     public void checkLine(StatusHelper _aStatus, boolean _bCurrentResult)
284cdf0e10cSrcweir         {
285cdf0e10cSrcweir             try
286cdf0e10cSrcweir             {
287cdf0e10cSrcweir                 m_aOut.write( "<TR>" + ls);
288cdf0e10cSrcweir                 String sLink = getHREF(FileHelper.getBasename(_aStatus.m_sOldGfx), FileHelper.getBasename(_aStatus.m_sOldGfx));
289cdf0e10cSrcweir                 m_aOut.write( tableDataCell(sLink) );
290cdf0e10cSrcweir 
291cdf0e10cSrcweir                 sLink = getHREF(FileHelper.getBasename(_aStatus.m_sNewGfx), FileHelper.getBasename(_aStatus.m_sNewGfx));
292cdf0e10cSrcweir                 m_aOut.write( tableDataCell(sLink) );
293cdf0e10cSrcweir 
294cdf0e10cSrcweir                 sLink = getHREF(FileHelper.getBasename(_aStatus.m_sDiffGfx), FileHelper.getBasename(_aStatus.m_sDiffGfx));
295cdf0e10cSrcweir                 m_aOut.write( tableDataCell(sLink) );
296cdf0e10cSrcweir 
297cdf0e10cSrcweir                 String sPercent = String.valueOf(_aStatus.nPercent) + "%";
298cdf0e10cSrcweir                 if (_aStatus.nPercent > 0 && _aStatus.nPercent < 5)
299cdf0e10cSrcweir                 {
300cdf0e10cSrcweir                     sPercent += " (less 5% is ok)";
301cdf0e10cSrcweir                 }
302cdf0e10cSrcweir                 m_aOut.write(tableDataCell( sPercent ) );
303cdf0e10cSrcweir 
304cdf0e10cSrcweir                 if (_aStatus.m_sDiff_BM_Gfx == null)
305cdf0e10cSrcweir                 {
306cdf0e10cSrcweir                     sLink = "No diffs, therefore no moves";
307cdf0e10cSrcweir                     m_aOut.write( tableDataCell(sLink) );
308cdf0e10cSrcweir                     m_aOut.write(tableDataCell( "" ) );
309cdf0e10cSrcweir                 }
310cdf0e10cSrcweir                 else
311cdf0e10cSrcweir                 {
312cdf0e10cSrcweir                     sLink = getHREF(FileHelper.getBasename(_aStatus.m_sDiff_BM_Gfx), FileHelper.getBasename(_aStatus.m_sDiff_BM_Gfx));
313cdf0e10cSrcweir                     m_aOut.write( tableDataCell(sLink) );
314cdf0e10cSrcweir 
315cdf0e10cSrcweir                     String sPercent2 = String.valueOf(_aStatus.nPercent2) + "%";
316cdf0e10cSrcweir                     if (_aStatus.nPercent2 > 0 && _aStatus.nPercent2 < 5)
317cdf0e10cSrcweir                     {
318cdf0e10cSrcweir                         sPercent2 += " (less 5% is ok)";
319cdf0e10cSrcweir                     }
320cdf0e10cSrcweir                     m_aOut.write(tableDataCell( sPercent2 ) );
321cdf0e10cSrcweir                 }
322cdf0e10cSrcweir 
323cdf0e10cSrcweir                 // is the check positiv, in a defined range
324cdf0e10cSrcweir                 if (_bCurrentResult)
325cdf0e10cSrcweir                 {
326cdf0e10cSrcweir                     m_aOut.write(tableDataCell( "YES" ) );
327cdf0e10cSrcweir                 }
328cdf0e10cSrcweir                 else
329cdf0e10cSrcweir                 {
330cdf0e10cSrcweir                     m_aOut.write(tableDataCell( "NO" ) );
331cdf0e10cSrcweir                 }
332cdf0e10cSrcweir 
333cdf0e10cSrcweir                 m_aOut.write( "</TR>" + ls);
334cdf0e10cSrcweir             }
335cdf0e10cSrcweir             catch (java.io.IOException e)
336cdf0e10cSrcweir             {
337cdf0e10cSrcweir             }
338cdf0e10cSrcweir         }
339cdf0e10cSrcweir 
340cdf0e10cSrcweir // -----------------------------------------------------------------------------
checkDiffDiffSection(String _sDocumentName)341cdf0e10cSrcweir     public void checkDiffDiffSection(String _sDocumentName)
342cdf0e10cSrcweir         {
343cdf0e10cSrcweir             try
344cdf0e10cSrcweir             {
345cdf0e10cSrcweir                 m_aOut.write( "<H2>Results for the document " + _sDocumentName + "</H2>" + ls);
346cdf0e10cSrcweir 
347cdf0e10cSrcweir                 m_aOut.write( "<p>Legend:<br>");
348cdf0e10cSrcweir                 m_aOut.write( "</p>");
349cdf0e10cSrcweir 
350cdf0e10cSrcweir                 m_aOut.write( "<table class=\"infotable\">" + ls);
351cdf0e10cSrcweir 
352cdf0e10cSrcweir                 m_aOut.write( "<TR>" + ls);
353cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell( "Source to actual difference" ) );
354cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell( "Actual difference" ) );
355cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(DIFFER_TABLETITLE ) );
356cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell(PIXELDIFF_TABLETITLE ) );
357cdf0e10cSrcweir 
358cdf0e10cSrcweir                 m_aOut.write( tableHeaderCell( OK_TABLETITLE) );
359cdf0e10cSrcweir 
360cdf0e10cSrcweir                 m_aOut.write( "</TR>" + ls);
361cdf0e10cSrcweir                 m_aOut.flush();
362cdf0e10cSrcweir             }
363cdf0e10cSrcweir             catch (java.io.IOException e)
364cdf0e10cSrcweir             {
365cdf0e10cSrcweir             }
366cdf0e10cSrcweir         }
367cdf0e10cSrcweir 
checkDiffDiffLine(StatusHelper _aStatus, boolean _bCurrentResult)368cdf0e10cSrcweir     public void checkDiffDiffLine(StatusHelper _aStatus, boolean _bCurrentResult)
369cdf0e10cSrcweir         {
370cdf0e10cSrcweir             try
371cdf0e10cSrcweir             {
372cdf0e10cSrcweir                 m_aOut.write( "<TR>" + ls);
373cdf0e10cSrcweir                 // the link to the old difference can't offer here
374cdf0e10cSrcweir                 //  String sLink = getHREF(FileHelper.getBasename(_aStatus.m_sOldGfx), FileHelper.getBasename(_aStatus.m_sOldGfx));
375cdf0e10cSrcweir                 //  m_aOut.write( tableDataCell(sLink) );
376cdf0e10cSrcweir 
377cdf0e10cSrcweir                 String sBasename = FileHelper.getBasename(m_sFilename);
378cdf0e10cSrcweir                 String sNew = sBasename.substring(m_sNamePrefix.length());
379cdf0e10cSrcweir 
380cdf0e10cSrcweir                 String sLink;
381cdf0e10cSrcweir                 sLink = getHREF(sNew, sNew);
382cdf0e10cSrcweir                 m_aOut.write( tableDataCell(sLink) );
383cdf0e10cSrcweir 
384cdf0e10cSrcweir                 sLink = getHREF(FileHelper.getBasename(_aStatus.m_sNewGfx), FileHelper.getBasename(_aStatus.m_sNewGfx));
385cdf0e10cSrcweir                 m_aOut.write( tableDataCell(sLink) );
386cdf0e10cSrcweir 
387cdf0e10cSrcweir                 sLink = getHREF(FileHelper.getBasename(_aStatus.m_sDiffGfx), FileHelper.getBasename(_aStatus.m_sDiffGfx));
388cdf0e10cSrcweir                 m_aOut.write( tableDataCell(sLink) );
389cdf0e10cSrcweir 
390cdf0e10cSrcweir                 String sPercent = String.valueOf(_aStatus.nPercent) + "%";
391cdf0e10cSrcweir                 // if (_aStatus.nPercent > 0 && _aStatus.nPercent < 5)
392cdf0e10cSrcweir                 // {
393cdf0e10cSrcweir                 //     sPercent += " (less 5% is ok)";
394cdf0e10cSrcweir                 // }
395cdf0e10cSrcweir                 m_aOut.write(tableDataCell( sPercent ) );
396cdf0e10cSrcweir 
397cdf0e10cSrcweir                 // is the check positiv, in a defined range
398cdf0e10cSrcweir                 if (_bCurrentResult)
399cdf0e10cSrcweir                 {
400cdf0e10cSrcweir                     m_aOut.write(tableDataCell( "YES" ) );
401cdf0e10cSrcweir                 }
402cdf0e10cSrcweir                 else
403cdf0e10cSrcweir                 {
404cdf0e10cSrcweir                     m_aOut.write(tableDataCell( "NO" ) );
405cdf0e10cSrcweir                 }
406cdf0e10cSrcweir 
407cdf0e10cSrcweir                 m_aOut.write( "</TR>" + ls);
408cdf0e10cSrcweir             }
409cdf0e10cSrcweir             catch (java.io.IOException e)
410cdf0e10cSrcweir             {
411cdf0e10cSrcweir             }
412cdf0e10cSrcweir         }
413cdf0e10cSrcweir 
414cdf0e10cSrcweir }
415