1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005-2008 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.std; |
24 |
|
25 |
import javax.swing.SwingUtilities; |
26 |
|
27 |
import org.jsampler.CC; |
28 |
import org.jsampler.SamplerChannelModel; |
29 |
|
30 |
import org.jsampler.event.SamplerChannelListEvent; |
31 |
import org.jsampler.event.SamplerChannelListListener; |
32 |
|
33 |
import net.sf.juife.InformationDialog; |
34 |
|
35 |
import static org.jsampler.view.std.StdI18n.i18n; |
36 |
|
37 |
|
38 |
/** |
39 |
* |
40 |
* @author Grigor Iliev |
41 |
*/ |
42 |
public class JSFxSendsDlg extends InformationDialog { |
43 |
private JSFxSendsPane mainPane; |
44 |
private final SamplerChannelListListener channelListListener; |
45 |
|
46 |
/** Creates a new instance of <code>JSFxSendsDlg</code> */ |
47 |
public |
48 |
JSFxSendsDlg(SamplerChannelModel model) { |
49 |
this(new JSFxSendsPane(model)); |
50 |
} |
51 |
|
52 |
/** Creates a new instance of <code>JSFxSendsDlg</code> */ |
53 |
public |
54 |
JSFxSendsDlg(JSFxSendsPane pane) { |
55 |
super(CC.getMainFrame(), pane); |
56 |
|
57 |
mainPane = pane; |
58 |
|
59 |
String s = CC.getMainFrame().getChannelPath(pane.getChannelModel()); |
60 |
setTitle(i18n.getLabel("JSFxSendsDlg.title", s)); |
61 |
setModal(false); |
62 |
showCloseButton(false); |
63 |
|
64 |
channelListListener = new SamplerChannelListListener() { |
65 |
public void |
66 |
channelAdded(SamplerChannelListEvent e) { |
67 |
if(CC.getSamplerModel().getChannelListIsAdjusting()) return; |
68 |
updateTitle(); |
69 |
} |
70 |
|
71 |
public void |
72 |
channelRemoved(SamplerChannelListEvent e) { |
73 |
//if(CC.getSamplerModel().getChannelListIsAdjusting()) return; //TODO: |
74 |
|
75 |
updateTitle(); |
76 |
} |
77 |
}; |
78 |
|
79 |
CC.getSamplerModel().addSamplerChannelListListener(channelListListener); |
80 |
} |
81 |
|
82 |
protected void |
83 |
updateTitle() { |
84 |
SwingUtilities.invokeLater(new Runnable() { |
85 |
public void |
86 |
run() { |
87 |
String s = CC.getMainFrame().getChannelPath(mainPane.getChannelModel()); |
88 |
setTitle(i18n.getLabel("JSFxSendsDlg.title", s)); |
89 |
} |
90 |
}); |
91 |
|
92 |
} |
93 |
} |