1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005-2006 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 |
import java.awt.MediaTracker; |
27 |
|
28 |
import java.awt.event.ActionEvent; |
29 |
import java.awt.event.ActionListener; |
30 |
|
31 |
import java.net.URL; |
32 |
|
33 |
import java.util.logging.Level; |
34 |
|
35 |
import javax.swing.BorderFactory; |
36 |
import javax.swing.Box; |
37 |
import javax.swing.BoxLayout; |
38 |
import javax.swing.ImageIcon; |
39 |
import javax.swing.JLabel; |
40 |
import javax.swing.JPanel; |
41 |
import javax.swing.JSeparator; |
42 |
|
43 |
import net.sf.juife.LinkButton; |
44 |
import net.sf.juife.NavigationPage; |
45 |
|
46 |
import org.jsampler.CC; |
47 |
|
48 |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
49 |
import static org.jsampler.view.classic.LeftPane.getLeftPane; |
50 |
|
51 |
|
52 |
/** |
53 |
* |
54 |
* @author Grigor Iliev |
55 |
*/ |
56 |
public class TasksPage extends NavigationPage { |
57 |
private LinkButton lnkMidiDevices = |
58 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkMidiDevices")); |
59 |
private LinkButton lnkNewMidiDevice = |
60 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewMidiDevice")); |
61 |
private LinkButton lnkMidiInstruments = |
62 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkMidiInstruments")); |
63 |
private LinkButton lnkAudioDevices = |
64 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkAudioDevices")); |
65 |
private LinkButton lnkNewAudioDevice = |
66 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewAudioDevice")); |
67 |
private LinkButton lnkNewChannel = |
68 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewChannel")); |
69 |
private LinkButton lnkNewChannelWizard = |
70 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewChannelWizard")); |
71 |
private LinkButton lnkOrchestras = |
72 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkOrchestras")); |
73 |
private LinkButton lnkManageOrchestras = |
74 |
new LinkButton(i18n.getButtonLabel("TasksPage.lnkManageOrchestras")); |
75 |
|
76 |
|
77 |
/** Creates a new instance of <code>TasksPage</code> */ |
78 |
public |
79 |
TasksPage() { |
80 |
setTitle(i18n.getLabel("TasksPage.title")); |
81 |
|
82 |
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
83 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
84 |
|
85 |
JLabel lChannels = new JLabel(i18n.getLabel("TasksPage.lChannels")); |
86 |
add(lChannels); |
87 |
|
88 |
JSeparator sep = new JSeparator(); |
89 |
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
90 |
add(sep); |
91 |
|
92 |
JPanel p = new JPanel(); |
93 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
94 |
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
95 |
|
96 |
p.add(lnkNewChannel); |
97 |
p.add(lnkNewChannelWizard); |
98 |
p.add(Box.createGlue()); |
99 |
p.setMaximumSize(p.getPreferredSize()); |
100 |
|
101 |
add(p); |
102 |
|
103 |
String s = i18n.getLabel("TasksPage.lMidiDevices"); |
104 |
JLabel lMidiDevices = new JLabel(s, Res.iconMidi24, JLabel.LEFT); |
105 |
add(lMidiDevices); |
106 |
sep = new JSeparator(); |
107 |
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
108 |
add(sep); |
109 |
|
110 |
p = new JPanel(); |
111 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
112 |
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
113 |
|
114 |
p.add(lnkNewMidiDevice); |
115 |
p.add(lnkMidiDevices); |
116 |
p.add(lnkMidiInstruments); |
117 |
p.add(Box.createGlue()); |
118 |
p.setMaximumSize(p.getPreferredSize()); |
119 |
|
120 |
add(p); |
121 |
|
122 |
s = i18n.getLabel("TasksPage.lAudioDevices"); |
123 |
JLabel lAudioDevices = new JLabel(s, Res.iconVol24, JLabel.LEFT); |
124 |
add(lAudioDevices); |
125 |
|
126 |
sep = new JSeparator(); |
127 |
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
128 |
add(sep); |
129 |
|
130 |
p = new JPanel(); |
131 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
132 |
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
133 |
|
134 |
p.add(lnkNewAudioDevice); |
135 |
p.add(lnkAudioDevices); |
136 |
p.add(Box.createGlue()); |
137 |
p.setMaximumSize(p.getPreferredSize()); |
138 |
|
139 |
add(p); |
140 |
|
141 |
JLabel lOrchestras = new JLabel(i18n.getLabel("TasksPage.lOrchestras")); |
142 |
add(lOrchestras); |
143 |
|
144 |
sep = new JSeparator(); |
145 |
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
146 |
add(sep); |
147 |
|
148 |
p = new JPanel(); |
149 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
150 |
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
151 |
|
152 |
p.add(lnkOrchestras); |
153 |
p.add(lnkManageOrchestras); |
154 |
p.add(Box.createGlue()); |
155 |
p.setMaximumSize(p.getPreferredSize()); |
156 |
|
157 |
add(p); |
158 |
|
159 |
add(Box.createGlue()); |
160 |
|
161 |
p = new JPanel(); |
162 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
163 |
p.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); |
164 |
|
165 |
p.add(Box.createGlue()); |
166 |
p.setMaximumSize(p.getPreferredSize()); |
167 |
|
168 |
add(p); |
169 |
|
170 |
lnkNewChannel.addActionListener(new ActionListener() { |
171 |
public void |
172 |
actionPerformed(ActionEvent e) { |
173 |
A4n.newChannel.actionPerformed(null); |
174 |
} |
175 |
}); |
176 |
|
177 |
lnkNewChannelWizard.addActionListener(new ActionListener() { |
178 |
public void |
179 |
actionPerformed(ActionEvent e) { |
180 |
A4n.newChannelWizard.actionPerformed(null); |
181 |
} |
182 |
}); |
183 |
|
184 |
lnkNewMidiDevice.addActionListener(new ActionListener() { |
185 |
public void |
186 |
actionPerformed(ActionEvent e) { |
187 |
A4n.addMidiDevice.actionPerformed(null); |
188 |
} |
189 |
}); |
190 |
|
191 |
lnkMidiDevices.addActionListener(new ActionListener() { |
192 |
public void |
193 |
actionPerformed(ActionEvent e) { getLeftPane().showMidiDevicesPage(); } |
194 |
}); |
195 |
|
196 |
lnkMidiInstruments.addActionListener(new ActionListener() { |
197 |
public void |
198 |
actionPerformed(ActionEvent e) { |
199 |
getLeftPane().showMidiInstrumentMapsPage(); |
200 |
} |
201 |
}); |
202 |
|
203 |
lnkNewAudioDevice.addActionListener(new ActionListener() { |
204 |
public void |
205 |
actionPerformed(ActionEvent e) { |
206 |
A4n.addAudioDevice.actionPerformed(null); |
207 |
} |
208 |
}); |
209 |
|
210 |
lnkAudioDevices.addActionListener(new ActionListener() { |
211 |
public void |
212 |
actionPerformed(ActionEvent e) { getLeftPane().showAudioDevicesPage(); } |
213 |
}); |
214 |
|
215 |
lnkOrchestras.addActionListener(new ActionListener() { |
216 |
public void |
217 |
actionPerformed(ActionEvent e) { getLeftPane().showOrchestrasPage(); } |
218 |
}); |
219 |
|
220 |
lnkManageOrchestras.addActionListener(new ActionListener() { |
221 |
public void |
222 |
actionPerformed(ActionEvent e) { getLeftPane().showManageOrchestrasPage(); } |
223 |
}); |
224 |
} |
225 |
|
226 |
} |