com.sun.jsfcl.data
Class CachedRowSetDataModel

java.lang.Object
  extended byjavax.faces.model.DataModel
      extended bycom.sun.jsfcl.data.CachedRowSetDataModel

public class CachedRowSetDataModel
extends javax.faces.model.DataModel

CachedRowSetDataModel is a convenience implementation of DataModel that wraps a CachedRowSet of Java objects. Note that the specified CachedRowSet MUST be scrollable. In addition, if input components (that will be updating model values) reference this object in value binding expressions, the specified CachedRowSet MUST be updatable.


Constructor Summary
CachedRowSetDataModel()
          Construct a new CachedRowSetDataModel with no specified wrapped data.
CachedRowSetDataModel(javax.sql.rowset.CachedRowSet cachedRowSet)
          Construct a new CachedRowSetDataModel wrapping the specified CachedRowSet.
 
Method Summary
 javax.sql.rowset.CachedRowSet getCachedRowSet()
          Return the CachedRowSet we are connected with, if any; otherwise, return null.
 int getRowCount()
          Return -1, since CachedRowSet does not provide a standard way to determine the number of available rows without scrolling through the entire CachedRowSet, and this can be very expensive if the number of rows is large.
 java.lang.Object getRowData()
          If row data is available, return a Map representing the values of the columns for the row specified by rowIndex, keyed by the corresponding column names.
 int getRowIndex()
           
 java.lang.Object getWrappedData()
           
 boolean isRowAvailable()
          Return true if there is wrappedData available, and the result of calling absolute() on the underlying CachedRowSet, passing the current value of rowIndex plus one (to account for the fact that CachedRowSet uses one-relative indexing), returns true.
 void setCachedRowSet(javax.sql.rowset.CachedRowSet rowSet)
          Set the CachedRowSet we are connected with, or pass null to disconnect.
 void setRowIndex(int rowIndex)
           
 void setWrappedData(java.lang.Object data)
           
 
Methods inherited from class javax.faces.model.DataModel
addDataModelListener, getDataModelListeners, removeDataModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedRowSetDataModel

public CachedRowSetDataModel()

Construct a new CachedRowSetDataModel with no specified wrapped data.


CachedRowSetDataModel

public CachedRowSetDataModel(javax.sql.rowset.CachedRowSet cachedRowSet)

Construct a new CachedRowSetDataModel wrapping the specified CachedRowSet.

Parameters:
cachedRowSet - CachedRowSet to be wrapped (if any)
Method Detail

isRowAvailable

public boolean isRowAvailable()

Return true if there is wrappedData available, and the result of calling absolute() on the underlying CachedRowSet, passing the current value of rowIndex plus one (to account for the fact that CachedRowSet uses one-relative indexing), returns true. Otherwise, return false.

Throws:
javax.faces.FacesException - if an error occurs getting the row availability

getRowCount

public int getRowCount()

Return -1, since CachedRowSet does not provide a standard way to determine the number of available rows without scrolling through the entire CachedRowSet, and this can be very expensive if the number of rows is large.

Throws:
javax.faces.FacesException - if an error occurs getting the row count

getRowData

public java.lang.Object getRowData()

If row data is available, return a Map representing the values of the columns for the row specified by rowIndex, keyed by the corresponding column names. If no wrapped data is available, return null.

If a non-null Map is returned, its behavior must correspond to the contract for a mutable Map as described in the JavaDocs for AbstractMap, with the following exceptions and specialized behavior:

Throws:
javax.faces.FacesException - if an error occurs getting the row data
java.lang.IllegalArgumentException - if now row data is available at the currently specified row index

getRowIndex

public int getRowIndex()
Throws:
javax.faces.FacesException

setRowIndex

public void setRowIndex(int rowIndex)
Throws:
javax.faces.FacesException
java.lang.IllegalArgumentException

getWrappedData

public java.lang.Object getWrappedData()

setWrappedData

public void setWrappedData(java.lang.Object data)
Throws:
java.lang.ClassCastException

getCachedRowSet

public javax.sql.rowset.CachedRowSet getCachedRowSet()

Return the CachedRowSet we are connected with, if any; otherwise, return null. This is a type=safe alias for getWrappedData().


setCachedRowSet

public void setCachedRowSet(javax.sql.rowset.CachedRowSet rowSet)

Set the CachedRowSet we are connected with, or pass null to disconnect. This is a type-safe alias for setWrappedData().

Parameters:
rowSet - The CachedRowSet we are connected to, or null to disconnect