1 package camidion.chordhelper.mididevice;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
6 import javax.swing.AbstractAction;
7 import javax.swing.Action;
8 import javax.swing.BoxLayout;
9 import javax.swing.JButton;
10 import javax.swing.JDialog;
11 import javax.swing.JPanel;
12 import javax.swing.JScrollPane;
13 import javax.swing.JSplitPane;
15 import camidion.chordhelper.ButtonIcon;
18 * MIDIデバイスダイアログ (View)
20 public class MidiDeviceDialog extends JDialog {
22 * MIDIデバイスダイアログを開くアクション
24 public Action openAction = new AbstractAction() {
26 putValue(NAME, "MIDI device connection");
27 putValue(SHORT_DESCRIPTION, "MIDIデバイス間の接続を編集");
28 putValue(LARGE_ICON_KEY, new ButtonIcon(ButtonIcon.MIDI_CONNECTOR_ICON));
31 public void actionPerformed(ActionEvent event) { setVisible(true); }
34 * MIDIデバイスダイアログを構築します。
35 * @param deviceModelList デバイスモデル(MIDIコネクタリストモデル)のリスト
37 public MidiDeviceDialog(final MidiTransceiverListModelList deviceModelList) {
38 setTitle(openAction.getValue(Action.NAME).toString());
39 setBounds( 300, 300, 800, 500 );
40 MidiDeviceTreeModel deviceTreeModel = new MidiDeviceTreeModel(deviceModelList);
41 MidiDeviceTreeView deviceTreeView = new MidiDeviceTreeView(deviceTreeModel);
42 final MidiDeviceInfoPane deviceInfoPane = new MidiDeviceInfoPane();
43 MidiOpenedDevicesView desktopPane = new MidiOpenedDevicesView(deviceTreeView, deviceInfoPane, this);
44 deviceTreeView.addTreeSelectionListener(deviceInfoPane);
45 deviceTreeView.addTreeSelectionListener(desktopPane);
46 deviceTreeView.setSelectionRow(0);
48 JSplitPane.HORIZONTAL_SPLIT,
50 JSplitPane.VERTICAL_SPLIT,
51 new JScrollPane(deviceTreeView),
53 add(new JScrollPane(deviceInfoPane));
54 add(new JButton("Reset time on MIDI devices") {{
55 addActionListener(new ActionListener() {
57 public void actionPerformed(ActionEvent e) {
58 deviceModelList.resetMicrosecondPosition();
62 setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
65 setDividerLocation(260);
69 setOneTouchExpandable(true);
70 setDividerLocation(250);