2 ************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2008 by Sun Microsystems, Inc.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * $RCSfile: HTMLResult.java,v $
11 * $Revision: 1.1.2.2 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
35 import java
.io
.FileWriter
;
37 // import helper.OSHelper;
39 public class HTMLResult
41 private FileWriter m_aOut
;
42 // private String m_sFilename;
43 // private String m_sNamePrefix; // the HTML files used a suffix to build it's right name
46 * ls is the current line separator (carridge return)
50 public HTMLResult( String _sOutputPath
, String _sHTMLFilename
)
52 FileHelper
.makeDirectories("", _sOutputPath
);
53 // HTMLResult a = new HTMLResult();
54 String sFilename
= FileHelper
.appendPath(_sOutputPath
, _sHTMLFilename
);
58 File outputFile
= new File(sFilename
);
59 m_aOut
= new FileWriter(outputFile
.toString());
60 ls
= System
.getProperty("line.separator");
62 catch (java
.io
.IOException e
)
65 GlobalLogWriter
.get().println("ERROR: Can't create HTML Outputter");
68 // m_sFilename = sFilename;
69 // a.m_sNamePrefix = _sNamePrefix;
73 // public String getFilename() {return m_sFilename;}
75 private void writeln(String _sStr
)
79 m_aOut
.write( _sStr
);
82 catch (java
.io
.IOException e
)
92 catch (java
.io
.IOException e
)
99 * create the HTML header
102 public void header(String _sTitle
)
106 writeln( "<TITLE>" + _sTitle
+ "</TITLE>");
107 writeln( "<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/xmloff.css\" media=\"screen\" />");
108 writeln( "<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/gfxcmp_ui/style.css\" media=\"screen\" />");
110 writeln( "<BODY bgcolor=white>");
114 final static String TEST_TABLETITLE
= "Document";
115 final static String VISUAL_STATUS_TABLETITLE
= "Visual status";
116 final static String VISUAL_STATUS_MESSAGE_TABLETITLE
= "Message";
117 final static String FIRSTGFX_TABLETITLE
= "Original print file as jpeg";
119 public void indexSection(String _sOfficeInfo
)
121 writeln( "<H2>Results for " + _sOfficeInfo
+ "</H2>");
122 writeln( "<P>This result was created at: " + DateHelper
.getDateTimeForHumanreadableLog());
123 writeln( "<P>Legend:<BR>");
124 writeln( stronghtml(FIRSTGFX_TABLETITLE
) + " contains the output printed via 'ghostscript' as a jpeg picture.<BR>");
126 writeln( "<TABLE class=\"infotable\">");
128 writeln( tableHeaderCell(TEST_TABLETITLE
));
129 writeln( tableHeaderCell(""));
130 writeln( tableHeaderCell(VISUAL_STATUS_TABLETITLE
));
131 writeln( tableHeaderCell(VISUAL_STATUS_MESSAGE_TABLETITLE
));
136 * Returns the given _sHREF & _sPathInfo as a HTML String
137 * <A HREF="_sHREF">_sPathInfo</A>
142 private String
getHREF(String _sHREF
, String _sPathInfo
)
144 StringBuffer a
= new StringBuffer();
145 a
.append("<A HREF=\"");
148 a
.append(_sPathInfo
);
154 * Returns the given _sValue as a HTML Table cell with _sValue as content
158 private String
tableDataCell(String _sValue
)
160 StringBuffer a
= new StringBuffer();
168 * Returns the given _sValue as a HTML Table header cell with _sValue as content
172 private String
tableHeaderCell(String _sValue
)
174 StringBuffer a
= new StringBuffer();
181 public void indexLine(String _sHTMLFile
, String _sHTMLName
, String _sStatusRunThrough
, String _sStatusMessage
)
184 writeln(tableDataCell( getHREF(_sHTMLFile
, _sHTMLName
) ) );
185 writeln(tableDataCell( "" ) );
186 writeln( tableDataCell(_sStatusRunThrough
) );
187 writeln( tableDataCell(_sStatusMessage
) );
194 writeln( "</TABLE>");
195 writeln( "</BODY></HTML>");
200 catch (java
.io
.IOException e
)
205 // -----------------------------------------------------------------------------
206 private String
stronghtml(String _sValue
)
208 StringBuffer a
= new StringBuffer();
209 a
.append("<STRONG>");
211 a
.append("</STRONG>");