1
2
3
4
5 package de.mindcrimeilab.xsanalyzer.model;
6
7 import javax.swing.ListModel;
8
9 import org.springframework.binding.value.support.AbstractValueModelWrapper;
10 import org.springframework.richclient.list.ListSelectionValueModelAdapter;
11
12
13
14
15
16
17
18 public final class JListSelectionValueModelAdapter extends AbstractValueModelWrapper {
19
20 private final ListModel model;
21
22 public JListSelectionValueModelAdapter(ListModel listModel, ListSelectionValueModelAdapter valueModel) {
23 super(valueModel);
24 model = listModel;
25 }
26
27 @Override
28 public Object getValue() {
29 int[] selected = (int[]) getInnerMostValue();
30 Object[] result = new Object[selected.length];
31 for (int i = 0; i < selected.length; ++i) {
32 result[i] = model.getElementAt(selected[i]);
33 }
34
35 return result;
36 }
37 }