Style Intelligence v12.0

inetsoft.report.io
Class HTMLGenerator

java.lang.Object
  extended by inetsoft.report.io.AbstractGenerator
      extended by inetsoft.report.io.HTMLGenerator
All Implemented Interfaces:
Generator

public class HTMLGenerator
extends AbstractGenerator

Generates an HTML page from a report or a set of StylePages.


Field Summary
protected  PrintWriter writer
           
 
Fields inherited from class inetsoft.report.io.AbstractGenerator
docInfo
 
Constructor Summary
HTMLGenerator(OutputStream output)
          Create an HTMLGenerator.
HTMLGenerator(OutputStream output, boolean pagination)
          Create an HTMLGenerator.
 
Method Summary
protected  void cacheImage(Rectangle bounds, Painter painter, Image buf)
          Cache same image with same size and from same painter.
 void cancel()
          Cancel the generation if one is going on.
 void dispose()
          Dispose the generator.
protected  void finalize()
          Finalize the generator.
 void generate(Enumeration pages)
          Write a collection of pages to html.
 void generate(ReportSheet sheet)
          Export a report.
 void generate(ReportSheet sheet, Enumeration pages)
          Write a collection of pages to text.
protected  Image getCachedImage(Rectangle bounds, Painter painter)
          get the cached image with same size and from same painter.
 byte[] getFile(String fname)
          Get a cached data file (e.g.
protected  String getImageFileName(String suffix)
          Return the image file name.
 Collection getImages()
          Get the list of the images generated as a part of the report.
protected  String getImageURI(String name)
          Get the URI to access a generated image.
 String getImageURIPrefix()
          Get the URI prefix for generated image files.
protected  OutputStream getOutputStream(String fname)
          Get an output stream for an image or resource.
 Dimension getPageSize()
          Deprecated. replaced by ReportSheet.getPageSize().
protected  String getResourceURI(String name)
          Get the URI to access a resource.
 boolean isForEmail()
          A true value will change the HTML export process to support inlined-HTML within email.
 boolean isIncludeScript()
          Get includeScript
 void setDataOutput(Object loc)
          Set the location for data files, such as images.
 void setForEmail(boolean forEmail)
          Controls whether the HTML generation should export the HTML to support inlined-HTML within the email body.
 void setImageURIPrefix(String prefix)
          Set the URI prefix for generated image files.
 void setIncludeScript(boolean includeScript)
          Set includeScript
 void setOutput(OutputStream output)
          Set the output stream of this generator.
 void setPageSize(Size size)
          Deprecated. replaced by ReportSheet.setPageSize().
protected  String writeImage(Image buf)
          Write an image to a file.
protected  void writePages(Enumeration pages)
          Write a set of pages to an HTML file.
 
Methods inherited from class inetsoft.report.io.AbstractGenerator
addProgressListener, fireProgressEvent, getCachePages, getOutput, getReportCache, getReportId, removeProgressListener, setDocumentInfo, setReportCache, setReportId
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

protected PrintWriter writer
Constructor Detail

HTMLGenerator

public HTMLGenerator(OutputStream output)
Create an HTMLGenerator.

Parameters:
output - the output stream.

HTMLGenerator

public HTMLGenerator(OutputStream output,
                     boolean pagination)
Create an HTMLGenerator.

Parameters:
output - the output stream.
pagination - false if generate without any page break, page header or page footer.
Method Detail

setOutput

public void setOutput(OutputStream output)
Set the output stream of this generator.

Specified by:
setOutput in interface Generator
Overrides:
setOutput in class AbstractGenerator

setPageSize

public void setPageSize(Size size)
Deprecated. replaced by ReportSheet.setPageSize().

Set the page size in inches. Common paper sizes are defined as constants in StyleConstants.

Parameters:
size - Size object in inches.

getPageSize

public Dimension getPageSize()
Deprecated. replaced by ReportSheet.getPageSize().

Get the page size in pixel.


setDataOutput

public void setDataOutput(Object loc)
Set the location for data files, such as images. The parameter can be a file or a directory. If it's a file, it must be a zip file and data files are written into the zip file as entries. If it's a directory, the data files are written in the directory. The loc can also be a ZipOutputStream, in which case it is used directly to store all data files.


setImageURIPrefix

public void setImageURIPrefix(String prefix)
Set the URI prefix for generated image files.


getImageURIPrefix

public String getImageURIPrefix()
Get the URI prefix for generated image files.


getFile

public byte[] getFile(String fname)
Get a cached data file (e.g. image). This data is only cached if no data location distination is set.


generate

public void generate(ReportSheet sheet)
              throws IOException
Export a report.

Parameters:
sheet - report to export.
Throws:
IOException

generate

public void generate(Enumeration pages)
              throws IOException
Write a collection of pages to html.

Throws:
IOException

generate

public void generate(ReportSheet sheet,
                     Enumeration pages)
              throws IOException
Write a collection of pages to text.

Throws:
IOException

setIncludeScript

public void setIncludeScript(boolean includeScript)
Set includeScript


isIncludeScript

public boolean isIncludeScript()
Get includeScript


writePages

protected void writePages(Enumeration pages)
                   throws IOException
Write a set of pages to an HTML file.

Parameters:
pages - a collection of StylePage objects.
Throws:
IOException

cancel

public void cancel()
Cancel the generation if one is going on.


getImageFileName

protected String getImageFileName(String suffix)
Return the image file name. Subclass can override this method to control the image file names.

Parameters:
suffix - image type suffix, including a dot, e.g. ".png".

writeImage

protected String writeImage(Image buf)
Write an image to a file.


getImages

public Collection getImages()
Get the list of the images generated as a part of the report.


getResourceURI

protected String getResourceURI(String name)
Get the URI to access a resource.


getImageURI

protected String getImageURI(String name)
Get the URI to access a generated image.


getOutputStream

protected OutputStream getOutputStream(String fname)
                                throws IOException
Get an output stream for an image or resource.

Throws:
IOException

getCachedImage

protected Image getCachedImage(Rectangle bounds,
                               Painter painter)
get the cached image with same size and from same painter.


cacheImage

protected void cacheImage(Rectangle bounds,
                          Painter painter,
                          Image buf)
Cache same image with same size and from same painter.


dispose

public void dispose()
Dispose the generator.


finalize

protected void finalize()
                 throws Throwable
Finalize the generator.

Overrides:
finalize in class Object
Throws:
Throwable

isForEmail

public boolean isForEmail()
A true value will change the HTML export process to support inlined-HTML within email. This allows for content-id referenced images for example.

Returns:
true if the export should encode the HTML for email body.

setForEmail

public void setForEmail(boolean forEmail)
Controls whether the HTML generation should export the HTML to support inlined-HTML within the email body.

Parameters:
forEmail - true to encode for email body

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.