private static final Log log = LogFactory.getLog(DataListBoxRenderer.class);
public void decode(FacesContext facesContext, UIComponent component) {
DataListBoxComponent listBoxComponent = (DataListBoxComponent) component;
listBoxComponent.setSelectedRows(null);
if (isSubmitted(facesContext, component)) {
Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
String clientId = component.getClientId(facesContext);
String selection = (String) paramMap.get(clientId);
if(log.isDebugEnabled()){
log.debug("DataListBoxComponent " + component.getId() + " selection is " + selection);
}
if ((selection != null) && (selection.length() > 0)) {
String selections[] = selection.split(" ");
if (selections != null) {
List<Integer> selectedRows = new ArrayList<Integer>();
for(int i= 0; i < selections.length;i++){
String rowId = selections[i];
int lastIndex = rowId.lastIndexOf(":");
if(lastIndex != -1){
int rowIndex = Integer.parseInt(rowId.substring(lastIndex+1));
listBoxComponent.setRowIndex(rowIndex);
if(listBoxComponent.isRowAvailable()){
selectedRows.add(rowIndex);
}
}
}
listBoxComponent.setSelectedRows(selectedRows);
}
}
}
}