2 ************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
32 import java
.io
.FileWriter
;
34 // import helper.OSHelper;
36 public class HTMLResult
38 private FileWriter m_aOut
;
39 // private String m_sFilename;
40 // private String m_sNamePrefix; // the HTML files used a suffix to build it's right name
43 * ls is the current line separator (carridge return)
47 public HTMLResult( String _sOutputPath
, String _sHTMLFilename
)
49 FileHelper
.makeDirectories("", _sOutputPath
);
50 // HTMLResult a = new HTMLResult();
51 String sFilename
= FileHelper
.appendPath(_sOutputPath
, _sHTMLFilename
);
55 File outputFile
= new File(sFilename
);
56 m_aOut
= new FileWriter(outputFile
.toString());
57 ls
= System
.getProperty("line.separator");
59 catch (java
.io
.IOException e
)
62 GlobalLogWriter
.println("ERROR: Can't create HTML Outputter");
65 // m_sFilename = sFilename;
66 // a.m_sNamePrefix = _sNamePrefix;
70 // public String getFilename() {return m_sFilename;}
72 private void writeln(String _sStr
)
76 m_aOut
.write( _sStr
);
79 catch (java
.io
.IOException e
)
89 catch (java
.io
.IOException e
)
96 * create the HTML header
99 public void header(String _sTitle
)
103 writeln( "<TITLE>" + _sTitle
+ "</TITLE>");
104 writeln( "<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/xmloff.css\" media=\"screen\" />");
105 writeln( "<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/style.css\" media=\"screen\" />");
107 writeln( "<BODY bgcolor=white>");
111 final static String TEST_TABLETITLE
= "Document";
112 final static String VISUAL_STATUS_TABLETITLE
= "Visual status";
113 final static String VISUAL_STATUS_MESSAGE_TABLETITLE
= "Message";
114 final static String FIRSTGFX_TABLETITLE
= "Original print file as jpeg";
116 public void indexSection(String _sOfficeInfo
)
118 writeln( "<H2>Results for " + _sOfficeInfo
+ "</H2>");
119 writeln( "<P>This result was created at: " + DateHelper
.getDateTimeForHumanreadableLog());
120 writeln( "<P>Legend:<BR>");
121 writeln( stronghtml(FIRSTGFX_TABLETITLE
) + " contains the output printed via 'ghostscript' as a jpeg picture.<BR>");
123 writeln( "<TABLE class=\"infotable\">");
125 writeln( tableHeaderCell(TEST_TABLETITLE
));
126 writeln( tableHeaderCell(""));
127 writeln( tableHeaderCell(VISUAL_STATUS_TABLETITLE
));
128 writeln( tableHeaderCell(VISUAL_STATUS_MESSAGE_TABLETITLE
));
133 * Returns the given _sHREF & _sPathInfo as a HTML String
134 * <A HREF="_sHREF">_sPathInfo</A>
139 private String
getHREF(String _sHREF
, String _sPathInfo
)
141 StringBuffer a
= new StringBuffer();
142 a
.append("<A HREF=\"");
145 a
.append(_sPathInfo
);
151 * Returns the given _sValue as a HTML Table cell with _sValue as content
155 private String
tableDataCell(String _sValue
)
157 StringBuffer a
= new StringBuffer();
165 * Returns the given _sValue as a HTML Table header cell with _sValue as content
169 private String
tableHeaderCell(String _sValue
)
171 StringBuffer a
= new StringBuffer();
178 public void indexLine(String _sHTMLFile
, String _sHTMLName
, String _sStatusRunThrough
, String _sStatusMessage
)
181 writeln(tableDataCell( getHREF(_sHTMLFile
, _sHTMLName
) ) );
182 writeln(tableDataCell( "" ) );
183 writeln( tableDataCell(_sStatusRunThrough
) );
184 writeln( tableDataCell(_sStatusMessage
) );
191 writeln( "</TABLE>");
192 writeln( "</BODY></HTML>");
197 catch (java
.io
.IOException e
)
202 // -----------------------------------------------------------------------------
203 private String
stronghtml(String _sValue
)
205 StringBuffer a
= new StringBuffer();
206 a
.append("<STRONG>");
208 a
.append("</STRONG>");