com.webmethods.caf.faces.data.export
Class DataTableExportProvider

java.lang.Object
  extended by com.webmethods.caf.faces.data.export.DataTableExportProvider
All Implemented Interfaces:
IContentProvider, ITableContentProvider
Direct Known Subclasses:
AtomEntriesTableExportProvider, CSVTableExportProvider

public class DataTableExportProvider
extends Object
implements ITableContentProvider

Adapts a UIData component to an ITableContentProvider, which can be used to export the table's content (for example, as the content provider for a CSVExportBean).


Field Summary
protected  Map m_columnLabelMap
          Map of property keys to column labels.
protected  Map m_columnMap
          Map of property keys to columns.
protected  ResponseWriter m_htmlResponseBuffer
          Temporary buffer into which the html of each column is rendered.
protected  StringWriter m_htmlResponseBufferBackingWriter
          Backing buffer for the m_htmlResponseBuffer.
protected  Object[] m_propertyKeys
          Property keys cache.
protected  ResponseWriter m_responseBuffer
          Temporary buffer into which the content of each column is rendered.
protected  UIData m_table
          Table providing export content.
protected static Pattern RE_IS_DUMMY_ID
           
protected static Pattern RE_STRIP_COLUMN_FROM_ID
           
 
Constructor Summary
DataTableExportProvider()
           
DataTableExportProvider(UIData table)
           
 
Method Summary
protected  String clearHTMLResponseBuffer()
          Clears the temporary response buffer, returning its content (or "").
protected  String clearResponseBuffer()
          Clears the temporary response buffer, returning its content (or "").
protected  Map getColumnLabelMap()
           
protected  Map getColumnMap()
           
 Object getCurrentRow()
           Returns wrapped current row object.
protected  ResponseWriter getHTMLResponseBuffer()
          Temporary response buffer.
 Object[] getPropertyKeys()
          Returns list of properties supported by this content provider.
protected  ResponseWriter getResponseBuffer()
          Temporary response buffer.
 int getRowCount()
          Return the number of rows of data objects represented by this DataModel.
 int getRowIndex()
          Return the zero-relative index of the currently selected row.
 String getRowVariable()
           Returns row variable name.
 UIData getTable()
           
 Class getType(Object propertyKey)
          Returns java type of the given property
 Object getValue(Object propertyKey)
          Returns value of the given property
 boolean hasProperty(Object propertyKey)
          Checks if the given property is supported by this content provider
 boolean isRowAvailable()
          Return a flag indicating whether there is rowData available at the current rowIndex.
 void refresh()
           
protected  String render(UIComponent component)
          Renders specified component, returning its content (or "").
protected  String renderAsHTML(UIComponent component)
          Renders specified component, returning its content (or "").
 void setRowIndex(int rowIndex)
          Set the zero-relative index of the currently selected row, or -1 to indicate that we are not positioned on a row.
 void setRowVariable(String var)
           Sets row variable name to use for accessing row specific data.
 void setTable(UIData table)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.webmethods.caf.faces.data.IContentProvider
toString
 

Field Detail

RE_IS_DUMMY_ID

protected static final Pattern RE_IS_DUMMY_ID

RE_STRIP_COLUMN_FROM_ID

protected static final Pattern RE_STRIP_COLUMN_FROM_ID

m_table

protected UIData m_table
Table providing export content.


m_propertyKeys

protected Object[] m_propertyKeys
Property keys cache.


m_columnMap

protected Map m_columnMap
Map of property keys to columns.


m_columnLabelMap

protected Map m_columnLabelMap
Map of property keys to column labels.


m_responseBuffer

protected ResponseWriter m_responseBuffer
Temporary buffer into which the content of each column is rendered.


m_htmlResponseBuffer

protected ResponseWriter m_htmlResponseBuffer
Temporary buffer into which the html of each column is rendered.


m_htmlResponseBufferBackingWriter

protected StringWriter m_htmlResponseBufferBackingWriter
Backing buffer for the m_htmlResponseBuffer.

Constructor Detail

DataTableExportProvider

public DataTableExportProvider()

DataTableExportProvider

public DataTableExportProvider(UIData table)
Method Detail

getPropertyKeys

