private void actionSortMove(boolean up) {
Object selectedSort = listSort.getSelectedValue();
Object selectedItem = listSortItem.getSelectedValue();
if ((selectedSort instanceof CompositeComparator) &&
(selectedItem instanceof NamedComparator)) {
CompositeComparator comparators = (CompositeComparator) selectedSort;
NamedComparator comparator = (NamedComparator) selectedItem;
comparators.moveComparator(comparator.getName(), up);
int selected = listSortItem.getSelectedIndex();
selected += up ? -1 : 1;
modelSortItem.clear();
for (int i = 0; i < comparators.getComparatorsCount(); i++) {
NamedComparator item = comparators.getComparator(i);
modelSortItem.addElement(item);
}
listSortItem.setSelectedIndex(Math.min(Math.max(0, selected), modelSortItem.size() - 1));
}
}