MCPcopy Create free account
hub / github.com/FabricMC/Matcher / moveSelectionDown

Method moveSelectionDown

src/main/java/matcher/gui/GuiUtil.java:44–59  ·  view source on GitHub ↗
(ListView<T> list)

Source from the content-addressed store, hash-verified

42 }
43
44 public static <T> void moveSelectionDown(ListView<T> list) {
45 MultipleSelectionModel<T> selection = list.getSelectionModel();
46 List<Integer> selected = new ArrayList<>(selection.getSelectedIndices());
47 Collections.reverse(selected);
48 list.getSelectionModel().clearSelection();
49
50 for (int idx : selected) {
51 if (idx < list.getItems().size() - 1 && !selection.isSelected(idx + 1)) {
52 T e = list.getItems().remove(idx);
53 list.getItems().add(idx + 1, e);
54 selection.select(idx + 1);
55 } else {
56 selection.select(idx);
57 }
58 }
59 }
60}

Callers 2

initMethod · 0.95

Calls 2

sizeMethod · 0.80
selectMethod · 0.80

Tested by

no test coverage detected