* allow sequence multi-selection

This commit is contained in:
Reinhard Pointner 2012-07-15 07:46:43 +00:00
parent 53f6b531fb
commit 80e6b9ef1a
1 changed files with 6 additions and 4 deletions

View File

@ -141,7 +141,7 @@ class HistoryDialog extends JDialog {
pane.add(content, "grow"); pane.add(content, "grow");
// initialize selection modes // initialize selection modes
sequenceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sequenceTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
elementTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); elementTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
// bind element model to selected sequence // bind element model to selected sequence
@ -153,9 +153,11 @@ class HistoryDialog extends JDialog {
return; return;
if (sequenceTable.getSelectedRow() >= 0) { if (sequenceTable.getSelectedRow() >= 0) {
int index = sequenceTable.convertRowIndexToModel(sequenceTable.getSelectedRow()); List<Element> elements = new ArrayList<Element>();
for (int row : sequenceTable.getSelectedRows()) {
elementModel.setData(sequenceModel.getRow(index).elements()); elements.addAll(sequenceModel.getRow(sequenceTable.convertRowIndexToModel(row)).elements());
}
elementModel.setData(elements);
} }
} }
}); });