Table of Contents
Now that you've got the JList displaying
issue users, it's just a few steps to make that filter the main issues
table.
Along with ListModel, and
TableModel, Glazed Lists provides a
ListSelectionModel that eliminates all of the
index manipulation related to selection handling.
EventSelectionModel brings you two advantages
over Swing's standard
DefaultListSelectionModel:
It publishes an EventList containing a
live view of the current selection. Access the selected elements
like they're in an ArrayList.
It fixes a problem with the standard ListSelectionModel's
MULTIPLE_INTERVAL_SELECTION mode. In that
mode, rows inserted within the selected range become selected. This
is quite annoying when removing a filter because restored elements
become selected. The fix is in
EventSelectionModel's default selection mode,
MULTIPLE_INTERVAL_SELECTION_DEFENSIVE. In
this mode, rows must be explicitly selected by your user.
You'll enjoy accessing selection from an
EventList. For example, you can use the familiar
methods List.isEmpty() and
List.contains() in new ways:
if(usersSelectedList.isEmpty()) return true;
...
String user = issue.getAssignedTo();
return usersSelectedList.contains(user);