javax.faces.model
Class ScalarDataModel<E>

java.lang.Object
  extended by javax.faces.model.DataModel<E>
      extended by javax.faces.model.ScalarDataModel<E>
All Implemented Interfaces:
Iterable<E>

public class ScalarDataModel<E>
extends DataModel<E>

see Javadoc of JSF Specification

Version:
$Revision: 1187701 $ $Date: 2011-10-22 07:21:54 -0500 (Sat, 22 Oct 2011) $
Author:
Thomas Spiegl (latest modification by $Author: bommel $)

Constructor Summary
ScalarDataModel()
           
ScalarDataModel(E scalar)
           
 
Method Summary
 int getRowCount()
           Return the number of rows of data available.
 E getRowData()
          Return the object associated with the current row index.
 int getRowIndex()
          Get the current row index.
 Object getWrappedData()
          Get the entire collection of data associated with this component.
 boolean isRowAvailable()
          Returns true if a call to getRowData will return a valid object.
 void setRowIndex(int rowIndex)
          Set the current row index.
 void setWrappedData(Object data)
          Set the entire list of data associated with this component.
 
Methods inherited from class javax.faces.model.DataModel
addDataModelListener, getDataModelListeners, iterator, removeDataModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScalarDataModel

public ScalarDataModel()

ScalarDataModel

public ScalarDataModel(E scalar)
Method Detail

getRowCount

public int getRowCount()
Description copied from class: DataModel

Return the number of rows of data available.

If the number of rows of data available is not known then -1 is returned. This may happen for DataModels that wrap sources of data such as java.sql.ResultSet that provide an iterator to access the "next item" rather than a fixed-size collection of data.

Specified by:
getRowCount in class DataModel<E>
Returns:
the number of rows available.

getRowData

public E getRowData()
Description copied from class: DataModel
Return the object associated with the current row index.

Method isRowAvailable may be called before attempting to access this method, to ensure that the data is available.

Specified by:
getRowData in class DataModel<E>
Returns:
The object associated with the current row index.

getRowIndex

public int getRowIndex()
Description copied from class: DataModel
Get the current row index.

Specified by:
getRowIndex in class DataModel<E>
Returns:
The current row index.

getWrappedData

public Object getWrappedData()
Description copied from class: DataModel
Get the entire collection of data associated with this component. Note that the actual type of the returned object depends upon the concrete subclass of DataModel; the object will represent an "ordered sequence of components", but may be implemented as an array, java.util.List, java.sql.ResultSet or other similar types.

Specified by:
getWrappedData in class DataModel<E>
Returns:
the wrapped object.

isRowAvailable

public boolean isRowAvailable()
Description copied from class: DataModel
Returns true if a call to getRowData will return a valid object.

Specified by:
isRowAvailable in class DataModel<E>
Returns:
true if a call to getRowData will return a valid object. false otherwise.

setRowIndex

public void setRowIndex(int rowIndex)
Description copied from class: DataModel
Set the current row index. This affects the behaviour of the getRowData method in particular.

Specified by:
setRowIndex in class DataModel<E>
Parameters:
rowIndex - The row index. It may be -1 to indicate "no row", or may be a value between 0 and getRowCount()-1.

setWrappedData

public void setWrappedData(Object data)
Description copied from class: DataModel
Set the entire list of data associated with this component. Note that the actual type of the provided object must match the expectations of the concrete subclass of DataModel. See getWrappedData.

Specified by:
setWrappedData in class DataModel<E>
Parameters:
data - The object to be wrapped.


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.