24 |
|
|
25 |
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
26 |
import java.awt.Dimension; |
import java.awt.Dimension; |
27 |
|
import java.awt.Rectangle; |
28 |
|
|
29 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
30 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
|
import java.awt.event.ItemEvent; |
|
|
import java.awt.event.ItemListener; |
|
31 |
import java.awt.event.KeyEvent; |
import java.awt.event.KeyEvent; |
32 |
import java.awt.event.WindowAdapter; |
import java.awt.event.WindowAdapter; |
33 |
import java.awt.event.WindowEvent; |
import java.awt.event.WindowEvent; |
36 |
|
|
37 |
import javax.swing.AbstractAction; |
import javax.swing.AbstractAction; |
38 |
import javax.swing.Action; |
import javax.swing.Action; |
|
import javax.swing.BorderFactory; |
|
|
import javax.swing.BoxLayout; |
|
|
import javax.swing.Icon; |
|
|
import javax.swing.JCheckBox; |
|
39 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
40 |
import javax.swing.JFrame; |
import javax.swing.JFrame; |
41 |
import javax.swing.JMenu; |
import javax.swing.JMenu; |
44 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
45 |
import javax.swing.JScrollPane; |
import javax.swing.JScrollPane; |
46 |
import javax.swing.JSplitPane; |
import javax.swing.JSplitPane; |
|
import javax.swing.JTextField; |
|
47 |
import javax.swing.JToggleButton; |
import javax.swing.JToggleButton; |
48 |
import javax.swing.JToolBar; |
import javax.swing.JToolBar; |
49 |
import javax.swing.KeyStroke; |
import javax.swing.KeyStroke; |
51 |
import javax.swing.event.ListSelectionEvent; |
import javax.swing.event.ListSelectionEvent; |
52 |
import javax.swing.event.ListSelectionListener; |
import javax.swing.event.ListSelectionListener; |
53 |
|
|
|
import javax.swing.plaf.ToolBarUI; |
|
|
|
|
|
import net.sf.juife.InformationDialog; |
|
54 |
import net.sf.juife.NavigationPage; |
import net.sf.juife.NavigationPage; |
55 |
import net.sf.juife.NavigationPane; |
import net.sf.juife.NavigationPane; |
56 |
|
|
|
import net.sf.juife.Task; |
|
|
|
|
|
import net.sf.juife.event.TaskEvent; |
|
|
import net.sf.juife.event.TaskListener; |
|
|
|
|
57 |
import org.jsampler.CC; |
import org.jsampler.CC; |
58 |
import org.jsampler.HF; |
import org.jsampler.HF; |
|
import org.jsampler.JSI18n; |
|
59 |
|
|
60 |
import org.jsampler.task.InstrumentsDb; |
import org.jsampler.task.InstrumentsDb; |
61 |
|
|
62 |
import org.jsampler.view.DbDirectoryTreeNode; |
import org.jsampler.view.DbDirectoryTreeNode; |
|
import org.jsampler.view.InstrumentsDbTableModel; |
|
|
import org.jsampler.view.InstrumentsDbTableView; |
|
63 |
|
|
64 |
import org.jsampler.view.std.JSInstrumentsDbColumnPreferencesDlg; |
import org.jsampler.view.std.JSInstrumentsDbColumnPreferencesDlg; |
65 |
import org.jsampler.view.std.JSInstrumentsDbTable; |
import org.jsampler.view.std.JSInstrumentsDbTable; |
66 |
import org.jsampler.view.std.JSLostFilesDlg; |
import org.jsampler.view.std.JSLostFilesDlg; |
67 |
|
|
68 |
import org.jvnet.substance.SubstanceLookAndFeel; |
import org.jsampler.view.std.StdUtils; |
69 |
|
|
70 |
import org.linuxsampler.lscp.DbDirectoryInfo; |
import org.linuxsampler.lscp.DbDirectoryInfo; |
71 |
import org.linuxsampler.lscp.DbInstrumentInfo; |
import org.linuxsampler.lscp.DbInstrumentInfo; |
|
import org.linuxsampler.lscp.DbSearchQuery; |
|
72 |
|
|
73 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
74 |
import static org.jsampler.view.fantasia.FantasiaPrefs.preferences; |
import static org.jsampler.view.fantasia.FantasiaPrefs.preferences; |
|
import static org.jsampler.view.fantasia.FantasiaPrefs.INSTRUMENTS_DB_FRAME_SORT_ORDER; |
|
75 |
|
|
76 |
/** |
/** |
77 |
* |
* |
307 |
preferences().setBoolProperty("InstrumentsDbFrame.windowMaximized", b); |
preferences().setBoolProperty("InstrumentsDbFrame.windowMaximized", b); |
308 |
if(b) return; |
if(b) return; |
309 |
|
|
310 |
java.awt.Point p = getLocation(); |
StdUtils.saveWindowBounds("InstrumentsDbFrame", getBounds()); |
|
Dimension d = getSize(); |
|
|
StringBuffer sb = new StringBuffer(); |
|
|
sb.append(p.x).append(',').append(p.y).append(','); |
|
|
sb.append(d.width).append(',').append(d.height); |
|
|
String s = "InstrumentsDbFrame.windowSizeAndLocation"; |
|
|
preferences().setStringProperty(s, sb.toString()); |
|
|
int i = splitPane.getDividerLocation(); |
|
|
preferences().setIntProperty("InstrumentsDbFrame.dividerLocation", i); |
|
311 |
|
|
312 |
mainPane.getInstrumentsTable().saveColumnsVisibleState(); |
mainPane.getInstrumentsTable().saveColumnsVisibleState(); |
313 |
mainPane.getInstrumentsTable().saveColumnWidths(); |
mainPane.getInstrumentsTable().saveColumnWidths(); |
314 |
} |
} |
315 |
|
|
316 |
|
@Override |
317 |
|
public void |
318 |
|
setVisible(boolean b) { |
319 |
|
if(b == isVisible()) return; |
320 |
|
|
321 |
|
super.setVisible(b); |
322 |
|
|
323 |
|
if(b && preferences().getBoolProperty("InstrumentsDbFrame.windowMaximized")) { |
324 |
|
setExtendedState(getExtendedState() | MAXIMIZED_BOTH); |
325 |
|
} |
326 |
|
} |
327 |
|
|
328 |
private void |
private void |
329 |
setDefaultSize() { |
setDefaultSize() { |
330 |
Dimension dimension = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); |
Dimension dimension = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); |
335 |
|
|
336 |
private void |
private void |
337 |
setSavedSize() { |
setSavedSize() { |
338 |
String sp = "InstrumentsDbFrame.windowSizeAndLocation"; |
Rectangle r = StdUtils.getWindowBounds("InstrumentsDbFrame"); |
339 |
String s = preferences().getStringProperty(sp, null); |
if(r == null) { |
|
if(s == null) { |
|
340 |
setDefaultSize(); |
setDefaultSize(); |
341 |
return; |
return; |
342 |
} |
} |
343 |
|
|
344 |
try { |
setBounds(r); |
|
int i = s.indexOf(','); |
|
|
int x = Integer.parseInt(s.substring(0, i)); |
|
|
|
|
|
s = s.substring(i + 1); |
|
|
i = s.indexOf(','); |
|
|
int y = Integer.parseInt(s.substring(0, i)); |
|
|
|
|
|
s = s.substring(i + 1); |
|
|
i = s.indexOf(','); |
|
|
int width = Integer.parseInt(s.substring(0, i)); |
|
|
|
|
|
s = s.substring(i + 1); |
|
|
int height = Integer.parseInt(s); |
|
|
|
|
|
setBounds(x, y, width, height); |
|
|
|
|
|
i = preferences().getIntProperty("InstrumentsDbFrame.dividerLocation"); |
|
|
if(i != 0) splitPane.setDividerLocation(i); |
|
|
|
|
|
} catch(Exception x) { |
|
|
String msg = "Parsing of window size and location string failed"; |
|
|
CC.getLogger().log(Level.INFO, msg, x); |
|
|
setDefaultSize(); |
|
|
} |
|
|
|
|
|
if(preferences().getBoolProperty("InstrumentsDbFrame.windowMaximized")) { |
|
|
setExtendedState(getExtendedState() | MAXIMIZED_BOTH); |
|
|
} |
|
345 |
} |
} |
346 |
|
|
347 |
private void |
private void |
549 |
getHandler() { return eventHandler; } |
getHandler() { return eventHandler; } |
550 |
|
|
551 |
private class EventHandler implements ListSelectionListener { |
private class EventHandler implements ListSelectionListener { |
552 |
|
@Override |
553 |
public void |
public void |
554 |
valueChanged(ListSelectionEvent e) { |
valueChanged(ListSelectionEvent e) { |
555 |
|
|