| Method from org.jfree.report.modules.output.table.html.HtmlProducer Detail: |
public void beginPage(String name) {
super.beginPage(name);
if (isDummy() == false)
{
if (name != null)
{
pout.println(isGenerateXHTML() ? "< hr / >" : "< hr >");
pout.println("< h3 >");
pout.println(name);
pout.println("< /h3 >");
pout.println(isGenerateXHTML() ? "< hr / >" : "< hr >");
}
pout.println("< p >");
pout.println("< table cellspacing=\"0\" cellpadding=\"0\" >");
}
}
Start a new page, start a new table. |
public void close() {
if (isDummy() == false && isCreateBodyFragment() == false)
{
try
{
if (isCreateBodyFragment() == false)
{
pout.println("< /body >< /html >");
}
pout.flush();
filesystem.close();
}
catch (IOException ioe)
{
throw new FunctionProcessingException("Failed to write on close.", ioe);
}
}
isOpen = false;
}
Closes the target and writes all generated content into the root stream of the
filesystem after generating the StyleSheet information. |
public void commit() {
if (isDummy() == false)
{
generatePage(layoutGrid());
clearCells();
}
}
End the printing of an section and creates the html content for that section. |
public void configure(Properties configuration) {
super.configure(configuration);
this.cellDataFactory = new HtmlCellDataFactory(styleCollection, isGenerateXHTML());
}
Configures the table producer by reading the configuration settings from
the given map. |
protected String createHtmlBackgroundStyle(TableCellBackground bg) {
if (bg == null)
{
return null;
}
return styleCollection.getBackgroundStyle(bg);
}
Merges the backgrounds and creates the StyleSheet information for
the cell background. |
public void endPage() {
commit();
if (isDummy() == false)
{
pout.println("< /table >< /p >");
}
super.endPage();
}
End the page and closes the generated table of the page. |
public TableCellDataFactory getCellDataFactory() {
return cellDataFactory;
}
Gets the TableProducer implementation of this TableProducer. |
public String getEncoding() {
return String.valueOf(getProperty(ENCODING, ENCODING_DEFAULT));
}
Gets the defined file encoding for the main html file. |
public static CharacterEntityParser getEntityParser() {
if (entityParser == null)
{
entityParser = new CharacterEntityParser(new HtmlCharacterEntities());
}
return entityParser;
}
Gets the character entity parser for HTML content. The CharacterEntity parser
translates known characters into predefined entities. |
protected HtmlLayoutInfo getHtmlLayoutInfo() {
return (HtmlLayoutInfo) getGridBoundsCollection();
}
Returns the html layout info instance used to compute the layout. |
public boolean isCreateBodyFragment() {
return getProperty(BODY_FRAGMENT, "false").equals("true");
}
Checks, whether to create a html body fragment. This fragment contains
no html header an generates no global CSS section. |
protected boolean isGenerateXHTML() {
return getProperty(GENERATE_XHTML, "false").equals("true");
}
Checks, whether this target should generate XHTML instead of HTML4 code. |
public boolean isOpen() {
return isOpen;
}
Returns true, if the TableProducer is open. Only open producers
are able to write TableCells or to create TableCellData from Elements. |
public void open() {
isOpen = true;
if (isDummy() == false && isCreateBodyFragment() == false)
{
try
{
this.pout = new PrintWriter(new OutputStreamWriter
(filesystem.getRootStream(), getEncoding()), false);
// write the standard headers
if (isGenerateXHTML())
{
pout.print("< ?xml version=\"1.0\" encoding=\"");
pout.print(getEncoding());
pout.println("\"? >");
// now finish the style sheet definition
for (int i = 0; i < XHTML_HEADER.length; i++)
{
pout.println(XHTML_HEADER[i]);
}
}
else
{
// now finish the style sheet definition
for (int i = 0; i < HTML4_HEADER.length; i++)
{
pout.println(HTML4_HEADER[i]);
}
}
// the style sheet definition will be inserted right before the content is written ...
pout.print("< meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
pout.print(getEncoding());
if (isGenerateXHTML())
{
pout.println("\" / >");
}
else
{
pout.println("\" >");
}
final String title = String.valueOf(getProperty(TITLE));
if (title != null)
{
pout.print("< title >");
pout.print(getEntityParser().encodeEntities(title));
pout.println("< /title >");
}
final HtmlReferenceData cssRef = getGlobalCSSData();
// write the generated stylesheet ...
// is a href type ...
if (cssRef.isExternal())
{
pout.print("< link rel=\"stylesheet\" type=\"text/css\" ");
pout.print(cssRef.getReference());
if (isGenerateXHTML())
{
pout.println(" / >");
}
else
{
pout.println(" >");
}
}
else
{
pout.println("< style type=\"text/css\" >");
pout.print(cssRef.getReference());
pout.println("< /style >");
}
pout.println("< /head >");
pout.println("< body >");
}
catch (IOException ioe)
{
throw new FunctionProcessingException
("Failed to create the writer or write the header.", ioe);
}
}
}
Starts the report writing and prepares the cached output stream. |
public void setCreateBodyFragment(boolean createBodyFragment) {
setProperty(BODY_FRAGMENT, String.valueOf(createBodyFragment));
}
Defines, whether to create a html body fragment. This fragment contains
no html header an generates no global CSS section. |