// Unfortunately, we need to tie the list selection and the model together, so that we can
// get and set the element list from the model
// ListElementValueModelConverter elementConverter = this.getElementConverter(selectedItemProperty, newList);
//SelectionInList selection = new SelectionInList(newList,elementConverter);
SelectionInList selection = this.getSelectionInList(selectedItemProperty, newList);
list.setModel(new ScrollListModel(selection, list, pIsSingleSelect));
if (pIsSingleSelect) {
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setSelectionModel( new SingleListSelectionAdapter(
selection.getSelectionIndexHolder()));
// Force a selection if we're in single selection mode...
if (list.getSelectedIndex() == -1) {
list.setSelectedIndex(0);
}
}
else {
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
list.setSelectionModel(new ToggleListSelectionModel());
list.addListSelectionListener(new SelectionCounterAdapter(list, selection.getSelectionIndexHolder()));
}
//Bindings.bind(list,getSelectionInList(selectedItemProperty,elements));
}