mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Work in progress - updates channel component editors and changes
functionality so that the editor starts up without a channel displayed and as each channel row is selected in the channels table, the editor is updated with the channel configuration. Likewise, the channel editor is now a channel event listener on the channel model and will maintain channel state if the user changes channel configuration in any of the external channel controllers like the spectral display or the channel list.
This commit is contained in:
@@ -17,15 +17,16 @@
|
||||
******************************************************************************/
|
||||
package record;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
import record.config.RecordConfiguration;
|
||||
import controller.channel.AbstractChannelEditor;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelConfigurationEditor;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
|
||||
public class RecordComponentEditor extends AbstractChannelEditor
|
||||
public class RecordComponentEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -33,74 +34,63 @@ public class RecordComponentEditor extends AbstractChannelEditor
|
||||
private JCheckBox mBasebandRecorder = new JCheckBox( "Baseband I/Q" );
|
||||
private JCheckBox mTrafficBasebandRecorder = new JCheckBox( "Traffic Channel Baseband I/Q" );
|
||||
|
||||
public RecordComponentEditor( Channel channel )
|
||||
private Channel mChannel;
|
||||
|
||||
public RecordComponentEditor()
|
||||
{
|
||||
super( channel );
|
||||
|
||||
add( mAudioRecorder, "span" );
|
||||
add( mBasebandRecorder, "span" );
|
||||
add( mTrafficBasebandRecorder, "span" );
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
RecordConfiguration config = getChannel().getRecordConfiguration();
|
||||
|
||||
config.clearRecorders();
|
||||
|
||||
if( mAudioRecorder.isSelected() )
|
||||
if( mChannel != null )
|
||||
{
|
||||
config.addRecorder( RecorderType.AUDIO );
|
||||
RecordConfiguration config = mChannel.getRecordConfiguration();
|
||||
|
||||
config.clearRecorders();
|
||||
|
||||
if( mAudioRecorder.isSelected() )
|
||||
{
|
||||
config.addRecorder( RecorderType.AUDIO );
|
||||
}
|
||||
|
||||
if( mBasebandRecorder.isSelected() )
|
||||
{
|
||||
config.addRecorder( RecorderType.BASEBAND );
|
||||
}
|
||||
|
||||
if( mTrafficBasebandRecorder.isSelected() )
|
||||
{
|
||||
config.addRecorder( RecorderType.TRAFFIC_BASEBAND );
|
||||
}
|
||||
}
|
||||
|
||||
if( mBasebandRecorder.isSelected() )
|
||||
{
|
||||
config.addRecorder( RecorderType.BASEBAND );
|
||||
}
|
||||
|
||||
if( mTrafficBasebandRecorder.isSelected() )
|
||||
{
|
||||
config.addRecorder( RecorderType.TRAFFIC_BASEBAND );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
javax.swing.SwingUtilities.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
RecordConfiguration config = getChannel().getRecordConfiguration();
|
||||
|
||||
mAudioRecorder.setSelected( config.getRecorders()
|
||||
.contains( RecorderType.AUDIO ) );
|
||||
|
||||
mBasebandRecorder.setSelected( config.getRecorders()
|
||||
.contains( RecorderType.BASEBAND ) );
|
||||
|
||||
mTrafficBasebandRecorder.setSelected( config.getRecorders()
|
||||
.contains( RecorderType.TRAFFIC_BASEBAND ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
mChannel = channel;
|
||||
|
||||
if( mChannel != null )
|
||||
{
|
||||
List<RecorderType> recorders = mChannel.getRecordConfiguration().getRecorders();
|
||||
|
||||
mAudioRecorder.setSelected( recorders.contains( RecorderType.AUDIO ) );
|
||||
mBasebandRecorder.setSelected( recorders.contains( RecorderType.BASEBAND ) );
|
||||
mTrafficBasebandRecorder.setSelected( recorders.contains( RecorderType.TRAFFIC_BASEBAND ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mAudioRecorder.setSelected( false );
|
||||
mBasebandRecorder.setSelected( false );
|
||||
mTrafficBasebandRecorder.setSelected( false );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user