Package org.springframework.faces.model
Class OneSelectionTrackingListDataModel<T>
java.lang.Object
jakarta.faces.model.DataModel<E>
jakarta.faces.model.ListDataModel<T>
org.springframework.faces.model.SerializableListDataModel<T>
org.springframework.faces.model.OneSelectionTrackingListDataModel<T>
- All Implemented Interfaces:
Serializable,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:
-
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionReturns the list of selected row data objects for the model.booleanChecks whether the row pointed to by the model's current index is selected.voidSelects the given row data object in the model.voidSelects all row data objects in the model.voidsetCurrentRowSelected(boolean rowSelected) Sets whether the row pointed to by the model's current index is selectedvoidsetSelections(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, toStringMethods inherited from class jakarta.faces.model.ListDataModel
getRowCount, getRowData, getRowIndex, isRowAvailable, setRowIndexMethods inherited from class jakarta.faces.model.DataModel
addDataModelListener, getDataModelListeners, iterator, removeDataModelListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
OneSelectionTrackingListDataModel
public OneSelectionTrackingListDataModel() -
OneSelectionTrackingListDataModel
-
-
Method Details
-
getSelections
Description copied from interface:SelectionAwareReturns the list of selected row data objects for the model.- Specified by:
getSelectionsin interfaceSelectionAware<T>- Returns:
- the list of selected row data objects
-
isCurrentRowSelected
public boolean isCurrentRowSelected()Description copied from interface:SelectionAwareChecks whether the row pointed to by the model's current index is selected.- Specified by:
isCurrentRowSelectedin interfaceSelectionAware<T>- Returns:
- true if the current row data object is selected
-
select
Description copied from interface:SelectionAwareSelects the given row data object in the model.- Specified by:
selectin interfaceSelectionAware<T>- Parameters:
rowData- the row data object to select.
-
selectAll
public void selectAll()Description copied from interface:SelectionAwareSelects all row data objects in the model.- Specified by:
selectAllin interfaceSelectionAware<T>
-
setCurrentRowSelected
public void setCurrentRowSelected(boolean rowSelected) Description copied from interface:SelectionAwareSets whether the row pointed to by the model's current index is selected- Specified by:
setCurrentRowSelectedin interfaceSelectionAware<T>- Parameters:
rowSelected- true to select the current row
-
setSelections
Description copied from interface:SelectionAwareSets the list of selected row data objects for the model.- Specified by:
setSelectionsin interfaceSelectionAware<T>- Parameters:
selections- the list of selected row data objects
-
getSelectedRow
-