org.displaytag.export
Class BaseExportView

java.lang.Object
  extended by org.displaytag.export.BaseExportView
All Implemented Interfaces:
ExportView, TextExportView
Direct Known Subclasses:
CsvView, ExcelView, XmlView

public abstract class BaseExportView
extends java.lang.Object
implements TextExportView

Base abstract class for simple export views.

A class that extends BaseExportView simply need to provide delimiters for rows and columns.

Version:
$Revision: 1081 $ ($Author: fgiust $)
Author:
Fabrizio Giustina

Constructor Summary
BaseExportView()
           
 
Method Summary
 void doExport(java.io.Writer out)
          Returns the exported content as a String.
protected  java.lang.String doHeaders()
          Write table header.
protected abstract  java.lang.String escapeColumnValue(java.lang.Object value)
          can be implemented to escape values for different output.
protected abstract  boolean getAlwaysAppendCellEnd()
          always append cell end string?
protected abstract  boolean getAlwaysAppendRowEnd()
          always append row end string?
protected abstract  java.lang.String getCellEnd()
          String to add after a cell.
protected  java.lang.String getCellStart()
          String to add before a cell.
protected  java.lang.String getDocumentEnd()
          String to add to the end of document.
protected  java.lang.String getDocumentStart()
          String to add to the top of document.
protected  java.lang.String getRowEnd()
          String to add after a row.
protected  java.lang.String getRowStart()
          String to add before a row.
 boolean outputPage()
          If true exported data will be included in the html page.
 void setParameters(TableModel tableModel, boolean exportFullList, boolean includeHeader, boolean decorateValues)
          initialize the parameters needed for export.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.displaytag.export.ExportView
getMimeType
 

Constructor Detail

BaseExportView

public BaseExportView()
Method Detail

setParameters

public void setParameters(TableModel tableModel,
                          boolean exportFullList,
                          boolean includeHeader,
                          boolean decorateValues)
Description copied from interface: ExportView
initialize the parameters needed for export. The method is guarantee be called before doExport() and getMimeType(). Classes implementing ExportView should reset any instance field previously set when this method is called, in order to support instance reusing.

Specified by:
setParameters in interface ExportView
Parameters:
tableModel - TableModel to render
exportFullList - boolean export full list?
includeHeader - should header be included in export?
decorateValues - should output be decorated?
See Also:
ExportView.setParameters(org.displaytag.model.TableModel, boolean, boolean, boolean)

getRowStart

protected java.lang.String getRowStart()
String to add before a row.

Returns:
String

getRowEnd

protected java.lang.String getRowEnd()
String to add after a row.

Returns:
String

getCellStart

protected java.lang.String getCellStart()
String to add before a cell.

Returns:
String

getCellEnd

protected abstract java.lang.String getCellEnd()
String to add after a cell.

Returns:
String

getDocumentStart

protected java.lang.String getDocumentStart()
String to add to the top of document.

Returns:
String

getDocumentEnd

protected java.lang.String getDocumentEnd()
String to add to the end of document.

Returns:
String

getAlwaysAppendCellEnd

protected abstract boolean getAlwaysAppendCellEnd()
always append cell end string?

Returns:
boolean

getAlwaysAppendRowEnd

protected abstract boolean getAlwaysAppendRowEnd()
always append row end string?

Returns:
boolean

escapeColumnValue

protected abstract java.lang.String escapeColumnValue(java.lang.Object value)
can be implemented to escape values for different output.

Parameters:
value - original column value
Returns:
escaped column value

doHeaders

protected java.lang.String doHeaders()
Write table header.

Returns:
String rendered header

doExport

public void doExport(java.io.Writer out)
              throws java.io.IOException,
                     javax.servlet.jsp.JspException
Description copied from interface: TextExportView
Returns the exported content as a String.

Specified by:
doExport in interface TextExportView
Parameters:
out - output writer
Throws:
java.io.IOException - for exceptions in accessing the output stream
javax.servlet.jsp.JspException - for other exceptions during export
See Also:
TextExportView.doExport(java.io.Writer)

outputPage

public boolean outputPage()
Description copied from interface: TextExportView
If true exported data will be included in the html page. actually not evaluated. Included for future enhancements

Specified by:
outputPage in interface TextExportView
Returns:
true if exported data should be included in the html page
See Also:
TextExportView.outputPage()


Copyright © 2002-2007 the Displaytag team. All Rights Reserved.