public void decode(FacesContext context, UIComponent component) {
validateParameters(context, component);
RowSelectorComponent rowSelector = (RowSelectorComponent) component;
UIData data = getEnclosingData(rowSelector);
// We store the List of selected data objects in a request context attribute and add to it as the data table's
// rows are iterated during the updateModelValues phase. If the row is selected, we add the corresponding
// data object to the List.
List selectedDataObjects = getSelectedRowDataObjects(context, data);
// Always set the submitted value, so that, even if no rows were selected, the setter on the managed bean will
// still be passed an empty List, rather than null.
rowSelector.setSubmittedValue(selectedDataObjects);
Set<String> selectedRowKeys = getSelectedRowKeys(context, data, rowSelector);
String rowKeyString = getRowKeyAsString(context, component, data);
if (selectedRowKeys.contains(rowKeyString)) {
// The current row is selected - add the row's data object to our List.
Object rowData = data.getRowData();
selectedDataObjects.add(rowData);
}
}