22 |
package org.jsampler.view.fantasia; |
package org.jsampler.view.fantasia; |
23 |
|
|
24 |
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
|
import java.awt.Color; |
|
25 |
|
|
|
import javax.swing.JLabel; |
|
26 |
import javax.swing.JMenuBar; |
import javax.swing.JMenuBar; |
27 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
28 |
import javax.swing.JScrollPane; |
import javax.swing.JScrollPane; |
29 |
import javax.swing.JSplitPane; |
import javax.swing.JSplitPane; |
30 |
|
import javax.swing.event.TreeSelectionEvent; |
31 |
|
import javax.swing.event.TreeSelectionListener; |
32 |
|
import javax.swing.tree.TreePath; |
33 |
|
|
34 |
import org.jsampler.CC; |
import org.jsampler.CC; |
35 |
import org.jsampler.view.SamplerTreeModel; |
import org.jsampler.view.SamplerTreeModel; |
36 |
|
import org.jsampler.view.SamplerTreeModel.TreeNodeBase; |
37 |
import org.jsampler.view.std.JSFrame; |
import org.jsampler.view.std.JSFrame; |
38 |
import org.jsampler.view.std.JSSamplerTree; |
import org.jsampler.view.std.JSSamplerTable; |
39 |
|
|
40 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
|
import static org.jsampler.view.fantasia.FantasiaPrefs.preferences; |
|
41 |
|
|
42 |
/** |
/** |
43 |
* |
* |
50 |
private final JSplitPane splitPane; |
private final JSplitPane splitPane; |
51 |
private final MainPane mainPane; |
private final MainPane mainPane; |
52 |
|
|
53 |
private final JSSamplerTree samplerTree = new JSSamplerTree(new SamplerTreeModel()); |
private final FantasiaSamplerTree samplerTree = new FantasiaSamplerTree(new SamplerTreeModel()); |
54 |
|
private final JSSamplerTable samplerTable = new JSSamplerTable(samplerTree); |
55 |
|
|
56 |
/** |
/** |
57 |
* Creates a new instance of <code>InstrumentsDbFrame</code> |
* Creates a new instance of <code>InstrumentsDbFrame</code> |
92 |
private void |
private void |
93 |
addMenu() { } |
addMenu() { } |
94 |
|
|
95 |
class MainPane extends JPanel { |
class MainPane extends JPanel implements TreeSelectionListener { |
96 |
MainPane() { |
MainPane() { |
97 |
setLayout(new BorderLayout()); |
setLayout(new BorderLayout()); |
98 |
JLabel l = new JLabel("Not implemented yet"); |
add(new JScrollPane(samplerTable)); |
99 |
l.setHorizontalAlignment(l.CENTER); |
|
100 |
add(l); |
samplerTree.getSelectionModel().addTreeSelectionListener(this); |
101 |
|
TreePath path = samplerTree.getSelectionPath(); |
102 |
|
if(path != null) samplerTable.setNode((TreeNodeBase)path.getLastPathComponent()); |
103 |
|
} |
104 |
|
|
105 |
|
public void |
106 |
|
valueChanged(TreeSelectionEvent e) { |
107 |
|
if(e.getNewLeadSelectionPath() == null) { |
108 |
|
samplerTable.setNode(null); |
109 |
|
return; |
110 |
|
} |
111 |
|
|
112 |
|
samplerTable.setNode((TreeNodeBase)e.getNewLeadSelectionPath().getLastPathComponent()); |
113 |
} |
} |
114 |
} |
} |
115 |
|
|