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 .
22 import java
.io
.FileWriter
;
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
33 * ls is the current line separator (carridge return)
37 public HTMLResult( String _sOutputPath
, String _sHTMLFilename
)
39 FileHelper
.makeDirectories("", _sOutputPath
);
40 // HTMLResult a = new HTMLResult();
41 String sFilename
= FileHelper
.appendPath(_sOutputPath
, _sHTMLFilename
);
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
)
52 GlobalLogWriter
.println("ERROR: Can't create HTML Outputter");
55 // m_sFilename = sFilename;
56 // a.m_sNamePrefix = _sNamePrefix;
60 // public String getFilename() {return m_sFilename;}
62 private void writeln(String _sStr
)
66 m_aOut
.write( _sStr
);
69 catch (java
.io
.IOException e
)
79 catch (java
.io
.IOException e
)
86 * create the HTML header
89 public void header(String _sTitle
)
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\" />");
97 writeln( "<BODY bgcolor=white>");
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\">");
115 writeln( tableHeaderCell(TEST_TABLETITLE
));
116 writeln( tableHeaderCell(""));
117 writeln( tableHeaderCell(VISUAL_STATUS_TABLETITLE
));
118 writeln( tableHeaderCell(VISUAL_STATUS_MESSAGE_TABLETITLE
));
123 * Returns the given _sHREF & _sPathInfo as a HTML String
124 * <A HREF="_sHREF">_sPathInfo</A>
129 private String
getHREF(String _sHREF
, String _sPathInfo
)
131 StringBuffer a
= new StringBuffer();
132 a
.append("<A HREF=\"");
135 a
.append(_sPathInfo
);
141 * Returns the given _sValue as a HTML Table cell with _sValue as content
145 private String
tableDataCell(String _sValue
)
147 StringBuffer a
= new StringBuffer();
155 * Returns the given _sValue as a HTML Table header cell with _sValue as content
159 private String
tableHeaderCell(String _sValue
)
161 StringBuffer a
= new StringBuffer();
168 public void indexLine(String _sHTMLFile
, String _sHTMLName
, String _sStatusRunThrough
, String _sStatusMessage
)
171 writeln(tableDataCell( getHREF(_sHTMLFile
, _sHTMLName
) ) );
172 writeln(tableDataCell( "" ) );
173 writeln( tableDataCell(_sStatusRunThrough
) );
174 writeln( tableDataCell(_sStatusMessage
) );
181 writeln( "</TABLE>");
182 writeln( "</BODY></HTML>");
187 catch (java
.io
.IOException e
)
192 // -----------------------------------------------------------------------------
193 private String
stronghtml(String _sValue
)
195 StringBuffer a
= new StringBuffer();
196 a
.append("<STRONG>");
198 a
.append("</STRONG>");