示例#1
0
 public int getSelectedIndex() {
   int i1 = selection.getMinSelectionIndex(), i2 = selection.getMaxSelectionIndex();
   if (i1 == i2 && i1 >= 0 && i1 < filters.size()) {
     return i1;
   } else {
     return -1;
   }
 }
 @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()));
   }
 }
示例#3
0
  @Override
  public int getMaxSelectionIndex() {
    int min = delegate.getMinSelectionIndex();

    if (min >= 0) {
      int max = delegate.getMaxSelectionIndex();
      int viewMaxIndex = 0;

      for (int i = min; i <= max; i++) {
        int viewIndex = sortedModel.convertRowIndexToView(i);

        if (viewIndex > viewMaxIndex) {
          viewMaxIndex = viewIndex;
        }
      }

      return viewMaxIndex;
    }

    return -1;
  }