mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
wip #34 - reformatting the channel configuration editors.
This commit is contained in:
@@ -17,59 +17,74 @@
|
||||
******************************************************************************/
|
||||
package source.tuner;
|
||||
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
import gui.control.JFrequencyControl;
|
||||
import source.SourceEditor;
|
||||
import source.SourceManager;
|
||||
import gui.editor.Editor;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import source.config.SourceConfigTuner;
|
||||
import source.config.SourceConfiguration;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.IFrequencyChangeProcessor;
|
||||
import controller.channel.Channel;
|
||||
|
||||
public class TunerEditorOld extends SourceEditor
|
||||
public class TunerSourceEditor extends Editor<Channel>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private JFrequencyControl mFrequencyControl;
|
||||
|
||||
public TunerEditorOld( SourceManager sourceManager,
|
||||
SourceConfiguration config )
|
||||
|
||||
public TunerSourceEditor()
|
||||
{
|
||||
super( sourceManager, config );
|
||||
|
||||
initGUI();
|
||||
init();
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
mFrequencyControl.setFrequency(
|
||||
((SourceConfigTuner)mConfig).getFrequency(), false );
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
((SourceConfigTuner)mConfig).setFrequency( mFrequencyControl.getFrequency() );
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "fill", "[left]", "[][grow]" ) );
|
||||
mFrequencyControl = new JFrequencyControl();
|
||||
|
||||
mFrequencyControl.setFrequency(
|
||||
((SourceConfigTuner)mConfig).getFrequency(), false );
|
||||
|
||||
mFrequencyControl.setEnabled( false );
|
||||
mFrequencyControl.addListener( new IFrequencyChangeProcessor()
|
||||
{
|
||||
@Override
|
||||
public void frequencyChanged( FrequencyChangeEvent event )
|
||||
{
|
||||
setModified( true );
|
||||
}
|
||||
} );
|
||||
add( mFrequencyControl );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
public void save()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
if( hasItem() && isModified() )
|
||||
{
|
||||
SourceConfigTuner config = new SourceConfigTuner();
|
||||
config.setFrequency( mFrequencyControl.getFrequency() );
|
||||
getItem().setSourceConfiguration( config );
|
||||
}
|
||||
|
||||
setModified( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
public void setItem( Channel item )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
super.setItem( item );
|
||||
|
||||
if( hasItem() )
|
||||
{
|
||||
SourceConfiguration config = getItem().getSourceConfiguration();
|
||||
|
||||
if( config instanceof SourceConfigTuner )
|
||||
{
|
||||
mFrequencyControl.setFrequency( ((SourceConfigTuner)config).getFrequency(), false );
|
||||
}
|
||||
|
||||
mFrequencyControl.setEnabled( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
mFrequencyControl.setEnabled( false );
|
||||
}
|
||||
|
||||
setModified( false );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user