@SuppressWarnings("unchecked") protected void whenClassroomsTableSelectionChanged(ListSelectionEvent anEvent) { DefaultListSelectionModel source = (DefaultListSelectionModel) anEvent.getSource(); if (source.isSelectionEmpty()) { classroomSelected = null; moveAssignmentOfClassroomButton.setEnabled(false); } else { int index = source.getMinSelectionIndex(); List<Classroom> model = ((ReadOnlyTableModel<Classroom>) classroomsTable.getModel()).getModel(); classroomSelected = model.get(index); moveAssignmentOfClassroomButton.setEnabled( !classroomSelected.equals(assignment.getAssignableItem())); } }
@Override public boolean isSelectionEmpty() { return delegate.isSelectionEmpty(); }