bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / runner / graphical / HTMLResult.java
blobb1a04bbcec6a3353507c71528173103fdd151657
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package graphical;
21 import java.io.File;
22 import java.io.FileWriter;
23 // import util.utils;
24 // import helper.OSHelper;
26 public class HTMLResult
28 private FileWriter m_aOut;
29 // private String m_sFilename;
30 // private String m_sNamePrefix; // the HTML files used a suffix to build it's right name
32 /**
33 * ls is the current line separator (carridge return)
35 private String ls;
37 public HTMLResult( String _sOutputPath, String _sHTMLFilename )
39 FileHelper.makeDirectories("", _sOutputPath);
40 // HTMLResult a = new HTMLResult();
41 String sFilename = FileHelper.appendPath(_sOutputPath, _sHTMLFilename);
43 try
45 File outputFile = new File(sFilename);
46 m_aOut = new FileWriter(outputFile.toString());
47 ls = System.getProperty("line.separator");
49 catch (java.io.IOException e)
51 e.printStackTrace();
52 GlobalLogWriter.println("ERROR: Can't create HTML Outputter");
53 // return null;
55 // m_sFilename = sFilename;
56 // a.m_sNamePrefix = _sNamePrefix;
57 // return a;
60 // public String getFilename() {return m_sFilename;}
62 private void writeln(String _sStr)
64 try
66 m_aOut.write( _sStr );
67 m_aOut.write ( ls );
69 catch (java.io.IOException e)
73 private void flush()
75 try
77 m_aOut.flush();
79 catch (java.io.IOException e)
85 /**
86 * create the HTML header
87 * @param _sTitle
89 public void header(String _sTitle)
91 writeln( "<HTML>");
92 writeln( "<HEAD>" );
93 writeln( "<TITLE>" + _sTitle + "</TITLE>");
94 writeln( "<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/xmloff.css\" media=\"screen\" />");
95 writeln( "<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/style.css\" media=\"screen\" />");
96 writeln( "</HEAD>");
97 writeln( "<BODY bgcolor=white>");
98 flush();
101 final static String TEST_TABLETITLE = "Document";
102 final static String VISUAL_STATUS_TABLETITLE = "Visual status";
103 final static String VISUAL_STATUS_MESSAGE_TABLETITLE = "Message";
104 final static String FIRSTGFX_TABLETITLE = "Original print file as jpeg";
106 public void indexSection(String _sOfficeInfo)
108 writeln( "<H2>Results for " + _sOfficeInfo + "</H2>");
109 writeln( "<P>This result was created at: " + DateHelper.getDateTimeForHumanreadableLog());
110 writeln( "<P>Legend:<BR>");
111 writeln( stronghtml(FIRSTGFX_TABLETITLE) + " contains the output printed via 'ghostscript' as a jpeg picture.<BR>");
113 writeln( "<TABLE class=\"infotable\">");
114 writeln( "<TR>");
115 writeln( tableHeaderCell(TEST_TABLETITLE));
116 writeln( tableHeaderCell(""));
117 writeln( tableHeaderCell(VISUAL_STATUS_TABLETITLE));
118 writeln( tableHeaderCell(VISUAL_STATUS_MESSAGE_TABLETITLE));
119 writeln( "</TR>");
120 flush();
123 * Returns the given _sHREF & _sPathInfo as a HTML String
124 * <A HREF="_sHREF">_sPathInfo</A>
125 * @param _sHREF
126 * @param _sPathInfo
127 * @return
129 private String getHREF(String _sHREF, String _sPathInfo)
131 StringBuffer a = new StringBuffer();
132 a.append("<A HREF=\"");
133 a.append(_sHREF);
134 a.append("\">");
135 a.append(_sPathInfo);
136 a.append("</A>");
137 return a.toString();
141 * Returns the given _sValue as a HTML Table cell with _sValue as content
142 * @param _sValue
143 * @return
145 private String tableDataCell(String _sValue)
147 StringBuffer a = new StringBuffer();
148 a.append("<TD>");
149 a.append(_sValue);
150 a.append("</TD>");
151 return a.toString();
155 * Returns the given _sValue as a HTML Table header cell with _sValue as content
156 * @param _sValue
157 * @return
159 private String tableHeaderCell(String _sValue)
161 StringBuffer a = new StringBuffer();
162 a.append("<TH>");
163 a.append(_sValue);
164 a.append("</TH>");
165 return a.toString();
168 public void indexLine(String _sHTMLFile, String _sHTMLName, String _sStatusRunThrough, String _sStatusMessage)
170 writeln( "<TR>");
171 writeln(tableDataCell( getHREF(_sHTMLFile, _sHTMLName) ) );
172 writeln(tableDataCell( "" ) );
173 writeln( tableDataCell(_sStatusRunThrough) );
174 writeln( tableDataCell(_sStatusMessage) );
175 writeln( "</TR>");
176 flush();
179 public void close()
181 writeln( "</TABLE>");
182 writeln( "</BODY></HTML>");
185 m_aOut.close();
187 catch (java.io.IOException e)
192 // -----------------------------------------------------------------------------
193 private String stronghtml(String _sValue)
195 StringBuffer a = new StringBuffer();
196 a.append("<STRONG>");
197 a.append(_sValue);
198 a.append("</STRONG>");
199 return a.toString();