1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
6 |
* This file is part of JSampler. |
7 |
* |
8 |
* JSampler is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 |
10 |
* as published by the Free Software Foundation. |
11 |
* |
12 |
* JSampler is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with JSampler; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
* MA 02111-1307 USA |
21 |
*/ |
22 |
|
23 |
package org.jsampler.view.classic; |
24 |
|
25 |
import java.awt.Dimension; |
26 |
|
27 |
import java.awt.event.ActionEvent; |
28 |
import java.awt.event.ActionListener; |
29 |
|
30 |
import javax.swing.BorderFactory; |
31 |
import javax.swing.Box; |
32 |
import javax.swing.BoxLayout; |
33 |
import javax.swing.JLabel; |
34 |
import javax.swing.JPanel; |
35 |
import javax.swing.JSeparator; |
36 |
|
37 |
import net.sf.juife.swing.LinkButton; |
38 |
import net.sf.juife.swing.NavigationPage; |
39 |
|
40 |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
41 |
import static org.jsampler.view.classic.LeftPane.getLeftPane; |
42 |
|
43 |
|
44 |
/** |
45 |
* |
46 |
* @author Grigor Iliev |
47 |
*/ |
48 |
public class TasksPage extends NavigationPage { |
49 |
private LinkButton lnkMidiDevices = |
50 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkMidiDevices")); |
51 |
private LinkButton lnkNewMidiDevice = |
52 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewMidiDevice")); |
53 |
private LinkButton lnkMidiInstruments = |
54 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkMidiInstruments")); |
55 |
private LinkButton lnkAudioDevices = |
56 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkAudioDevices")); |
57 |
private LinkButton lnkNewAudioDevice = |
58 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewAudioDevice")); |
59 |
private LinkButton lnkNewChannel = |
60 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewChannel")); |
61 |
private LinkButton lnkNewChannelWizard = |
62 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewChannelWizard")); |
63 |
private LinkButton lnkOrchestras = |
64 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkOrchestras")); |
65 |
private LinkButton lnkManageOrchestras = |
66 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkManageOrchestras")); |
67 |
|
68 |
|
69 |
/** Creates a new instance of <code>TasksPage</code> */ |
70 |
public |
71 |
TasksPage() { |
72 |
setTitle(i18n.getLabel("TasksPage.title")); |
73 |
|
74 |
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
75 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
76 |
|
77 |
JLabel lChannels = new JLabel(i18n.getLabel("TasksPage.lChannels")); |
78 |
add(lChannels); |
79 |
|
80 |
JSeparator sep = new JSeparator(); |
81 |
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
82 |
add(sep); |
83 |
|
84 |
JPanel p = new JPanel(); |
85 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
86 |
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
87 |
|
88 |
p.add(lnkNewChannel); |
89 |
p.add(lnkNewChannelWizard); |
90 |
p.add(Box.createGlue()); |
91 |
p.setMaximumSize(p.getPreferredSize()); |
92 |
|
93 |
add(p); |
94 |
|
95 |
String s = i18n.getLabel("TasksPage.lMidiDevices"); |
96 |
JLabel lMidiDevices = new JLabel(s, Res.iconMidi24, JLabel.LEFT); |
97 |
add(lMidiDevices); |
98 |
sep = new JSeparator(); |
99 |
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
100 |
add(sep); |
101 |
|
102 |
p = new JPanel(); |
103 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
104 |
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
105 |
|
106 |
p.add(lnkNewMidiDevice); |
107 |
p.add(lnkMidiDevices); |
108 |
p.add(lnkMidiInstruments); |
109 |
p.add(Box.createGlue()); |
110 |
p.setMaximumSize(p.getPreferredSize()); |
111 |
|
112 |
add(p); |
113 |
|
114 |
s = i18n.getLabel("TasksPage.lAudioDevices"); |
115 |
JLabel lAudioDevices = new JLabel(s, Res.iconVol24, JLabel.LEFT); |
116 |
add(lAudioDevices); |
117 |
|
118 |
sep = new JSeparator(); |
119 |
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
120 |
add(sep); |
121 |
|
122 |
p = new JPanel(); |
123 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
124 |
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
125 |
|
126 |
p.add(lnkNewAudioDevice); |
127 |
p.add(lnkAudioDevices); |
128 |
p.add(Box.createGlue()); |
129 |
p.setMaximumSize(p.getPreferredSize()); |
130 |
|
131 |
add(p); |
132 |
|
133 |
JLabel lOrchestras = new JLabel(i18n.getLabel("TasksPage.lOrchestras")); |
134 |
add(lOrchestras); |
135 |
|
136 |
sep = new JSeparator(); |
137 |
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
138 |
add(sep); |
139 |
|
140 |
p = new JPanel(); |
141 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
142 |
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
143 |
|
144 |
p.add(lnkOrchestras); |
145 |
p.add(lnkManageOrchestras); |
146 |
p.add(Box.createGlue()); |
147 |
p.setMaximumSize(p.getPreferredSize()); |
148 |
|
149 |
add(p); |
150 |
|
151 |
add(Box.createGlue()); |
152 |
|
153 |
p = new JPanel(); |
154 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
155 |
p.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); |
156 |
|
157 |
p.add(Box.createGlue()); |
158 |
p.setMaximumSize(p.getPreferredSize()); |
159 |
|
160 |
add(p); |
161 |
|
162 |
lnkNewChannel.addActionListener(new ActionListener() { |
163 |
public void |
164 |
actionPerformed(ActionEvent e) { |
165 |
A4n.newChannel.actionPerformed(null); |
166 |
} |
167 |
}); |
168 |
|
169 |
lnkNewChannelWizard.addActionListener(new ActionListener() { |
170 |
public void |
171 |
actionPerformed(ActionEvent e) { |
172 |
A4n.newChannelWizard.actionPerformed(null); |
173 |
} |
174 |
}); |
175 |
|
176 |
lnkNewMidiDevice.addActionListener(new ActionListener() { |
177 |
public void |
178 |
actionPerformed(ActionEvent e) { |
179 |
A4n.addMidiDevice.actionPerformed(null); |
180 |
} |
181 |
}); |
182 |
|
183 |
lnkMidiDevices.addActionListener(new ActionListener() { |
184 |
public void |
185 |
actionPerformed(ActionEvent e) { getLeftPane().showMidiDevicesPage(); } |
186 |
}); |
187 |
|
188 |
lnkMidiInstruments.addActionListener(new ActionListener() { |
189 |
public void |
190 |
actionPerformed(ActionEvent e) { |
191 |
getLeftPane().showMidiInstrumentMapsPage(); |
192 |
} |
193 |
}); |
194 |
|
195 |
lnkNewAudioDevice.addActionListener(new ActionListener() { |
196 |
public void |
197 |
actionPerformed(ActionEvent e) { |
198 |
A4n.addAudioDevice.actionPerformed(null); |
199 |
} |
200 |
}); |
201 |
|
202 |
lnkAudioDevices.addActionListener(new ActionListener() { |
203 |
public void |
204 |
actionPerformed(ActionEvent e) { getLeftPane().showAudioDevicesPage(); } |
205 |
}); |
206 |
|
207 |
lnkOrchestras.addActionListener(new ActionListener() { |
208 |
public void |
209 |
actionPerformed(ActionEvent e) { getLeftPane().showOrchestrasPage(); } |
210 |
}); |
211 |
|
212 |
lnkManageOrchestras.addActionListener(new ActionListener() { |
213 |
public void |
214 |
actionPerformed(ActionEvent e) { getLeftPane().showManageOrchestrasPage(); } |
215 |
}); |
216 |
} |
217 |
|
218 |
} |