final DesktopName[] names = provideDefaultDesktopNames(voice, sections);
final ViewPath vp = new ViewPath(ZDesktopManager.dockWORKSPACE, names);
return new ViewInstance() {
public JComponent getView() throws ComponentGenerationException {
try {
DeviceWorkspaceEnclosurePanel dep = new DeviceWorkspaceEnclosurePanel();
VoiceSectionPanel vsp = new VoiceSectionPanel(tp, ViewIndexFactory.getVoiceSectionIndex(sections));
int gridIndex = 0;
if ((sections & VoiceSections.VOICE_CORDS) != 0) {
CordPanel p = new CordPanel();
p.init(voice);
vsp.addAnchoredComponent(p, gridIndex++, 0, GridBagConstraints.NORTH);
}
if ((sections & VoiceSections.VOICE_AMP_FILTER) != 0) {
AmplifierPanel amp = new AmplifierPanel();
amp.init(voice);
vsp.addAnchoredComponent(amp, gridIndex++, 0, GridBagConstraints.NORTH);
FilterPanel filt = new FilterPanel();
filt.init(voice);
vsp.addAnchoredComponent(filt, gridIndex++, 0, GridBagConstraints.NORTH);
} else {
if ((sections & VoiceSections.VOICE_AMP) != 0) {
AmplifierPanel p = new AmplifierPanel();
p.init(voice);
vsp.addAnchoredComponent(p, gridIndex++, 0, GridBagConstraints.NORTH);
}
if ((sections & VoiceSections.VOICE_FILTER) != 0) {
FilterPanel p = new FilterPanel();
p.init(voice);
vsp.addAnchoredComponent(p, gridIndex++, 0, GridBagConstraints.NORTH);
}
}
if ((sections & VoiceSections.VOICE_LFO) != 0) {
LFOPanel p = new LFOPanel();
p.init(voice);
vsp.addAnchoredComponent(p, gridIndex++, 0, GridBagConstraints.NORTH);
}
if ((sections & VoiceSections.VOICE_TUNING) != 0) {
TuningPanel p = new TuningPanel();
p.init(voice);
vsp.addAnchoredComponent(p, gridIndex++, 0, GridBagConstraints.NORTH);
}
if ((sections & VoiceSections.VOICE_ENVELOPES) != 0) {
AmpEnvelopePanel amp = new AmpEnvelopePanel();
amp.init(voice);
vsp.addAnchoredComponent(amp, gridIndex++, 0, GridBagConstraints.NORTH);
FilterEnvelopePanel filt = new FilterEnvelopePanel();
filt.init(voice);
vsp.addAnchoredComponent(filt, gridIndex++, 0, GridBagConstraints.NORTH);
AuxEnvelopePanel aux = new AuxEnvelopePanel();
aux.init(voice);
vsp.addAnchoredComponent(aux, gridIndex++, 0, GridBagConstraints.NORTH);
} else {
if ((sections & VoiceSections.VOICE_AMP_ENVELOPE) != 0) {
AmpEnvelopePanel p = new AmpEnvelopePanel();
p.init(voice);
vsp.addAnchoredComponent(p, gridIndex++, 0, GridBagConstraints.NORTH);
}
if ((sections & VoiceSections.VOICE_FILTER_ENVELOPE) != 0) {
FilterEnvelopePanel p = new FilterEnvelopePanel();
p.init(voice);
vsp.addAnchoredComponent(p, gridIndex++, 0, GridBagConstraints.NORTH);
}
if ((sections & VoiceSections.VOICE_AUX_ENVELOPE) != 0) {
AuxEnvelopePanel p = new AuxEnvelopePanel();
p.init(voice);
vsp.addAnchoredComponent(p, gridIndex++, 0, GridBagConstraints.NORTH);
}
}
dep.init(voice.getPreset().getDeviceContext(), vsp);
return dep;
} catch (Exception e) {
throw new ComponentGenerationException(e.getMessage());
}
}