33 |
import java.awt.event.WindowAdapter; |
import java.awt.event.WindowAdapter; |
34 |
import java.awt.event.WindowEvent; |
import java.awt.event.WindowEvent; |
35 |
|
|
36 |
|
import java.util.List; |
37 |
import java.util.logging.Level; |
import java.util.logging.Level; |
38 |
|
|
39 |
import javax.swing.AbstractAction; |
import javax.swing.AbstractAction; |
54 |
import javax.swing.JToggleButton; |
import javax.swing.JToggleButton; |
55 |
import javax.swing.JToolBar; |
import javax.swing.JToolBar; |
56 |
import javax.swing.KeyStroke; |
import javax.swing.KeyStroke; |
57 |
|
import javax.swing.RowSorter.SortKey; |
58 |
|
import javax.swing.SortOrder; |
59 |
|
|
60 |
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
61 |
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
62 |
import javax.swing.event.ListSelectionEvent; |
import javax.swing.event.ListSelectionEvent; |
63 |
import javax.swing.event.ListSelectionListener; |
import javax.swing.event.ListSelectionListener; |
64 |
|
import javax.swing.event.RowSorterEvent; |
65 |
|
import javax.swing.event.RowSorterListener; |
66 |
import javax.swing.event.TreeSelectionEvent; |
import javax.swing.event.TreeSelectionEvent; |
67 |
import javax.swing.event.TreeSelectionListener; |
import javax.swing.event.TreeSelectionListener; |
68 |
|
|
94 |
import org.linuxsampler.lscp.DbInstrumentInfo; |
import org.linuxsampler.lscp.DbInstrumentInfo; |
95 |
import org.linuxsampler.lscp.DbSearchQuery; |
import org.linuxsampler.lscp.DbSearchQuery; |
96 |
|
|
97 |
|
import static javax.swing.event.RowSorterEvent.Type.SORT_ORDER_CHANGED; |
98 |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
99 |
import static org.jsampler.view.classic.ClassicPrefs.preferences; |
import static org.jsampler.view.classic.ClassicPrefs.preferences; |
100 |
|
import static org.jsampler.view.fantasia.FantasiaPrefs.INSTRUMENTS_DB_FRAME_SORT_ORDER; |
101 |
|
|
102 |
/** |
/** |
103 |
* |
* |
673 |
); |
); |
674 |
|
|
675 |
instrumentsTable.getParent().setBackground(instrumentsTable.getBackground()); |
instrumentsTable.getParent().setBackground(instrumentsTable.getBackground()); |
676 |
instrumentsTable.getRowSorter().toggleSortOrder(0); |
|
677 |
|
int i = preferences().getIntProperty(INSTRUMENTS_DB_FRAME_SORT_ORDER); |
678 |
|
boolean descending = i < 0; |
679 |
|
if(i < 0) i *= -1; |
680 |
|
|
681 |
|
instrumentsTable.getRowSorter().toggleSortOrder(--i); |
682 |
|
if(descending) instrumentsTable.getRowSorter().toggleSortOrder(i); |
683 |
searchResultsNode.setDetached(true); |
searchResultsNode.setDetached(true); |
684 |
|
|
685 |
|
RowSorterListener l = new RowSorterListener() { |
686 |
|
public void |
687 |
|
sorterChanged(RowSorterEvent e) { |
688 |
|
if(e.getType() != SORT_ORDER_CHANGED) return; |
689 |
|
rowSorterChanged(); |
690 |
|
} |
691 |
|
}; |
692 |
|
|
693 |
|
instrumentsTable.getRowSorter().addRowSorterListener(l); |
694 |
|
} |
695 |
|
|
696 |
|
private void |
697 |
|
rowSorterChanged() { |
698 |
|
List<? extends SortKey> list = instrumentsTable.getRowSorter().getSortKeys(); |
699 |
|
if(list.isEmpty()) return; |
700 |
|
SortKey k = list.get(0); |
701 |
|
int i = k.getColumn() + 1; |
702 |
|
if(k.getSortOrder() == SortOrder.UNSORTED) return; |
703 |
|
if(k.getSortOrder() == SortOrder.DESCENDING) i *= -1; |
704 |
|
preferences().setIntProperty(INSTRUMENTS_DB_FRAME_SORT_ORDER, i); |
705 |
} |
} |
706 |
|
|
707 |
public JSInstrumentsDbTable |
public JSInstrumentsDbTable |