Class AbstractHtmlWriter
java.lang.Object
org.matwoess.jsourceprofiler.tool.profile.AbstractHtmlWriter
- Direct Known Subclasses:
ReportClassIndexWriter,ReportMethodIndexWriter,ReportSourceWriter
The abstract superclass for all HTML writers.
Contains common methods to generate parts of an HTML document and write them to a file.
Subclasses should implement the body() method to generate the main content of the HTML document.
The fields title, includeScripts, bodyScripts and cssFiles can be used to
customize the HTML document.
The getFileOutputPath() method should be overridden
to return the path to where the output file should be written to.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidbody()Should be overridden to generate the main content of the HTML document.voidbodyEnd()Appends the HTML body end tag to the internalcontentStringBuilder and includes all the body scripts.voidAppends the HTML body start tag to the internalcontentStringBuilder.voidgenerate()Generates the full HTML document out of all helper methods.abstract PathReturns the path to where the output file should be written to.voidheader()Appends the HTML header to the internalcontentStringBuilder.voidWrites the custom heading to the internalcontentStringBuilder.voidwrite()Writes the generated HTML document to the file specified bygetFileOutputPath().
-
Field Details
-
title
-
includeScripts
-
bodyScripts
-
cssFiles
-
-
Constructor Details
-
AbstractHtmlWriter
public AbstractHtmlWriter()
-
-
Method Details
-
header
public void header()Appends the HTML header to the internalcontentStringBuilder.Includes the doctype, the html and head tags, the title, the included scripts and the css style.
-
bodyStart
public void bodyStart()Appends the HTML body start tag to the internalcontentStringBuilder. -
heading
Writes the custom heading to the internalcontentStringBuilder.- Parameters:
heading- the page title string
-
body
public abstract void body()Should be overridden to generate the main content of the HTML document. -
bodyEnd
public void bodyEnd()Appends the HTML body end tag to the internalcontentStringBuilder and includes all the body scripts. -
generate
public void generate()Generates the full HTML document out of all helper methods. -
write
public void write()Writes the generated HTML document to the file specified bygetFileOutputPath().Parent directories are created if they do not exist.
-
getFileOutputPath
Returns the path to where the output file should be written to. Should be overridden by subclasses.- Returns:
- the destination path of the output file
-