/[svn]/jsampler/trunk/src/org/jsampler/view/classic/NewChannelWizard.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/classic/NewChannelWizard.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 787 - (show annotations) (download)
Mon Oct 10 16:03:12 2005 UTC (18 years, 6 months ago) by iliev
File size: 6266 byte(s)
* The first alpha-release of JSampler

1 /*
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 javax.swing.BorderFactory;
28 import javax.swing.Box;
29 import javax.swing.BoxLayout;
30 import javax.swing.JComboBox;
31 import javax.swing.JLabel;
32 import javax.swing.JPanel;
33
34 import net.sf.juife.Wizard;
35
36 import net.sf.juife.wizard.ConfirmationPage;
37 import net.sf.juife.wizard.DefaultWizardModel;
38 import net.sf.juife.wizard.UserInputPage;
39 import net.sf.juife.wizard.WizardPage;
40
41 import org.jsampler.AudioDeviceModel;
42 import org.jsampler.CC;
43 import org.jsampler.MidiDeviceModel;
44
45 import org.jsampler.task.AddChannel;
46
47 import static org.jsampler.view.classic.ClassicI18n.i18n;
48
49
50 /**
51 *
52 * @author Grigor Iliev
53 */
54 public class NewChannelWizard extends Wizard {
55
56 /** Creates a new instance of <code>NewChannelWizard</code>. */
57 public
58 NewChannelWizard() {
59 super(CC.getMainFrame(), i18n.getLabel("NewChannelWizard.title"));
60
61 setModel(new NewChannelWizardModel());
62 }
63
64 }
65
66 class NewChannelWizardModel extends DefaultWizardModel {
67 private MidiDeviceWizardPage midiDevicePage = new MidiDeviceWizardPage();
68 private MidiPortWizardPage midiPortPage = new MidiPortWizardPage();
69 private AudioDeviceWizardPage audioDevicePage = new AudioDeviceWizardPage();
70 private EngineWizardPage enginePage = new EngineWizardPage();
71 private InstrumentWizardPage instrumentPage = new InstrumentWizardPage();
72 private ConfirmationWizardPage confirmationPage = new ConfirmationWizardPage();
73
74 NewChannelWizardModel() {
75 addPage(midiDevicePage);
76 addPage(midiPortPage);
77 addStep(i18n.getLabel("NewChannelWizard.step1"), 2);
78
79 addPage(audioDevicePage);
80 addStep(i18n.getLabel("NewChannelWizard.step2"));
81
82 addPage(enginePage);
83 addStep(i18n.getLabel("NewChannelWizard.step3"));
84
85 addPage(instrumentPage);
86 addStep(i18n.getLabel("NewChannelWizard.step4"));
87
88 addPage(confirmationPage);
89 addStep(i18n.getLabel("NewChannelWizard.step5"));
90
91 setLast(confirmationPage);
92 }
93 }
94
95 class MidiDeviceWizardPage extends UserInputPage {
96 private final JLabel lDevice = new JLabel(i18n.getLabel("MidiDeviceWizardPage.lDevice"));
97 private final JComboBox cbDevices = new JComboBox();
98
99 MidiDeviceWizardPage() {
100 super(i18n.getLabel("MidiDeviceWizardPage.subtitle"));
101
102 setMainInstructions(i18n.getLabel("MidiDeviceWizardPage.mainInstructions"));
103
104 JPanel p = new JPanel();
105 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
106
107 p.add(lDevice);
108
109 p.add(Box.createRigidArea(new Dimension(6, 0)));
110
111 for(MidiDeviceModel m : CC.getSamplerModel().getMidiDeviceModels()) {
112 cbDevices.addItem(m.getDeviceInfo());
113 }
114
115 cbDevices.setMaximumSize(cbDevices.getPreferredSize());
116
117 p.add(cbDevices);
118
119 setMainPane(p);
120 }
121 }
122
123 class MidiPortWizardPage extends UserInputPage {
124 private final JLabel lPort = new JLabel(i18n.getLabel("MidiPortWizardPage.lPort"));
125 private final JComboBox cbPorts = new JComboBox();
126
127 MidiPortWizardPage() {
128 super(i18n.getLabel("MidiPortWizardPage.subtitle"));
129
130 setMainInstructions(i18n.getLabel("MidiPortWizardPage.mainInstructions"));
131
132 JPanel p = new JPanel();
133 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
134
135 p.add(lPort);
136
137 p.add(Box.createRigidArea(new Dimension(6, 0)));
138
139 cbPorts.setMaximumSize(cbPorts.getPreferredSize());
140
141 p.add(cbPorts);
142
143 setMainPane(p);
144 }
145 }
146
147 class AudioDeviceWizardPage extends UserInputPage {
148 private final JLabel lDevice = new JLabel(i18n.getLabel("AudioDeviceWizardPage.lDevice"));
149 private final JComboBox cbDevices = new JComboBox();
150
151 AudioDeviceWizardPage() {
152 super(i18n.getLabel("AudioDeviceWizardPage.subtitle"));
153
154 setMainInstructions(i18n.getLabel("AudioDeviceWizardPage.mainInstructions"));
155
156 JPanel p = new JPanel();
157 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
158
159 p.add(lDevice);
160
161 p.add(Box.createRigidArea(new Dimension(6, 0)));
162
163 for(AudioDeviceModel m : CC.getSamplerModel().getAudioDeviceModels()) {
164 cbDevices.addItem(m.getDeviceInfo());
165 }
166
167 cbDevices.setMaximumSize(cbDevices.getPreferredSize());
168
169 p.add(cbDevices);
170
171 setMainPane(p);
172 }
173 }
174
175 class EngineWizardPage extends UserInputPage {
176 private final JLabel lEngine = new JLabel(i18n.getLabel("EngineWizardPage.lEngine"));
177 private final JComboBox cbEngines = new JComboBox();
178
179 EngineWizardPage() {
180 super(i18n.getLabel("EngineWizardPage.subtitle"));
181
182 setOptionalButtons(OptionalButtons.LAST);
183
184 setMainInstructions(i18n.getLabel("EngineWizardPage.mainInstructions"));
185
186 JPanel p = new JPanel();
187 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
188
189 p.add(lEngine);
190
191 p.add(Box.createRigidArea(new Dimension(6, 0)));
192
193 for(Object o : CC.getSamplerModel().getEngines()) {
194 cbEngines.addItem(o);
195 }
196
197 cbEngines.setMaximumSize(cbEngines.getPreferredSize());
198
199 p.add(cbEngines);
200
201 setMainPane(p);
202 }
203 }
204
205 class InstrumentWizardPage extends UserInputPage {
206
207 InstrumentWizardPage() {
208 super(i18n.getLabel("InstrumentWizardPage.subtitle"));
209
210 setMainInstructions(i18n.getLabel("InstrumentWizardPage.mainInstructions"));
211 }
212 }
213
214 class ConfirmationWizardPage extends ConfirmationPage {
215
216 ConfirmationWizardPage() {
217 //super(i18n.getLabel("ConfirmationWizardPage.subtitle"));
218
219 setPageType(Type.CONFIRMATION_PAGE);
220 }
221
222 /**
223 * Invoked when the user clicks the 'Finish' button
224 * while this page is the current page of the wizard.
225 * @return <code>true</code>
226 */
227 public boolean
228 mayFinish() {
229 CC.getTaskQueue().add(new AddChannel());
230
231 return true;
232 }
233 }

  ViewVC Help
Powered by ViewVC