Spring Web Flow

org.springframework.faces.model
Class OneSelectionTrackingListDataModel<T>

java.lang.Object
  extended by javax.faces.model.DataModel<E>
      extended by javax.faces.model.ListDataModel<T>
          extended by org.springframework.faces.model.SerializableListDataModel<T>
              extended by org.springframework.faces.model.OneSelectionTrackingListDataModel<T>
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<T>, SelectionAware<T>

public class OneSelectionTrackingListDataModel<T>
extends SerializableListDataModel<T>
implements SelectionAware<T>

A DataModel implementation that tracks the currently selected row, allowing only one selection at a time.

Author:
Jeremy Grelle
See Also:
Serialized Form

Constructor Summary
OneSelectionTrackingListDataModel()
           
OneSelectionTrackingListDataModel(java.util.List<T> list)
           
 
Method Summary
 java.lang.Object getSelectedRow()
           
 java.util.List<T> getSelections()
          Returns the list of selected row data objects for the model.
 boolean isCurrentRowSelected()
          Checks whether the row pointed to by the model's current index is selected.
 void select(T rowData)
          Selects the given row data object in the model.
 void selectAll()
          Selects all row data objects in the model.
 void setCurrentRowSelected(boolean rowSelected)
          Sets whether the row pointed to by the model's current index is selected
 void setSelections(java.util.List<T> selections)
          Sets the list of selected row data objects for the model.
 
Methods inherited from class org.springframework.faces.model.SerializableListDataModel
getWrappedData, setWrappedData, toString
 
Methods inherited from class javax.faces.model.ListDataModel
getRowCount, getRowData, getRowIndex, isRowAvailable, setRowIndex
 
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, wait, wait, wait
 

Constructor Detail

OneSelectionTrackingListDataModel

public OneSelectionTrackingListDataModel()

OneSelectionTrackingListDataModel

public OneSelectionTrackingListDataModel(java.util.List<T> list)
Method Detail

getSelections

public java.util.List<T> getSelections()
Description copied from interface: SelectionAware
Returns the list of selected row data objects for the model.

Specified by:
getSelections in interface SelectionAware<T>
Returns:
the list of selected row data objects

isCurrentRowSelected

public boolean isCurrentRowSelected()
Description copied from interface: SelectionAware
Checks whether the row pointed to by the model's current index is selected.

Specified by:
isCurrentRowSelected in interface SelectionAware<T>
Returns:
true if the current row data object is selected

select

public void select(T rowData)
Description copied from interface: SelectionAware
Selects the given row data object in the model.

Specified by:
select in interface SelectionAware<T>
Parameters:
rowData - the row data object to select.

selectAll

public void selectAll()
Description copied from interface: SelectionAware
Selects all row data objects in the model.

Specified by:
selectAll in interface SelectionAware<T>

setCurrentRowSelected

public void setCurrentRowSelected(boolean rowSelected)
Description copied from interface: SelectionAware
Sets whether the row pointed to by the model's current index is selected

Specified by:
setCurrentRowSelected in interface SelectionAware<T>
Parameters:
rowSelected - true to select the current row

setSelections

public void setSelections(java.util.List<T> selections)
Description copied from interface: SelectionAware
Sets the list of selected row data objects for the model.

Specified by:
setSelections in interface SelectionAware<T>
Parameters:
selections - the list of selected row data objects

getSelectedRow

public java.lang.Object getSelectedRow()

Spring Web Flow