final Container cp = getContentPane();
final Application app = AbstractApplication.getApplication();
// final JPanel buttonPanel;
final Box buttonPanel;
final JTabbedPane ggTabPane;
final String abCfgID;
final AudioBoxConfig abCfg;
JButton ggButton;
// Param p;
audioPrefs = app.getUserPrefs().node( PrefsUtil.NODE_AUDIO );
abCfgID = audioPrefs.get( PrefsUtil.KEY_AUDIOBOX, AudioBoxConfig.ID_DEFAULT );
abCfg = new AudioBoxConfig( audioPrefs.node( PrefsUtil.NODE_AUDIOBOXES ).node( abCfgID ));
audioHwChannels[0] = abCfg.numInputChannels;
audioHwChannels[1] = abCfg.numOutputChannels;
ggTabPane = new JTabbedPane();
// ---------- tabs ----------
for( int i = 0; i < NUM_TABS; i++ ) { // input + output tabs
fromPrefs( i );
ggTabPane.addTab( app.getResourceString( i == 0 ? "labelInputs" : "labelOutputs" ), null,
createTab( i ), null );
}
// ---------- generic gadgets ----------
buttonPanel = Box.createHorizontalBox(); // new JPanel( new FlowLayout( FlowLayout.RIGHT, 4, 4 ));
buttonPanel.setBorder( BorderFactory.createEmptyBorder( 0, 0, 2, 0 ));
buttonPanel.add( new HelpButton( "IOSetup" ));
buttonPanel.add( Box.createHorizontalGlue() );
ggButton = new JButton( app.getResourceString( "buttonOk" ));
ggButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e )
{
final ControlRoomFrame f;
for( int i = 0; i < NUM_TABS; i++ ) {
if( !toPrefs( i )) return;
}
disposeAndClose();
// XXX ControlRoomFrame cannot rely on prefs since childAdded is
// never fired (probably bug in java or spi)
f = (ControlRoomFrame) app.getComponent( Main.COMP_CTRLROOM );
if( f != null ) f.refillIOConfigs();
}
});
buttonPanel.add( ggButton );
ggButton = new JButton( app.getResourceString( "buttonCancel" ));
buttonPanel.add( ggButton );
ggButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e )
{
disposeAndClose();
}
});
buttonPanel.add( CoverGrowBox.create() );
// if( app.getUserPrefs().getBoolean( PrefsUtil.KEY_INTRUDINGSIZE, false )) {
// buttonPanel.add( Box.createHorizontalStrut( 16 ));
// }
cp.add( ggTabPane, BorderLayout.CENTER );
cp.add( buttonPanel, BorderLayout.SOUTH );
AbstractWindowHandler.setDeepFont( cp );
// ---------- ----------
ggTabPane.setSelectedIndex( NUM_TABS - 1 );
setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
init();
app.addComponent( Main.COMP_IOSETUP, this );
}