prevent index out of bounds during multiselect

This commit is contained in:
jmillman 2015-06-05 15:24:20 -04:00
parent e1a6f2a8c2
commit cfe9e44b97
2 changed files with 3 additions and 2 deletions

View File

@ -781,9 +781,9 @@ public class GroupPane extends BorderPane implements GroupView {
if (shiftDown) {
//TODO: do more hear to implement slicker multiselect
int endIndex = grouping.get().fileIds().indexOf(newFileID);
int startIndex = IntStream.of(0, grouping.get().fileIds().size(), selectionAnchorIndex, endIndex).min().getAsInt();
int startIndex = IntStream.of(grouping.get().fileIds().size(), selectionAnchorIndex, endIndex).min().getAsInt();
endIndex = IntStream.of(0, selectionAnchorIndex, endIndex).max().getAsInt();
List<Long> subList = grouping.get().fileIds().subList(startIndex, endIndex + 1);
List<Long> subList = grouping.get().fileIds().subList(Math.max(0, startIndex), Math.min(endIndex, grouping.get().fileIds().size()) + 1);
globalSelectionModel.clearAndSelectAll(subList.toArray(new Long[subList.size()]));
globalSelectionModel.select(newFileID);

View File

@ -255,6 +255,7 @@ public abstract class SingleDrawableViewBase extends AnchorPane implements Drawa
protected abstract String getLabelText();
@SuppressWarnings("deprecation")
protected void initialize() {
followUpToggle.setOnAction((ActionEvent t) -> {
if (followUpToggle.isSelected() == true) {