public Object[] getPropertyKeys()
Description copied from interface: IContentProvider
Returns list of properties supported by this content provider. Can return Object[0], never null.

Specified by:
getPropertyKeys in interface IContentProvider
Returns:
array of property keys which is typically of type String or Integer

getType

public Class getType(Object propertyKey)
              throws PropertyNotFoundException
Description copied from interface: IContentProvider
Returns java type of the given property

Specified by:
getType in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
property java Class
Throws:
PropertyNotFoundException - if property is not supported

getValue

public Object getValue(Object propertyKey)
                throws EvaluationException,
                       PropertyNotFoundException
Description copied from interface: IContentProvider
Returns value of the given property

Specified by:
getValue in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
value of the property, can be null
Throws:
EvaluationException - if error during property evaluation
PropertyNotFoundException - if property is not supported

hasProperty

public boolean hasProperty(Object propertyKey)
Description copied from interface: IContentProvider
Checks if the given property is supported by this content provider

Specified by:
hasProperty in interface IContentProvider
Parameters:
propertyKey - property key of type String or Integer
Returns:
true if property is supported

refresh

public void refresh()
             throws ContentProviderException
Throws:
ContentProviderException

getCurrentRow

public Object getCurrentRow()
Description copied from interface: ITableContentProvider

Returns wrapped current row object. Can be null if not data is available

Specified by:
getCurrentRow in interface ITableContentProvider
Returns:
current row object
See Also:
ITableContentProvider.isRowAvailable()

getRowCount

public int getRowCount()
Description copied from interface: ITableContentProvider
Return the number of rows of data objects represented by this DataModel.

Return -1, if the number of rows is unknown, or no wrappedData is available.

Specified by:
getRowCount in interface ITableContentProvider
See Also:
DataModel

getRowIndex

public int getRowIndex()
Description copied from interface: ITableContentProvider
Return the zero-relative index of the currently selected row.

If we are not currently positioned on a row, or no wrappedData is available, return -1.

Specified by:
getRowIndex in interface ITableContentProvider
See Also:
DataModel

getRowVariable

public String getRowVariable()
Description copied from interface: ITableContentProvider

Returns row variable name.

If specified row variable can be used to access current row data for the provider internal needs, like sorting or addressing.

Specified by:
getRowVariable in interface ITableContentProvider
Returns:
row variable name or null if not specified
See Also:
ITableContentProvider.setRowVariable(String)

isRowAvailable

public boolean isRowAvailable()
Description copied from interface: ITableContentProvider
Return a flag indicating whether there is rowData available at the current rowIndex. If no wrappedData is available, return false.

Specified by:
isRowAvailable in interface ITableContentProvider
See Also:
DataModel

setRowIndex

public void setRowIndex(int rowIndex)
Description copied from interface: ITableContentProvider
Set the zero-relative index of the currently selected row, or -1 to indicate that we are not positioned on a row.

Specified by:
setRowIndex in interface ITableContentProvider
See Also:
DataModel

setRowVariable

public void setRowVariable(String var)
Description copied from interface: ITableContentProvider

Sets row variable name to use for accessing row specific data. For example, if the provider wrapps an array of a data objects with id property and the variable name is item, then the provider implementation can access id property of each record as item.id.

This property should set only once at the provider initialization time

Specified by:
setRowVariable in interface ITableContentProvider

render

protected String render(UIComponent component)
Renders specified component, returning its content (or "").


getResponseBuffer

protected ResponseWriter getResponseBuffer()
Temporary response buffer.


clearResponseBuffer

protected String clearResponseBuffer()
Clears the temporary response buffer, returning its content (or "").


renderAsHTML

protected String renderAsHTML(UIComponent component)
Renders specified component, returning its content (or "").


getHTMLResponseBuffer

protected ResponseWriter getHTMLResponseBuffer()
Temporary response buffer.


clearHTMLResponseBuffer

protected String clearHTMLResponseBuffer()
Clears the temporary response buffer, returning its content (or "").


getTable

public UIData getTable()

setTable

public void setTable(UIData table)

getColumnMap

protected Map getColumnMap()

getColumnLabelMap

protected Map getColumnLabelMap()