OpenAPI 1.0

com.aquafold.openapi.io
Interface AQHtmlWriter

All Superinterfaces:
AQDataWriter, Closeable

public interface AQHtmlWriter
extends AQDataWriter

This interface provides a set of convenient methods for generating HTML output. An object implementing this interface can be obtained by calling aqua.io.newHtmlWriter().

Example:

 var d = aqua.data.newDataSet( [ 'column1','column2','column3' ] );
 d.addRowWithValues("a","b","");
 d.addRowWithValues("1","2","3");
 

var w = aqua.io.newHtmlWriter(); w.setTitle("Example"); w.setTableStyle("width:50%;"); w.setRowStyle("background-color:#808080;");

w.write("Table"); w.write(d);

print(w.toHtml()); w.saveToFile('c:/test.html','utf-8');


Method Summary
 void close()
          Closes this writer and releases any system resources associated with it.
 void saveToFile(String filename)
          Save the generated HTML to a file using UTF-8 encoding.
 void saveToFile(String filename, String encoding)
          Save the generated HTML to a file using the specified encoding.
 void setCellStyle(String style)
          Sets the style of subsequent table cells (<TD> elements>).
 void setEmbeddedStyleSheet(String styleSheet)
          Sets embedded style sheet.
 void setRowStyle(String style)
          Sets the style of subsequent table rows (<TR> elements).
 void setTableStyle(String style)
          Sets the style of subsequent <TABLE> element.
 void setTitle(String title)
          Sets document <TITLE> tag.
 String toHtml()
          Returns generated HTML.
 void writeLink(String text, String url)
          Writes a hyperlink (<A HREF> element).
 void writeText(String text)
          Writes arbitrary text.
 
Methods inherited from interface com.aquafold.openapi.io.AQDataWriter
write, write, write, write
 

Method Detail

setTitle

void setTitle(String title)
Sets document <TITLE> tag.

Parameters:
title - Document title.

setEmbeddedStyleSheet

void setEmbeddedStyleSheet(String styleSheet)
Sets embedded style sheet. Embedded style is the style attached to one specific document. The style information is specified as a content of the <STYLE> element inside the <HEAD> element and will apply to the entire document.

Parameters:
styleSheet -

setTableStyle

void setTableStyle(String style)
Sets the style of subsequent <TABLE> element.

Parameters:
style -

setRowStyle

void setRowStyle(String style)
Sets the style of subsequent table rows (<TR> elements).

Parameters:
style -

setCellStyle

void setCellStyle(String style)
Sets the style of subsequent table cells (<TD> elements>).

Parameters:
style -

writeText

void writeText(String text)
               throws Exception
Writes arbitrary text. This method is not intended for writing HTML tags, as any symbols that may be interpreted as part of HTML syntax will be escaped. For writing HTML tags use AQDataWriter.write(Object) method.

Parameters:
text - Text to be written.
Throws:
Exception

writeLink

void writeLink(String text,
               String url)
               throws Exception
Writes a hyperlink (<A HREF> element).

Parameters:
text - User-visible text.
url - Link URL.
Throws:
Exception

toHtml

String toHtml()
Returns generated HTML.


saveToFile

void saveToFile(String filename)
                throws Exception
Save the generated HTML to a file using UTF-8 encoding.

Parameters:
filename -
Throws:
Exception

saveToFile

void saveToFile(String filename,
                String encoding)
                throws Exception
Save the generated HTML to a file using the specified encoding.

Parameters:
filename -
encoding -
Throws:
Exception

close

void close()
           throws IOException
Closes this writer and releases any system resources associated with it. Once the file has been closed, further write() invocations will cause an exception to be thrown. Closing a previously closed stream has no effect.

Specified by:
close in interface AQDataWriter
Specified by:
close in interface Closeable
Throws:
IOException

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.