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:
@@ -129,12 +129,12 @@ public class ControllerPanel extends JPanel
|
||||
mTabbedPane = new JideTabbedPane();
|
||||
mTabbedPane.setFont( this.getFont() );
|
||||
mTabbedPane.setForeground( Color.BLACK );
|
||||
mTabbedPane.addTab( "Channels", mPlaylistEditor );
|
||||
mTabbedPane.addTab( "Configuration", mSystemControlSplitPane );
|
||||
mTabbedPane.addTab( "Channel Spectrum", mChannelSpectrumPanel );
|
||||
mTabbedPane.addTab( "Events", mCallEventPanel );
|
||||
mTabbedPane.addTab( "Messages", mMessageActivityPanel );
|
||||
|
||||
mTabbedPane.addTab( "Playlist", mPlaylistEditor );
|
||||
mTabbedPane.addTab( "Map", mMapPanel );
|
||||
|
||||
/**
|
||||
* Change listener to enable/disable the channel spectrum display
|
||||
@@ -160,11 +160,6 @@ public class ControllerPanel extends JPanel
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* Add mapping services and map panel to a new tab
|
||||
*/
|
||||
mTabbedPane.addTab( "Map", mMapPanel );
|
||||
|
||||
/* Register each of the components to receive channel events when the
|
||||
* channels are selected or change */
|
||||
mChannelModel.addListener( mCallEventPanel );
|
||||
@@ -176,7 +171,6 @@ public class ControllerPanel extends JPanel
|
||||
channelStateListScroll.getViewport().setView( mChannelStateList );
|
||||
channelStateListScroll.setPreferredSize( new Dimension( 200, 300 ) );
|
||||
|
||||
|
||||
JideSplitPane audioChannelListSplit = new JideSplitPane( JideSplitPane.VERTICAL_SPLIT );
|
||||
audioChannelListSplit.setDividerSize( 5 );
|
||||
audioChannelListSplit.add( mAudioPanel );
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,6 +20,7 @@ package controller.channel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
@@ -63,11 +64,10 @@ public class ChannelEditor extends JPanel
|
||||
private RecordComponentEditor mRecordEditor;
|
||||
private SourceComponentEditor mSourceEditor;
|
||||
|
||||
private JTextField mChannelName;
|
||||
private JCheckBox mChannelEnabled = new JCheckBox();
|
||||
private JComboBox<AliasList> mComboAliasLists;
|
||||
|
||||
private Channel mChannel;
|
||||
|
||||
private JCheckBox mChannelEnabled = new JCheckBox();
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private SourceManager mSourceManager;
|
||||
@@ -88,9 +88,18 @@ public class ChannelEditor extends JPanel
|
||||
initGUI();
|
||||
}
|
||||
|
||||
public void setChannel( Channel channel )
|
||||
/**
|
||||
* Sets the channel configuration in each of the channel editor components
|
||||
* Note: this method must be invoked on the swing event dispatch thread
|
||||
*/
|
||||
public void setChannel( final Channel channel )
|
||||
{
|
||||
mNameConfigurationEditor.setConfiguration( channel );
|
||||
mSourceEditor.setConfiguration( channel );
|
||||
mDecodeEditor.setConfiguration( channel );
|
||||
mAuxDecodeEditor.setConfiguration( channel );
|
||||
mEventLogEditor.setConfiguration( channel );
|
||||
mRecordEditor.setConfiguration( channel );
|
||||
|
||||
mChannel = channel;
|
||||
}
|
||||
@@ -103,27 +112,28 @@ public class ChannelEditor extends JPanel
|
||||
|
||||
add( new JLabel( "Enabled:" ), "wrap" );
|
||||
|
||||
add( mNameConfigurationEditor );
|
||||
add( mNameConfigurationEditor, "growx" );
|
||||
|
||||
JideTabbedPane tabs = new JideTabbedPane();
|
||||
tabs.setFont( this.getFont() );
|
||||
tabs.setForeground( Color.BLACK );
|
||||
|
||||
tabs.addTab( "Name/Alias", mNameConfigurationEditor );
|
||||
// mSourceEditor = new SourceComponentEditor( mSourceManager, mChannel );
|
||||
// tabs.addTab( "Source", mSourceEditor );
|
||||
//
|
||||
// mDecodeEditor = new DecodeComponentEditor( mPlaylistManager, mChannel );
|
||||
// tabs.addTab( "Decoder", mDecodeEditor );
|
||||
//
|
||||
// mAuxDecodeEditor = new AuxDecodeComponentEditor( mChannel );
|
||||
// tabs.addTab( "Aux", mAuxDecodeEditor );
|
||||
//
|
||||
// mEventLogEditor = new EventLogComponentEditor( mChannel );
|
||||
// tabs.addTab( "Event Log", mEventLogEditor );
|
||||
//
|
||||
// mRecordEditor = new RecordComponentEditor( mChannel );
|
||||
// tabs.addTab( "Record", mRecordEditor );
|
||||
|
||||
mSourceEditor = new SourceComponentEditor( mSourceManager );
|
||||
tabs.addTab( "Source", mSourceEditor );
|
||||
|
||||
mDecodeEditor = new DecodeComponentEditor( mPlaylistManager );
|
||||
tabs.addTab( "Decoder", mDecodeEditor );
|
||||
|
||||
mAuxDecodeEditor = new AuxDecodeComponentEditor();
|
||||
tabs.addTab( "Aux Decoders", mAuxDecodeEditor );
|
||||
|
||||
mEventLogEditor = new EventLogComponentEditor();
|
||||
tabs.addTab( "Logging", mEventLogEditor );
|
||||
|
||||
mRecordEditor = new RecordComponentEditor();
|
||||
tabs.addTab( "Recording", mRecordEditor );
|
||||
|
||||
add( tabs, "span,grow,push" );
|
||||
|
||||
@@ -139,7 +149,28 @@ public class ChannelEditor extends JPanel
|
||||
@Override
|
||||
public void channelChanged( ChannelEvent event )
|
||||
{
|
||||
if( !EventQueue.isDispatchThread() )
|
||||
{
|
||||
mLog.debug( "Not on the swing thread!!!!" );
|
||||
}
|
||||
|
||||
if( mChannel != null && mChannel == event.getChannel() )
|
||||
{
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case NOTIFICATION_CONFIGURATION_CHANGE:
|
||||
case NOTIFICATION_PROCESSING_START:
|
||||
case NOTIFICATION_PROCESSING_STOP:
|
||||
setChannel( mChannel );
|
||||
break;
|
||||
case NOTIFICATION_DELETE:
|
||||
mChannel = null;
|
||||
setChannel( mChannel );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,6 +194,17 @@ public class ChannelEditor extends JPanel
|
||||
{
|
||||
//Validate each of the configuration editors to check for errors
|
||||
mNameConfigurationEditor.validateConfiguration();
|
||||
mSourceEditor.validateConfiguration();
|
||||
mDecodeEditor.validateConfiguration();
|
||||
mAuxDecodeEditor.validateConfiguration();
|
||||
mEventLogEditor.validateConfiguration();
|
||||
|
||||
//Validate the source configuration against the decode editor to
|
||||
//ensure that the source type is compatible with the decode type
|
||||
|
||||
//Validate the aux decoders against the primary decoder
|
||||
//TODO: make sure that no aux decoders are running with P25
|
||||
|
||||
// /**
|
||||
// * Validate the source configuration against the other component
|
||||
// * configuration editors
|
||||
@@ -207,6 +249,10 @@ public class ChannelEditor extends JPanel
|
||||
|
||||
//Save the contents of each editor to the channel configuration
|
||||
mNameConfigurationEditor.save();
|
||||
mSourceEditor.save();
|
||||
mDecodeEditor.save();
|
||||
mAuxDecodeEditor.save();
|
||||
mEventLogEditor.save();
|
||||
|
||||
//Broadcast a channel configuration change event
|
||||
mChannelModel.broadcast( new ChannelEvent( mChannel,
|
||||
|
||||
@@ -255,14 +255,32 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
|
||||
channel.setEnabled( true );
|
||||
|
||||
mProcessingChains.put( channel.getChannelID(), processingChain );
|
||||
|
||||
mChannelModel.broadcast(
|
||||
new ChannelEvent( channel, Event.NOTIFICATION_PROCESSING_START ) );
|
||||
}
|
||||
|
||||
private void stopProcessing( Channel channel, boolean remove )
|
||||
{
|
||||
mChannelModel.broadcast(
|
||||
new ChannelEvent( channel, Event.NOTIFICATION_PROCESSING_STOP ) );
|
||||
if( mProcessingChains.containsKey( channel.getChannelID() ) )
|
||||
{
|
||||
ProcessingChain chain = mProcessingChains.get( channel.getChannelID() );
|
||||
|
||||
chain.stop();
|
||||
|
||||
mChannelModel.broadcast(
|
||||
new ChannelEvent( channel, Event.NOTIFICATION_PROCESSING_STOP ) );
|
||||
|
||||
if( remove )
|
||||
{
|
||||
mProcessingChains.remove( channel.getChannelID() );
|
||||
|
||||
chain.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
channel.setEnabled( false );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
package controller.channel;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -13,9 +30,6 @@ import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasList;
|
||||
@@ -24,14 +38,14 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger mLog = LoggerFactory.getLogger( NameConfigurationEditor.class );
|
||||
private static final String DEFAULT_NAME = "Please select a channel to view/edit";
|
||||
|
||||
private static ComboBoxModel<String> EMPTY_MODEL = new DefaultComboBoxModel<>();
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
|
||||
private JTextField mChannelName = new JTextField( "Please select a channel to edit" );
|
||||
private JTextField mChannelName = new JTextField( DEFAULT_NAME );
|
||||
private JComboBox<String> mSystemNameCombo = new JComboBox<>( EMPTY_MODEL );
|
||||
private JComboBox<String> mSiteNameCombo = new JComboBox<>( EMPTY_MODEL );
|
||||
private JComboBox<AliasList> mAliasListCombo;
|
||||
@@ -44,7 +58,7 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
mChannelModel = model;
|
||||
mPlaylistManager = playlistManager;
|
||||
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right][]", "[][][][grow]" ) );
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right][]", "[][][][][][grow]" ) );
|
||||
|
||||
add( new JLabel( "Name:" ) );
|
||||
add( mChannelName, "growx" );
|
||||
@@ -156,7 +170,11 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
mChannel.setSystem( ( system == null ? null : (String)system ) );
|
||||
|
||||
Object site = mSiteNameCombo.getSelectedItem();
|
||||
mChannel.setSystem( ( site == null ? null : (String)site ) );
|
||||
mChannel.setSite( ( site == null ? null : (String)site ) );
|
||||
|
||||
Object aliasList = mAliasListCombo.getSelectedItem();
|
||||
mChannel.setAliasListName( aliasList == null ? null :
|
||||
((AliasList)aliasList).getName() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,44 +196,54 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
mChannel = channel;
|
||||
|
||||
mChannelName.setText( channel.getName() );
|
||||
|
||||
List<String> systems = mChannelModel.getSystems();
|
||||
|
||||
if( systems.isEmpty() )
|
||||
if( mChannel != null )
|
||||
{
|
||||
mChannelName.setText( channel.getName() );
|
||||
|
||||
List<String> systems = mChannelModel.getSystems();
|
||||
|
||||
if( systems.isEmpty() )
|
||||
{
|
||||
mSystemNameCombo.setModel( EMPTY_MODEL );
|
||||
}
|
||||
else
|
||||
{
|
||||
mSystemNameCombo.setModel( new DefaultComboBoxModel<String>(
|
||||
systems.toArray( new String[ systems.size() ] ) ) );;
|
||||
}
|
||||
|
||||
mSystemNameCombo.setSelectedItem( channel.getSystem() );
|
||||
|
||||
List<String> sites = mChannelModel.getSites( channel.getSystem() );
|
||||
|
||||
if( sites.isEmpty() )
|
||||
{
|
||||
mSiteNameCombo.setModel( EMPTY_MODEL );
|
||||
}
|
||||
else
|
||||
{
|
||||
mSiteNameCombo.setModel( new DefaultComboBoxModel<String>(
|
||||
sites.toArray( new String[ sites.size() ] ) ) );;
|
||||
}
|
||||
|
||||
mSiteNameCombo.setSelectedItem( channel.getSite() );
|
||||
|
||||
String aliasListName = mChannel.getAliasListName();
|
||||
|
||||
if( aliasListName != null )
|
||||
{
|
||||
AliasList selected = mPlaylistManager.getPlayist().getAliasDirectory()
|
||||
.getAliasList( aliasListName );
|
||||
|
||||
mAliasListCombo.setSelectedItem( selected );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mChannelName.setText( DEFAULT_NAME );
|
||||
mSystemNameCombo.setModel( EMPTY_MODEL );
|
||||
}
|
||||
else
|
||||
{
|
||||
mSystemNameCombo.setModel( new DefaultComboBoxModel<String>(
|
||||
systems.toArray( new String[ systems.size() ] ) ) );;
|
||||
}
|
||||
|
||||
mSystemNameCombo.setSelectedItem( channel.getSystem() );
|
||||
|
||||
List<String> sites = mChannelModel.getSites( channel.getSystem() );
|
||||
|
||||
if( sites.isEmpty() )
|
||||
{
|
||||
mSiteNameCombo.setModel( EMPTY_MODEL );
|
||||
mAliasListCombo.setSelectedIndex( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
mSiteNameCombo.setModel( new DefaultComboBoxModel<String>(
|
||||
sites.toArray( new String[ sites.size() ] ) ) );;
|
||||
}
|
||||
|
||||
mSiteNameCombo.setSelectedItem( channel.getSite() );
|
||||
|
||||
String aliasListName = mChannel.getAliasListName();
|
||||
|
||||
if( aliasListName != null )
|
||||
{
|
||||
AliasList selected = mPlaylistManager.getPlayist().getAliasDirectory()
|
||||
.getAliasList( aliasListName );
|
||||
|
||||
mAliasListCombo.setSelectedItem( selected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,19 +132,19 @@ public class OldChannelEditor extends ChannelConfigurationEditor implements Acti
|
||||
tabs.setFont( this.getFont() );
|
||||
tabs.setForeground( Color.BLACK );
|
||||
|
||||
mSourceEditor = new SourceComponentEditor( mSourceManager, mChannel );
|
||||
mSourceEditor = new SourceComponentEditor( mSourceManager );
|
||||
tabs.addTab( "Source", mSourceEditor );
|
||||
|
||||
mDecodeEditor = new DecodeComponentEditor( mPlaylistManager, mChannel );
|
||||
mDecodeEditor = new DecodeComponentEditor( mPlaylistManager );
|
||||
tabs.addTab( "Decoder", mDecodeEditor );
|
||||
|
||||
mAuxDecodeEditor = new AuxDecodeComponentEditor( mChannel );
|
||||
mAuxDecodeEditor = new AuxDecodeComponentEditor();
|
||||
tabs.addTab( "Aux", mAuxDecodeEditor );
|
||||
|
||||
mEventLogEditor = new EventLogComponentEditor( mChannel );
|
||||
mEventLogEditor = new EventLogComponentEditor();
|
||||
tabs.addTab( "Event Log", mEventLogEditor );
|
||||
|
||||
mRecordEditor = new RecordComponentEditor( mChannel );
|
||||
mRecordEditor = new RecordComponentEditor();
|
||||
tabs.addTab( "Record", mRecordEditor );
|
||||
|
||||
add( tabs, "span,grow,push" );
|
||||
|
||||
@@ -17,84 +17,70 @@
|
||||
******************************************************************************/
|
||||
package module.decode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import module.decode.config.AuxDecodeConfiguration;
|
||||
import controller.channel.AbstractChannelEditor;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelConfigurationEditor;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
|
||||
public class AuxDecodeComponentEditor extends AbstractChannelEditor
|
||||
public class AuxDecodeComponentEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private HashMap<DecoderType,AuxDecoderCheckBox> mControls =
|
||||
new HashMap<DecoderType,AuxDecoderCheckBox>();
|
||||
private List<AuxDecoderCheckBox> mControls = new ArrayList<>();
|
||||
|
||||
public AuxDecodeComponentEditor( Channel channel )
|
||||
private Channel mChannel;
|
||||
|
||||
public AuxDecodeComponentEditor()
|
||||
{
|
||||
super( channel );
|
||||
|
||||
List<DecoderType> decoders = DecoderType.getAuxDecoders();
|
||||
|
||||
Collections.sort( decoders );
|
||||
|
||||
|
||||
for( DecoderType decoder: decoders )
|
||||
{
|
||||
AuxDecoderCheckBox control = new AuxDecoderCheckBox( decoder );
|
||||
|
||||
if( getConfig().getAuxDecoders().contains( decoder ) )
|
||||
{
|
||||
control.setSelected( true );
|
||||
}
|
||||
|
||||
add( control, "wrap" );
|
||||
|
||||
mControls.put( decoder, control );
|
||||
mControls.add( control );
|
||||
}
|
||||
}
|
||||
|
||||
public AuxDecodeConfiguration getConfig()
|
||||
{
|
||||
return getChannel().getAuxDecodeConfiguration();
|
||||
if( mChannel != null )
|
||||
{
|
||||
return mChannel.getAuxDecodeConfiguration();
|
||||
}
|
||||
|
||||
return new AuxDecodeConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
getConfig().clearAuxDecoders();
|
||||
|
||||
for( DecoderType decoder: mControls.keySet() )
|
||||
if( mChannel != null )
|
||||
{
|
||||
if( mControls.get( decoder ) .isSelected() )
|
||||
AuxDecodeConfiguration config = mChannel.getAuxDecodeConfiguration();
|
||||
|
||||
config.clearAuxDecoders();
|
||||
|
||||
for( AuxDecoderCheckBox checkBox: mControls )
|
||||
{
|
||||
getConfig().addAuxDecoder( decoder );
|
||||
if( checkBox.isSelected() )
|
||||
{
|
||||
config.addAuxDecoder( checkBox.getDecoderType() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
SwingUtilities.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for( DecoderType decoder: mControls.keySet() )
|
||||
{
|
||||
mControls.get( decoder ).setSelected(
|
||||
getConfig().getAuxDecoders().contains( decoder ) );
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public class AuxDecoderCheckBox extends JCheckBox
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -107,19 +93,35 @@ public class AuxDecodeComponentEditor extends AbstractChannelEditor
|
||||
|
||||
mDecoderType = decoder;
|
||||
}
|
||||
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return mDecoderType;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
mChannel = channel;
|
||||
|
||||
for( AuxDecoderCheckBox checkBox: mControls )
|
||||
{
|
||||
if( mChannel != null &&
|
||||
mChannel.getAuxDecodeConfiguration().getAuxDecoders()
|
||||
.contains( checkBox.getDecoderType() ) )
|
||||
{
|
||||
checkBox.setSelected( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
checkBox.setSelected( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/*******************************************************************************
|
||||
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
||||
*
|
||||
@@ -24,43 +23,38 @@ import java.awt.event.ActionListener;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import module.decode.config.DecodeConfigFactory;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import controller.channel.AbstractChannelEditor;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelConfigurationEditor;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
|
||||
public class DecodeComponentEditor extends AbstractChannelEditor
|
||||
public class DecodeComponentEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static Logger mLog = LoggerFactory.getLogger( DecodeComponentEditor.class );
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private JComboBox<DecoderType> mComboDecoders;
|
||||
|
||||
private DecodeEditor mEditor;
|
||||
|
||||
private PlaylistManager mPlaylistManager;
|
||||
|
||||
private Channel mChannel;
|
||||
|
||||
public DecodeComponentEditor( PlaylistManager playlistManager )
|
||||
{
|
||||
this( playlistManager, new Channel() );
|
||||
}
|
||||
|
||||
public DecodeComponentEditor( PlaylistManager playlistMangager, Channel channel )
|
||||
{
|
||||
super( channel );
|
||||
mPlaylistManager = playlistManager;
|
||||
|
||||
mPlaylistManager = playlistMangager;
|
||||
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) );
|
||||
|
||||
/**
|
||||
* ComboBox: Decoders
|
||||
*/
|
||||
mComboDecoders = new JComboBox<DecoderType>();
|
||||
|
||||
DefaultComboBoxModel<DecoderType> model =
|
||||
@@ -84,14 +78,15 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
||||
if( selected != null )
|
||||
{
|
||||
DecodeConfiguration config;
|
||||
|
||||
if( mChannel.getDecodeConfiguration().getDecoderType() == selected )
|
||||
|
||||
if( mChannel == null ||
|
||||
mChannel.getDecodeConfiguration().getDecoderType() != selected )
|
||||
{
|
||||
config = mChannel.getDecodeConfiguration();
|
||||
config = DecodeConfigFactory.getDecodeConfiguration( selected );
|
||||
}
|
||||
else
|
||||
{
|
||||
config = DecodeConfigFactory.getDecodeConfiguration( selected );
|
||||
config = mChannel.getDecodeConfiguration();
|
||||
}
|
||||
|
||||
//Remove the existing one
|
||||
@@ -111,29 +106,11 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add( new JLabel( "Decoder:" ) );
|
||||
add( mComboDecoders, "wrap" );
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
final DecoderType decoder = mChannel.getDecodeConfiguration().getDecoderType();
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run() {
|
||||
mComboDecoders.setSelectedItem( decoder );
|
||||
|
||||
mComboDecoders.requestFocus();
|
||||
|
||||
mComboDecoders.requestFocusInWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public DecodeConfiguration getDecodeConfig()
|
||||
{
|
||||
return mEditor.getConfig();
|
||||
@@ -147,7 +124,6 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
||||
mEditor.save();
|
||||
}
|
||||
|
||||
//The component that calls save will invoke the change broadcast
|
||||
mChannel.setDecodeConfiguration( mEditor.getConfig() );
|
||||
}
|
||||
|
||||
@@ -165,14 +141,23 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
mChannel = channel;
|
||||
|
||||
if( mChannel != null )
|
||||
{
|
||||
final DecoderType decoder = mChannel.getDecodeConfiguration().getDecoderType();
|
||||
|
||||
mComboDecoders.setSelectedItem( decoder );
|
||||
|
||||
mComboDecoders.requestFocus();
|
||||
|
||||
mComboDecoders.requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,18 +106,25 @@ public class ChannelStatePanel extends JPanel
|
||||
ProcessingChain processingChain =
|
||||
channelProcessingManager.getProcessingChain( mChannel );
|
||||
|
||||
mChannelState = processingChain.getChannelState();
|
||||
|
||||
mChannelState.setChangedAttributeListener( this );
|
||||
|
||||
init();
|
||||
if( processingChain != null )
|
||||
{
|
||||
mChannelState = processingChain.getChannelState();
|
||||
|
||||
mChannelState.setChangedAttributeListener( this );
|
||||
|
||||
init();
|
||||
|
||||
for( DecoderState decoderState: processingChain.getDecoderStates() )
|
||||
{
|
||||
DecoderPanel panel = DecoderFactory.getDecoderPanel( mSettingsManager, decoderState );
|
||||
mDecoderPanels.add( panel );
|
||||
add( panel, "grow,span" );
|
||||
}
|
||||
for( DecoderState decoderState: processingChain.getDecoderStates() )
|
||||
{
|
||||
DecoderPanel panel = DecoderFactory.getDecoderPanel( mSettingsManager, decoderState );
|
||||
mDecoderPanels.add( panel );
|
||||
add( panel, "grow,span" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mLog.error( "Processing Chain was null!" );
|
||||
}
|
||||
}
|
||||
|
||||
private void init()
|
||||
|
||||
@@ -20,92 +20,79 @@ package module.log;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import module.log.config.EventLogConfiguration;
|
||||
import controller.channel.AbstractChannelEditor;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelConfigurationEditor;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
|
||||
public class EventLogComponentEditor extends AbstractChannelEditor
|
||||
public class EventLogComponentEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JCheckBox mBinaryLogger = new JCheckBox( "Binary Messages" );
|
||||
private JCheckBox mDecodedLogger = new JCheckBox( "Decoded Messages" );
|
||||
private JCheckBox mCallEventLogger = new JCheckBox( "Call Events" );
|
||||
|
||||
private Channel mChannel;
|
||||
|
||||
public EventLogComponentEditor( Channel channel )
|
||||
public EventLogComponentEditor()
|
||||
{
|
||||
super( channel );
|
||||
|
||||
add( mBinaryLogger, "span" );
|
||||
add( mDecodedLogger, "span" );
|
||||
add( mCallEventLogger, "span" );
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the combo box to the type stored in the config object, causing the
|
||||
* editor panel to reset with the stored config
|
||||
*/
|
||||
public void reset()
|
||||
{
|
||||
SwingUtilities.invokeLater(new Runnable()
|
||||
{
|
||||
final List<EventLogType> mLoggers = mChannel
|
||||
.getEventLogConfiguration().getLoggers();
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mBinaryLogger.setSelected(
|
||||
mLoggers.contains( EventLogType.BINARY_MESSAGE ) );
|
||||
mDecodedLogger.setSelected(
|
||||
mLoggers.contains( EventLogType.DECODED_MESSAGE ) );
|
||||
mCallEventLogger.setSelected(
|
||||
mLoggers.contains( EventLogType.CALL_EVENT ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the current configuration as the stored configuration
|
||||
*/
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
EventLogConfiguration config = mChannel.getEventLogConfiguration();
|
||||
if( mChannel != null )
|
||||
{
|
||||
EventLogConfiguration config = mChannel.getEventLogConfiguration();
|
||||
|
||||
config.clear();
|
||||
|
||||
if( mBinaryLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.BINARY_MESSAGE );
|
||||
}
|
||||
|
||||
if( mDecodedLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.DECODED_MESSAGE );
|
||||
}
|
||||
if( mCallEventLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.CALL_EVENT );
|
||||
config.clear();
|
||||
|
||||
if( mBinaryLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.BINARY_MESSAGE );
|
||||
}
|
||||
if( mDecodedLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.DECODED_MESSAGE );
|
||||
}
|
||||
if( mCallEventLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.CALL_EVENT );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
mChannel = channel;
|
||||
|
||||
if( mChannel != null )
|
||||
{
|
||||
List<EventLogType> loggers = mChannel.getEventLogConfiguration().getLoggers();
|
||||
|
||||
mBinaryLogger.setSelected( loggers.contains( EventLogType.BINARY_MESSAGE ) );
|
||||
mDecodedLogger.setSelected( loggers.contains( EventLogType.DECODED_MESSAGE ) );
|
||||
mCallEventLogger.setSelected( loggers.contains( EventLogType.CALL_EVENT ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mBinaryLogger.setSelected( false );
|
||||
mDecodedLogger.setSelected( false );
|
||||
mCallEventLogger.setSelected( false );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,13 +54,15 @@ public class PlaylistEditor extends JPanel implements ListSelectionListener
|
||||
mChannelTable.getSelectionModel().addListSelectionListener( this );
|
||||
mChannelTable.setAutoCreateRowSorter( true );
|
||||
|
||||
TableFilterHeader channelHeaderFilter = new TableFilterHeader( mChannelTable );
|
||||
channelHeaderFilter.setAutoChoices( AutoChoices.ENABLED );
|
||||
TableFilterHeader channelHeaderFilter =
|
||||
new TableFilterHeader( mChannelTable, AutoChoices.ENABLED );
|
||||
channelHeaderFilter.setFilterOnUpdates( true );
|
||||
|
||||
JScrollPane channelScroller = new JScrollPane( mChannelTable );
|
||||
|
||||
JideSplitPane splitPane = new JideSplitPane( JideSplitPane.HORIZONTAL_SPLIT );
|
||||
splitPane.setDividerSize( 5 );
|
||||
splitPane.setShowGripper( true );
|
||||
splitPane.add( channelScroller );
|
||||
splitPane.add( mEditor );
|
||||
|
||||
@@ -73,15 +75,22 @@ public class PlaylistEditor extends JPanel implements ListSelectionListener
|
||||
//This limits event firing to only when selection is complete
|
||||
if( !event.getValueIsAdjusting() )
|
||||
{
|
||||
int index = mChannelTable.convertRowIndexToModel( mChannelTable.getSelectedRow() );
|
||||
|
||||
mLog.debug( "Index:" + index );
|
||||
int selectedRow = mChannelTable.getSelectedRow();
|
||||
|
||||
Channel channel = mChannelModel.getChannels().get( index );
|
||||
|
||||
if( channel != null )
|
||||
if( selectedRow != -1 )
|
||||
{
|
||||
mEditor.setChannel( channel );
|
||||
int index = mChannelTable.convertRowIndexToModel( mChannelTable.getSelectedRow() );
|
||||
|
||||
Channel channel = mChannelModel.getChannels().get( index );
|
||||
|
||||
if( channel != null )
|
||||
{
|
||||
mEditor.setChannel( channel );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mEditor.setChannel( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package record.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
@@ -28,19 +29,19 @@ import controller.config.Configuration;
|
||||
@XmlRootElement( name = "record_configuration" )
|
||||
public class RecordConfiguration extends Configuration
|
||||
{
|
||||
private ArrayList<RecorderType> mRecorders = new ArrayList<RecorderType>();
|
||||
private List<RecorderType> mRecorders = new ArrayList<>();
|
||||
|
||||
public RecordConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
@XmlElement( name = "recorder" )
|
||||
public ArrayList<RecorderType> getRecorders()
|
||||
public List<RecorderType> getRecorders()
|
||||
{
|
||||
return mRecorders;
|
||||
}
|
||||
|
||||
public void setRecorders( ArrayList<RecorderType> recorders )
|
||||
public void setRecorders( List<RecorderType> recorders )
|
||||
{
|
||||
mRecorders = recorders;
|
||||
}
|
||||
|
||||
@@ -28,22 +28,21 @@ import javax.swing.JLabel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import source.config.SourceConfigFactory;
|
||||
import source.config.SourceConfiguration;
|
||||
import controller.channel.AbstractChannelEditor;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelConfigurationEditor;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
|
||||
public class SourceComponentEditor extends AbstractChannelEditor
|
||||
public class SourceComponentEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JComboBox<SourceType> mComboSources;
|
||||
private SourceEditor mEditor;
|
||||
private SourceManager mSourceManager;
|
||||
private Channel mChannel = null;
|
||||
|
||||
public SourceComponentEditor( SourceManager sourceManager, Channel channel )
|
||||
public SourceComponentEditor( SourceManager sourceManager )
|
||||
{
|
||||
super( channel );
|
||||
|
||||
mSourceManager = sourceManager;
|
||||
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) );
|
||||
@@ -60,15 +59,15 @@ public class SourceComponentEditor extends AbstractChannelEditor
|
||||
if( selected != null )
|
||||
{
|
||||
SourceConfiguration config;
|
||||
|
||||
if( selected == mChannel.getSourceConfiguration().getSourceType() )
|
||||
|
||||
if( mChannel == null ||
|
||||
mChannel.getSourceConfiguration().getSourceType() != selected )
|
||||
{
|
||||
config = mChannel.getSourceConfiguration();
|
||||
config = SourceConfigFactory.getSourceConfiguration( selected );
|
||||
}
|
||||
else
|
||||
{
|
||||
config = SourceConfigFactory
|
||||
.getSourceConfiguration( selected );
|
||||
config = mChannel.getSourceConfiguration();
|
||||
}
|
||||
|
||||
//Remove the existing one
|
||||
@@ -91,8 +90,6 @@ public class SourceComponentEditor extends AbstractChannelEditor
|
||||
|
||||
add( new JLabel( "Source:" ) );
|
||||
add( mComboSources, "wrap" );
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
public SourceEditor getSourceEditor()
|
||||
@@ -100,24 +97,6 @@ public class SourceComponentEditor extends AbstractChannelEditor
|
||||
return mEditor;
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
javax.swing.SwingUtilities.invokeLater(new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mComboSources.setSelectedItem(
|
||||
mChannel.getSourceConfiguration().getSourceType() );
|
||||
|
||||
mComboSources.requestFocus();
|
||||
|
||||
mComboSources.requestFocusInWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
@@ -127,17 +106,29 @@ public class SourceComponentEditor extends AbstractChannelEditor
|
||||
mChannel.setSourceConfiguration( mEditor.getConfig() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the channel configuration. Note: this method must be invoked from
|
||||
* the swing event dispatch thread.
|
||||
*/
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
mChannel = channel;
|
||||
|
||||
if( mChannel != null )
|
||||
{
|
||||
mComboSources.setSelectedItem(
|
||||
mChannel.getSourceConfiguration().getSourceType() );
|
||||
|
||||
mComboSources.requestFocus();
|
||||
|
||||
mComboSources.requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user