1 |
iliev |
787 |
/* |
2 |
|
|
* JSampler - a java front-end for LinuxSampler |
3 |
|
|
* |
4 |
|
|
* Copyright (C) 2005 Grigor Kirilov Iliev |
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 |
|
|
import java.awt.MediaTracker; |
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 lnkAudioDevices = |
62 |
|
|
new LinkButton(i18n.getButtonLabel("TasksPage.lnkAudioDevices")); |
63 |
|
|
private LinkButton lnkNewAudioDevice = |
64 |
|
|
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewAudioDevice")); |
65 |
|
|
private LinkButton lnkNewChannel = |
66 |
|
|
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewChannel")); |
67 |
|
|
private LinkButton lnkNewChannelWizard = |
68 |
|
|
new LinkButton(i18n.getButtonLabel("TasksPage.lnkNewChannelWizard")); |
69 |
|
|
|
70 |
|
|
|
71 |
|
|
private LinkButton lnkRefreshSampler = |
72 |
|
|
new LinkButton(i18n.getButtonLabel("TasksPage.lnkRefreshSampler")); |
73 |
|
|
|
74 |
|
|
/** Creates a new instance of <code>TasksPage</code> */ |
75 |
|
|
public |
76 |
|
|
TasksPage() { |
77 |
|
|
setTitle(i18n.getLabel("TasksPage.title")); |
78 |
|
|
|
79 |
|
|
int h = lnkRefreshSampler.getPreferredSize().height; |
80 |
|
|
try { |
81 |
|
|
URL url = ClassLoader.getSystemClassLoader().getResource ( |
82 |
|
|
"org/jsampler/view/classic/res/icons/Refresh16.gif" |
83 |
|
|
); |
84 |
|
|
|
85 |
|
|
ImageIcon icon = new ImageIcon(url); |
86 |
|
|
if(icon.getImageLoadStatus() == MediaTracker.COMPLETE) |
87 |
|
|
lnkRefreshSampler.setIcon(icon); |
88 |
|
|
} catch(Exception x) { CC.getLogger().log(Level.INFO, x.getMessage(), x); } |
89 |
|
|
|
90 |
|
|
lnkRefreshSampler.setText(i18n.getButtonLabel("TasksPage.lnkRefreshSampler")); |
91 |
|
|
lnkRefreshSampler.setMaximumSize(lnkRefreshSampler.getPreferredSize()); |
92 |
|
|
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
93 |
|
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
94 |
|
|
|
95 |
|
|
JLabel lChannels = new JLabel(i18n.getLabel("TasksPage.lChannels")); |
96 |
|
|
add(lChannels); |
97 |
|
|
|
98 |
|
|
JSeparator sep = new JSeparator(); |
99 |
|
|
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
100 |
|
|
add(sep); |
101 |
|
|
|
102 |
|
|
JPanel 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(lnkNewChannel); |
107 |
|
|
p.add(lnkNewChannelWizard); |
108 |
|
|
p.add(Box.createGlue()); |
109 |
|
|
p.setMaximumSize(p.getPreferredSize()); |
110 |
|
|
|
111 |
|
|
add(p); |
112 |
|
|
|
113 |
|
|
JLabel lMidiDevices = new JLabel(i18n.getLabel("TasksPage.lMidiDevices")); |
114 |
|
|
add(lMidiDevices); |
115 |
|
|
sep = new JSeparator(); |
116 |
|
|
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
117 |
|
|
add(sep); |
118 |
|
|
|
119 |
|
|
p = new JPanel(); |
120 |
|
|
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
121 |
|
|
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
122 |
|
|
|
123 |
|
|
p.add(lnkNewMidiDevice); |
124 |
|
|
p.add(lnkMidiDevices); |
125 |
|
|
p.add(Box.createGlue()); |
126 |
|
|
p.setMaximumSize(p.getPreferredSize()); |
127 |
|
|
|
128 |
|
|
add(p); |
129 |
|
|
|
130 |
|
|
JLabel lAudioDevices = new JLabel(i18n.getLabel("TasksPage.lAudioDevices")); |
131 |
|
|
add(lAudioDevices); |
132 |
|
|
|
133 |
|
|
sep = new JSeparator(); |
134 |
|
|
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
135 |
|
|
add(sep); |
136 |
|
|
|
137 |
|
|
p = new JPanel(); |
138 |
|
|
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
139 |
|
|
p.setBorder(BorderFactory.createEmptyBorder(6, 12, 17, 0)); |
140 |
|
|
|
141 |
|
|
p.add(lnkNewAudioDevice); |
142 |
|
|
p.add(lnkAudioDevices); |
143 |
|
|
p.add(Box.createGlue()); |
144 |
|
|
p.setMaximumSize(p.getPreferredSize()); |
145 |
|
|
|
146 |
|
|
add(p); |
147 |
|
|
|
148 |
|
|
add(Box.createGlue()); |
149 |
|
|
|
150 |
|
|
sep = new JSeparator(); |
151 |
|
|
sep.setMaximumSize(new Dimension(Short.MAX_VALUE, sep.getPreferredSize().height)); |
152 |
|
|
add(sep); |
153 |
|
|
|
154 |
|
|
p = new JPanel(); |
155 |
|
|
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
156 |
|
|
p.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); |
157 |
|
|
|
158 |
|
|
p.add(lnkRefreshSampler); |
159 |
|
|
p.add(Box.createGlue()); |
160 |
|
|
p.setMaximumSize(p.getPreferredSize()); |
161 |
|
|
|
162 |
|
|
add(p); |
163 |
|
|
|
164 |
|
|
lnkNewChannel.addActionListener(new ActionListener() { |
165 |
|
|
public void |
166 |
|
|
actionPerformed(ActionEvent e) { |
167 |
|
|
A4n.newChannel.actionPerformed(null); |
168 |
|
|
} |
169 |
|
|
}); |
170 |
|
|
|
171 |
|
|
lnkNewChannelWizard.addActionListener(new ActionListener() { |
172 |
|
|
public void |
173 |
|
|
actionPerformed(ActionEvent e) { |
174 |
|
|
A4n.newChannelWizard.actionPerformed(null); |
175 |
|
|
} |
176 |
|
|
}); |
177 |
|
|
|
178 |
|
|
lnkNewMidiDevice.addActionListener(new ActionListener() { |
179 |
|
|
public void |
180 |
|
|
actionPerformed(ActionEvent e) { |
181 |
|
|
A4n.addMidiDevice.actionPerformed(null); |
182 |
|
|
} |
183 |
|
|
}); |
184 |
|
|
|
185 |
|
|
lnkMidiDevices.addActionListener(new ActionListener() { |
186 |
|
|
public void |
187 |
|
|
actionPerformed(ActionEvent e) { getLeftPane().showMidiDevicesPage(); } |
188 |
|
|
}); |
189 |
|
|
|
190 |
|
|
lnkNewAudioDevice.addActionListener(new ActionListener() { |
191 |
|
|
public void |
192 |
|
|
actionPerformed(ActionEvent e) { |
193 |
|
|
A4n.addAudioDevice.actionPerformed(null); |
194 |
|
|
} |
195 |
|
|
}); |
196 |
|
|
|
197 |
|
|
lnkAudioDevices.addActionListener(new ActionListener() { |
198 |
|
|
public void |
199 |
|
|
actionPerformed(ActionEvent e) { getLeftPane().showAudioDevicesPage(); } |
200 |
|
|
}); |
201 |
|
|
|
202 |
|
|
lnkRefreshSampler.addActionListener(new ActionListener() { |
203 |
|
|
public void |
204 |
|
|
actionPerformed(ActionEvent e) { A4n.refresh.actionPerformed(null); } |
205 |
|
|
}); |
206 |
|
|
} |
207 |
|
|
|
208 |
|
|
} |