public void setValueAt( Object value, int row, int col )
{
if( (row > collAudioBoxConfigs.size()) || (value == null) ) return;
final AudioBoxConfig cfg = (AudioBoxConfig) collAudioBoxConfigs.get( row );
String name;
AudioBoxConfig newCfg = null;
int newChannels;
boolean newActive;
boolean trigger = false;
switch( col ) {
case 0:
name = value.toString();
// if( (name.length() > 0) && (name.length() < Preferences.MAX_NAME_LENGTH) &&
if( (name.length() > 0) &&
!setAudioBoxNames.contains( name )) {
newCfg = cfg.changeName( name );
trigger = true;
}
break;
case 1:
case 2:
if( value instanceof Number ) {
newChannels = Math.max( 0, ((Number) value).intValue() );
} else if( value instanceof String ) {
try {
newChannels = Math.max( 0, Integer.parseInt( value.toString() ));
}
catch( NumberFormatException e1 ) {
break;
}
} else {
assert false : value;
break;
}
if( col == 1 ) {
if( newChannels == cfg.numInputChannels ) return;
newCfg = cfg.changeChannels( newChannels, cfg.numOutputChannels );
} else {
if( newChannels == cfg.numOutputChannels ) return;
newCfg = cfg.changeChannels( cfg.numInputChannels, newChannels );
}
break;
case 3:
if( value instanceof Boolean ) {
newActive = ((Boolean) value).booleanValue();
} else {
assert false : value;
break;
}
if( newActive == cfg.active ) return;
newCfg = cfg.changeActive( newActive );
trigger = true;
break;
default:
break;
}
if( newCfg != null ) {
collAudioBoxConfigs.set( row, newCfg );
if( !cfg.name.equals( newCfg.name )) {
// try {
// abPrefs.node( cfg.id ).removeNode();
setAudioBoxNames.remove( cfg.name );
setAudioBoxNames.add( newCfg.name );
// }
// catch( BackingStoreException e1 ) {
// newCfg = cfg;
// GUIUtil.displayError( null, e1, getResourceString( "errLoadPrefs" ));
// }
}
newCfg.toPrefs( abPrefs.node( newCfg.id ));
if( trigger ) triggerCtrlRoomRefill();
}
fireTableRowsUpdated( row, row ); // updates sorting!
}