Author: fdesbois Date: 2012-09-24 13:19:23 +0200 (Mon, 24 Sep 2012) New Revision: 589 Url: http://forge.codelutin.com/repositories/revision/sammoa/589 Log: fixes #1515 : problem with selection of transect Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/TableSelectionListener.java Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/TableSelectionListener.java =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/TableSelectionListener.java 2012-09-21 17:22:36 UTC (rev 588) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/util/TableSelectionListener.java 2012-09-24 11:19:23 UTC (rev 589) @@ -63,18 +63,25 @@ int lastIndex = e.getLastIndex(); Integer newSelectedRow = null; - if (listSelectionModel.isSelectionEmpty()) { + // Use the last selected row + for (int i = firstIndex; i <= lastIndex; i++) { + if (listSelectionModel.isSelectedIndex(i)) { + newSelectedRow = table.convertRowIndexToModel(i); + } + } - // no selection - } else if (listSelectionModel.isSelectedIndex(firstIndex)) { - - // use first index - newSelectedRow = table.convertRowIndexToModel(firstIndex); - } else if (listSelectionModel.isSelectedIndex(lastIndex)) { - - // use last index - newSelectedRow = table.convertRowIndexToModel(lastIndex); - } +// if (listSelectionModel.isSelectionEmpty()) { +// +// // no selection +// } else if (listSelectionModel.isSelectedIndex(firstIndex)) { +// +// // use first index +// newSelectedRow = table.convertRowIndexToModel(firstIndex); +// } else if (listSelectionModel.isSelectedIndex(lastIndex)) { +// +// // use last index +// newSelectedRow = table.convertRowIndexToModel(lastIndex); +// } List<T> elements = selectionModelAdapter.getElements(); T element = null;
participants (1)
-
fdesbois@users.forge.codelutin.com