mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 01:27:34 -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 = new JideTabbedPane();
|
||||||
mTabbedPane.setFont( this.getFont() );
|
mTabbedPane.setFont( this.getFont() );
|
||||||
mTabbedPane.setForeground( Color.BLACK );
|
mTabbedPane.setForeground( Color.BLACK );
|
||||||
|
mTabbedPane.addTab( "Channels", mPlaylistEditor );
|
||||||
mTabbedPane.addTab( "Configuration", mSystemControlSplitPane );
|
mTabbedPane.addTab( "Configuration", mSystemControlSplitPane );
|
||||||
mTabbedPane.addTab( "Channel Spectrum", mChannelSpectrumPanel );
|
mTabbedPane.addTab( "Channel Spectrum", mChannelSpectrumPanel );
|
||||||
mTabbedPane.addTab( "Events", mCallEventPanel );
|
mTabbedPane.addTab( "Events", mCallEventPanel );
|
||||||
mTabbedPane.addTab( "Messages", mMessageActivityPanel );
|
mTabbedPane.addTab( "Messages", mMessageActivityPanel );
|
||||||
|
mTabbedPane.addTab( "Map", mMapPanel );
|
||||||
mTabbedPane.addTab( "Playlist", mPlaylistEditor );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change listener to enable/disable the channel spectrum display
|
* 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
|
/* Register each of the components to receive channel events when the
|
||||||
* channels are selected or change */
|
* channels are selected or change */
|
||||||
mChannelModel.addListener( mCallEventPanel );
|
mChannelModel.addListener( mCallEventPanel );
|
||||||
@@ -176,7 +171,6 @@ public class ControllerPanel extends JPanel
|
|||||||
channelStateListScroll.getViewport().setView( mChannelStateList );
|
channelStateListScroll.getViewport().setView( mChannelStateList );
|
||||||
channelStateListScroll.setPreferredSize( new Dimension( 200, 300 ) );
|
channelStateListScroll.setPreferredSize( new Dimension( 200, 300 ) );
|
||||||
|
|
||||||
|
|
||||||
JideSplitPane audioChannelListSplit = new JideSplitPane( JideSplitPane.VERTICAL_SPLIT );
|
JideSplitPane audioChannelListSplit = new JideSplitPane( JideSplitPane.VERTICAL_SPLIT );
|
||||||
audioChannelListSplit.setDividerSize( 5 );
|
audioChannelListSplit.setDividerSize( 5 );
|
||||||
audioChannelListSplit.add( mAudioPanel );
|
audioChannelListSplit.add( mAudioPanel );
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* 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
|
* 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
|
* 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.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.awt.EventQueue;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
@@ -63,11 +64,10 @@ public class ChannelEditor extends JPanel
|
|||||||
private RecordComponentEditor mRecordEditor;
|
private RecordComponentEditor mRecordEditor;
|
||||||
private SourceComponentEditor mSourceEditor;
|
private SourceComponentEditor mSourceEditor;
|
||||||
|
|
||||||
private JTextField mChannelName;
|
|
||||||
private JCheckBox mChannelEnabled = new JCheckBox();
|
|
||||||
private JComboBox<AliasList> mComboAliasLists;
|
|
||||||
|
|
||||||
private Channel mChannel;
|
private Channel mChannel;
|
||||||
|
|
||||||
|
private JCheckBox mChannelEnabled = new JCheckBox();
|
||||||
|
|
||||||
private ChannelModel mChannelModel;
|
private ChannelModel mChannelModel;
|
||||||
private PlaylistManager mPlaylistManager;
|
private PlaylistManager mPlaylistManager;
|
||||||
private SourceManager mSourceManager;
|
private SourceManager mSourceManager;
|
||||||
@@ -88,9 +88,18 @@ public class ChannelEditor extends JPanel
|
|||||||
initGUI();
|
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 );
|
mNameConfigurationEditor.setConfiguration( channel );
|
||||||
|
mSourceEditor.setConfiguration( channel );
|
||||||
|
mDecodeEditor.setConfiguration( channel );
|
||||||
|
mAuxDecodeEditor.setConfiguration( channel );
|
||||||
|
mEventLogEditor.setConfiguration( channel );
|
||||||
|
mRecordEditor.setConfiguration( channel );
|
||||||
|
|
||||||
mChannel = channel;
|
mChannel = channel;
|
||||||
}
|
}
|
||||||
@@ -103,27 +112,28 @@ public class ChannelEditor extends JPanel
|
|||||||
|
|
||||||
add( new JLabel( "Enabled:" ), "wrap" );
|
add( new JLabel( "Enabled:" ), "wrap" );
|
||||||
|
|
||||||
add( mNameConfigurationEditor );
|
add( mNameConfigurationEditor, "growx" );
|
||||||
|
|
||||||
JideTabbedPane tabs = new JideTabbedPane();
|
JideTabbedPane tabs = new JideTabbedPane();
|
||||||
tabs.setFont( this.getFont() );
|
tabs.setFont( this.getFont() );
|
||||||
tabs.setForeground( Color.BLACK );
|
tabs.setForeground( Color.BLACK );
|
||||||
|
|
||||||
tabs.addTab( "Name/Alias", mNameConfigurationEditor );
|
tabs.addTab( "Name/Alias", mNameConfigurationEditor );
|
||||||
// mSourceEditor = new SourceComponentEditor( mSourceManager, mChannel );
|
|
||||||
// tabs.addTab( "Source", mSourceEditor );
|
mSourceEditor = new SourceComponentEditor( mSourceManager );
|
||||||
//
|
tabs.addTab( "Source", mSourceEditor );
|
||||||
// mDecodeEditor = new DecodeComponentEditor( mPlaylistManager, mChannel );
|
|
||||||
// tabs.addTab( "Decoder", mDecodeEditor );
|
mDecodeEditor = new DecodeComponentEditor( mPlaylistManager );
|
||||||
//
|
tabs.addTab( "Decoder", mDecodeEditor );
|
||||||
// mAuxDecodeEditor = new AuxDecodeComponentEditor( mChannel );
|
|
||||||
// tabs.addTab( "Aux", mAuxDecodeEditor );
|
mAuxDecodeEditor = new AuxDecodeComponentEditor();
|
||||||
//
|
tabs.addTab( "Aux Decoders", mAuxDecodeEditor );
|
||||||
// mEventLogEditor = new EventLogComponentEditor( mChannel );
|
|
||||||
// tabs.addTab( "Event Log", mEventLogEditor );
|
mEventLogEditor = new EventLogComponentEditor();
|
||||||
//
|
tabs.addTab( "Logging", mEventLogEditor );
|
||||||
// mRecordEditor = new RecordComponentEditor( mChannel );
|
|
||||||
// tabs.addTab( "Record", mRecordEditor );
|
mRecordEditor = new RecordComponentEditor();
|
||||||
|
tabs.addTab( "Recording", mRecordEditor );
|
||||||
|
|
||||||
add( tabs, "span,grow,push" );
|
add( tabs, "span,grow,push" );
|
||||||
|
|
||||||
@@ -139,7 +149,28 @@ public class ChannelEditor extends JPanel
|
|||||||
@Override
|
@Override
|
||||||
public void channelChanged( ChannelEvent event )
|
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
|
@Override
|
||||||
@@ -163,6 +194,17 @@ public class ChannelEditor extends JPanel
|
|||||||
{
|
{
|
||||||
//Validate each of the configuration editors to check for errors
|
//Validate each of the configuration editors to check for errors
|
||||||
mNameConfigurationEditor.validateConfiguration();
|
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
|
// * Validate the source configuration against the other component
|
||||||
// * configuration editors
|
// * configuration editors
|
||||||
@@ -207,6 +249,10 @@ public class ChannelEditor extends JPanel
|
|||||||
|
|
||||||
//Save the contents of each editor to the channel configuration
|
//Save the contents of each editor to the channel configuration
|
||||||
mNameConfigurationEditor.save();
|
mNameConfigurationEditor.save();
|
||||||
|
mSourceEditor.save();
|
||||||
|
mDecodeEditor.save();
|
||||||
|
mAuxDecodeEditor.save();
|
||||||
|
mEventLogEditor.save();
|
||||||
|
|
||||||
//Broadcast a channel configuration change event
|
//Broadcast a channel configuration change event
|
||||||
mChannelModel.broadcast( new ChannelEvent( mChannel,
|
mChannelModel.broadcast( new ChannelEvent( mChannel,
|
||||||
|
|||||||
@@ -255,14 +255,32 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
|
|
||||||
channel.setEnabled( true );
|
channel.setEnabled( true );
|
||||||
|
|
||||||
|
mProcessingChains.put( channel.getChannelID(), processingChain );
|
||||||
|
|
||||||
mChannelModel.broadcast(
|
mChannelModel.broadcast(
|
||||||
new ChannelEvent( channel, Event.NOTIFICATION_PROCESSING_START ) );
|
new ChannelEvent( channel, Event.NOTIFICATION_PROCESSING_START ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopProcessing( Channel channel, boolean remove )
|
private void stopProcessing( Channel channel, boolean remove )
|
||||||
{
|
{
|
||||||
mChannelModel.broadcast(
|
if( mProcessingChains.containsKey( channel.getChannelID() ) )
|
||||||
new ChannelEvent( channel, Event.NOTIFICATION_PROCESSING_STOP ) );
|
{
|
||||||
|
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;
|
package controller.channel;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
@@ -13,9 +30,6 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import playlist.PlaylistManager;
|
import playlist.PlaylistManager;
|
||||||
import alias.AliasList;
|
import alias.AliasList;
|
||||||
@@ -24,14 +38,14 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
|||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
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 static ComboBoxModel<String> EMPTY_MODEL = new DefaultComboBoxModel<>();
|
||||||
|
|
||||||
private ChannelModel mChannelModel;
|
private ChannelModel mChannelModel;
|
||||||
private PlaylistManager mPlaylistManager;
|
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> mSystemNameCombo = new JComboBox<>( EMPTY_MODEL );
|
||||||
private JComboBox<String> mSiteNameCombo = new JComboBox<>( EMPTY_MODEL );
|
private JComboBox<String> mSiteNameCombo = new JComboBox<>( EMPTY_MODEL );
|
||||||
private JComboBox<AliasList> mAliasListCombo;
|
private JComboBox<AliasList> mAliasListCombo;
|
||||||
@@ -44,7 +58,7 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
|||||||
mChannelModel = model;
|
mChannelModel = model;
|
||||||
mPlaylistManager = playlistManager;
|
mPlaylistManager = playlistManager;
|
||||||
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right][]", "[][][][grow]" ) );
|
setLayout( new MigLayout( "fill,wrap 2", "[right][]", "[][][][][][grow]" ) );
|
||||||
|
|
||||||
add( new JLabel( "Name:" ) );
|
add( new JLabel( "Name:" ) );
|
||||||
add( mChannelName, "growx" );
|
add( mChannelName, "growx" );
|
||||||
@@ -156,7 +170,11 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
|||||||
mChannel.setSystem( ( system == null ? null : (String)system ) );
|
mChannel.setSystem( ( system == null ? null : (String)system ) );
|
||||||
|
|
||||||
Object site = mSiteNameCombo.getSelectedItem();
|
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;
|
mChannel = channel;
|
||||||
|
|
||||||
mChannelName.setText( channel.getName() );
|
if( mChannel != null )
|
||||||
|
|
||||||
List<String> systems = mChannelModel.getSystems();
|
|
||||||
|
|
||||||
if( systems.isEmpty() )
|
|
||||||
{
|
{
|
||||||
|
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 );
|
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 );
|
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.setFont( this.getFont() );
|
||||||
tabs.setForeground( Color.BLACK );
|
tabs.setForeground( Color.BLACK );
|
||||||
|
|
||||||
mSourceEditor = new SourceComponentEditor( mSourceManager, mChannel );
|
mSourceEditor = new SourceComponentEditor( mSourceManager );
|
||||||
tabs.addTab( "Source", mSourceEditor );
|
tabs.addTab( "Source", mSourceEditor );
|
||||||
|
|
||||||
mDecodeEditor = new DecodeComponentEditor( mPlaylistManager, mChannel );
|
mDecodeEditor = new DecodeComponentEditor( mPlaylistManager );
|
||||||
tabs.addTab( "Decoder", mDecodeEditor );
|
tabs.addTab( "Decoder", mDecodeEditor );
|
||||||
|
|
||||||
mAuxDecodeEditor = new AuxDecodeComponentEditor( mChannel );
|
mAuxDecodeEditor = new AuxDecodeComponentEditor();
|
||||||
tabs.addTab( "Aux", mAuxDecodeEditor );
|
tabs.addTab( "Aux", mAuxDecodeEditor );
|
||||||
|
|
||||||
mEventLogEditor = new EventLogComponentEditor( mChannel );
|
mEventLogEditor = new EventLogComponentEditor();
|
||||||
tabs.addTab( "Event Log", mEventLogEditor );
|
tabs.addTab( "Event Log", mEventLogEditor );
|
||||||
|
|
||||||
mRecordEditor = new RecordComponentEditor( mChannel );
|
mRecordEditor = new RecordComponentEditor();
|
||||||
tabs.addTab( "Record", mRecordEditor );
|
tabs.addTab( "Record", mRecordEditor );
|
||||||
|
|
||||||
add( tabs, "span,grow,push" );
|
add( tabs, "span,grow,push" );
|
||||||
|
|||||||
@@ -17,84 +17,70 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode;
|
package module.decode;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
|
|
||||||
import module.decode.config.AuxDecodeConfiguration;
|
import module.decode.config.AuxDecodeConfiguration;
|
||||||
import controller.channel.AbstractChannelEditor;
|
|
||||||
import controller.channel.Channel;
|
import controller.channel.Channel;
|
||||||
|
import controller.channel.ChannelConfigurationEditor;
|
||||||
import controller.channel.ConfigurationValidationException;
|
import controller.channel.ConfigurationValidationException;
|
||||||
|
|
||||||
public class AuxDecodeComponentEditor extends AbstractChannelEditor
|
public class AuxDecodeComponentEditor extends ChannelConfigurationEditor
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private HashMap<DecoderType,AuxDecoderCheckBox> mControls =
|
private List<AuxDecoderCheckBox> mControls = new ArrayList<>();
|
||||||
new HashMap<DecoderType,AuxDecoderCheckBox>();
|
|
||||||
|
|
||||||
public AuxDecodeComponentEditor( Channel channel )
|
private Channel mChannel;
|
||||||
|
|
||||||
|
public AuxDecodeComponentEditor()
|
||||||
{
|
{
|
||||||
super( channel );
|
|
||||||
|
|
||||||
List<DecoderType> decoders = DecoderType.getAuxDecoders();
|
List<DecoderType> decoders = DecoderType.getAuxDecoders();
|
||||||
|
|
||||||
Collections.sort( decoders );
|
Collections.sort( decoders );
|
||||||
|
|
||||||
for( DecoderType decoder: decoders )
|
for( DecoderType decoder: decoders )
|
||||||
{
|
{
|
||||||
AuxDecoderCheckBox control = new AuxDecoderCheckBox( decoder );
|
AuxDecoderCheckBox control = new AuxDecoderCheckBox( decoder );
|
||||||
|
|
||||||
if( getConfig().getAuxDecoders().contains( decoder ) )
|
|
||||||
{
|
|
||||||
control.setSelected( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
add( control, "wrap" );
|
add( control, "wrap" );
|
||||||
|
|
||||||
mControls.put( decoder, control );
|
mControls.add( control );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuxDecodeConfiguration getConfig()
|
public AuxDecodeConfiguration getConfig()
|
||||||
{
|
{
|
||||||
return getChannel().getAuxDecodeConfiguration();
|
if( mChannel != null )
|
||||||
|
{
|
||||||
|
return mChannel.getAuxDecodeConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new AuxDecodeConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
getConfig().clearAuxDecoders();
|
if( mChannel != null )
|
||||||
|
|
||||||
for( DecoderType decoder: mControls.keySet() )
|
|
||||||
{
|
{
|
||||||
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
|
public class AuxDecoderCheckBox extends JCheckBox
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -107,19 +93,35 @@ public class AuxDecodeComponentEditor extends AbstractChannelEditor
|
|||||||
|
|
||||||
mDecoderType = decoder;
|
mDecoderType = decoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DecoderType getDecoderType()
|
||||||
|
{
|
||||||
|
return mDecoderType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setConfiguration( Channel channel )
|
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
|
@Override
|
||||||
public void validateConfiguration() throws ConfigurationValidationException
|
public void validateConfiguration() throws ConfigurationValidationException
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
* SDR Trunk
|
* SDR Trunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2016 Dennis Sheirer
|
||||||
*
|
*
|
||||||
@@ -24,43 +23,38 @@ import java.awt.event.ActionListener;
|
|||||||
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
|
|
||||||
import module.decode.config.DecodeConfigFactory;
|
import module.decode.config.DecodeConfigFactory;
|
||||||
import module.decode.config.DecodeConfiguration;
|
import module.decode.config.DecodeConfiguration;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import playlist.PlaylistManager;
|
import playlist.PlaylistManager;
|
||||||
import controller.channel.AbstractChannelEditor;
|
|
||||||
import controller.channel.Channel;
|
import controller.channel.Channel;
|
||||||
import controller.channel.ChannelConfigurationEditor;
|
import controller.channel.ChannelConfigurationEditor;
|
||||||
import controller.channel.ConfigurationValidationException;
|
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 JComboBox<DecoderType> mComboDecoders;
|
||||||
|
|
||||||
private DecodeEditor mEditor;
|
private DecodeEditor mEditor;
|
||||||
|
|
||||||
private PlaylistManager mPlaylistManager;
|
private Channel mChannel;
|
||||||
|
|
||||||
public DecodeComponentEditor( PlaylistManager playlistManager )
|
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]" ) );
|
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) );
|
||||||
|
|
||||||
/**
|
|
||||||
* ComboBox: Decoders
|
|
||||||
*/
|
|
||||||
mComboDecoders = new JComboBox<DecoderType>();
|
mComboDecoders = new JComboBox<DecoderType>();
|
||||||
|
|
||||||
DefaultComboBoxModel<DecoderType> model =
|
DefaultComboBoxModel<DecoderType> model =
|
||||||
@@ -84,14 +78,15 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
|||||||
if( selected != null )
|
if( selected != null )
|
||||||
{
|
{
|
||||||
DecodeConfiguration config;
|
DecodeConfiguration config;
|
||||||
|
|
||||||
if( mChannel.getDecodeConfiguration().getDecoderType() == selected )
|
if( mChannel == null ||
|
||||||
|
mChannel.getDecodeConfiguration().getDecoderType() != selected )
|
||||||
{
|
{
|
||||||
config = mChannel.getDecodeConfiguration();
|
config = DecodeConfigFactory.getDecodeConfiguration( selected );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
config = DecodeConfigFactory.getDecodeConfiguration( selected );
|
config = mChannel.getDecodeConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Remove the existing one
|
//Remove the existing one
|
||||||
@@ -111,29 +106,11 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
add( new JLabel( "Decoder:" ) );
|
add( new JLabel( "Decoder:" ) );
|
||||||
add( mComboDecoders, "wrap" );
|
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()
|
public DecodeConfiguration getDecodeConfig()
|
||||||
{
|
{
|
||||||
return mEditor.getConfig();
|
return mEditor.getConfig();
|
||||||
@@ -147,7 +124,6 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
|||||||
mEditor.save();
|
mEditor.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
//The component that calls save will invoke the change broadcast
|
|
||||||
mChannel.setDecodeConfiguration( mEditor.getConfig() );
|
mChannel.setDecodeConfiguration( mEditor.getConfig() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,14 +141,23 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
|||||||
@Override
|
@Override
|
||||||
public void setConfiguration( Channel channel )
|
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
|
@Override
|
||||||
public void validateConfiguration() throws ConfigurationValidationException
|
public void validateConfiguration() throws ConfigurationValidationException
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,18 +106,25 @@ public class ChannelStatePanel extends JPanel
|
|||||||
ProcessingChain processingChain =
|
ProcessingChain processingChain =
|
||||||
channelProcessingManager.getProcessingChain( mChannel );
|
channelProcessingManager.getProcessingChain( mChannel );
|
||||||
|
|
||||||
mChannelState = processingChain.getChannelState();
|
if( processingChain != null )
|
||||||
|
{
|
||||||
mChannelState.setChangedAttributeListener( this );
|
mChannelState = processingChain.getChannelState();
|
||||||
|
|
||||||
init();
|
mChannelState.setChangedAttributeListener( this );
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
for( DecoderState decoderState: processingChain.getDecoderStates() )
|
for( DecoderState decoderState: processingChain.getDecoderStates() )
|
||||||
{
|
{
|
||||||
DecoderPanel panel = DecoderFactory.getDecoderPanel( mSettingsManager, decoderState );
|
DecoderPanel panel = DecoderFactory.getDecoderPanel( mSettingsManager, decoderState );
|
||||||
mDecoderPanels.add( panel );
|
mDecoderPanels.add( panel );
|
||||||
add( panel, "grow,span" );
|
add( panel, "grow,span" );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mLog.error( "Processing Chain was null!" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
|
|||||||
@@ -20,92 +20,79 @@ package module.log;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
|
|
||||||
import module.log.config.EventLogConfiguration;
|
import module.log.config.EventLogConfiguration;
|
||||||
import controller.channel.AbstractChannelEditor;
|
|
||||||
import controller.channel.Channel;
|
import controller.channel.Channel;
|
||||||
|
import controller.channel.ChannelConfigurationEditor;
|
||||||
import controller.channel.ConfigurationValidationException;
|
import controller.channel.ConfigurationValidationException;
|
||||||
|
|
||||||
public class EventLogComponentEditor extends AbstractChannelEditor
|
public class EventLogComponentEditor extends ChannelConfigurationEditor
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JCheckBox mBinaryLogger = new JCheckBox( "Binary Messages" );
|
private JCheckBox mBinaryLogger = new JCheckBox( "Binary Messages" );
|
||||||
private JCheckBox mDecodedLogger = new JCheckBox( "Decoded Messages" );
|
private JCheckBox mDecodedLogger = new JCheckBox( "Decoded Messages" );
|
||||||
private JCheckBox mCallEventLogger = new JCheckBox( "Call Events" );
|
private JCheckBox mCallEventLogger = new JCheckBox( "Call Events" );
|
||||||
|
|
||||||
|
private Channel mChannel;
|
||||||
|
|
||||||
public EventLogComponentEditor( Channel channel )
|
public EventLogComponentEditor()
|
||||||
{
|
{
|
||||||
super( channel );
|
|
||||||
|
|
||||||
add( mBinaryLogger, "span" );
|
add( mBinaryLogger, "span" );
|
||||||
add( mDecodedLogger, "span" );
|
add( mDecodedLogger, "span" );
|
||||||
add( mCallEventLogger, "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
|
* Saves the current configuration as the stored configuration
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
EventLogConfiguration config = mChannel.getEventLogConfiguration();
|
if( mChannel != null )
|
||||||
|
{
|
||||||
|
EventLogConfiguration config = mChannel.getEventLogConfiguration();
|
||||||
|
|
||||||
config.clear();
|
config.clear();
|
||||||
|
|
||||||
if( mBinaryLogger.isSelected() )
|
if( mBinaryLogger.isSelected() )
|
||||||
{
|
{
|
||||||
config.addLogger( EventLogType.BINARY_MESSAGE );
|
config.addLogger( EventLogType.BINARY_MESSAGE );
|
||||||
}
|
}
|
||||||
|
if( mDecodedLogger.isSelected() )
|
||||||
if( mDecodedLogger.isSelected() )
|
{
|
||||||
{
|
config.addLogger( EventLogType.DECODED_MESSAGE );
|
||||||
config.addLogger( EventLogType.DECODED_MESSAGE );
|
}
|
||||||
}
|
if( mCallEventLogger.isSelected() )
|
||||||
if( mCallEventLogger.isSelected() )
|
{
|
||||||
{
|
config.addLogger( EventLogType.CALL_EVENT );
|
||||||
config.addLogger( EventLogType.CALL_EVENT );
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setConfiguration( Channel channel )
|
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
|
@Override
|
||||||
public void validateConfiguration() throws ConfigurationValidationException
|
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.getSelectionModel().addListSelectionListener( this );
|
||||||
mChannelTable.setAutoCreateRowSorter( true );
|
mChannelTable.setAutoCreateRowSorter( true );
|
||||||
|
|
||||||
TableFilterHeader channelHeaderFilter = new TableFilterHeader( mChannelTable );
|
TableFilterHeader channelHeaderFilter =
|
||||||
channelHeaderFilter.setAutoChoices( AutoChoices.ENABLED );
|
new TableFilterHeader( mChannelTable, AutoChoices.ENABLED );
|
||||||
|
channelHeaderFilter.setFilterOnUpdates( true );
|
||||||
|
|
||||||
JScrollPane channelScroller = new JScrollPane( mChannelTable );
|
JScrollPane channelScroller = new JScrollPane( mChannelTable );
|
||||||
|
|
||||||
JideSplitPane splitPane = new JideSplitPane( JideSplitPane.HORIZONTAL_SPLIT );
|
JideSplitPane splitPane = new JideSplitPane( JideSplitPane.HORIZONTAL_SPLIT );
|
||||||
splitPane.setDividerSize( 5 );
|
splitPane.setDividerSize( 5 );
|
||||||
|
splitPane.setShowGripper( true );
|
||||||
splitPane.add( channelScroller );
|
splitPane.add( channelScroller );
|
||||||
splitPane.add( mEditor );
|
splitPane.add( mEditor );
|
||||||
|
|
||||||
@@ -73,15 +75,22 @@ public class PlaylistEditor extends JPanel implements ListSelectionListener
|
|||||||
//This limits event firing to only when selection is complete
|
//This limits event firing to only when selection is complete
|
||||||
if( !event.getValueIsAdjusting() )
|
if( !event.getValueIsAdjusting() )
|
||||||
{
|
{
|
||||||
int index = mChannelTable.convertRowIndexToModel( mChannelTable.getSelectedRow() );
|
int selectedRow = mChannelTable.getSelectedRow();
|
||||||
|
|
||||||
mLog.debug( "Index:" + index );
|
|
||||||
|
|
||||||
Channel channel = mChannelModel.getChannels().get( index );
|
if( selectedRow != -1 )
|
||||||
|
|
||||||
if( channel != null )
|
|
||||||
{
|
{
|
||||||
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;
|
package record;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
|
|
||||||
import record.config.RecordConfiguration;
|
import record.config.RecordConfiguration;
|
||||||
import controller.channel.AbstractChannelEditor;
|
|
||||||
import controller.channel.Channel;
|
import controller.channel.Channel;
|
||||||
|
import controller.channel.ChannelConfigurationEditor;
|
||||||
import controller.channel.ConfigurationValidationException;
|
import controller.channel.ConfigurationValidationException;
|
||||||
|
|
||||||
public class RecordComponentEditor extends AbstractChannelEditor
|
public class RecordComponentEditor extends ChannelConfigurationEditor
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
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 mBasebandRecorder = new JCheckBox( "Baseband I/Q" );
|
||||||
private JCheckBox mTrafficBasebandRecorder = new JCheckBox( "Traffic Channel 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( mAudioRecorder, "span" );
|
||||||
add( mBasebandRecorder, "span" );
|
add( mBasebandRecorder, "span" );
|
||||||
add( mTrafficBasebandRecorder, "span" );
|
add( mTrafficBasebandRecorder, "span" );
|
||||||
|
|
||||||
reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
RecordConfiguration config = getChannel().getRecordConfiguration();
|
if( mChannel != null )
|
||||||
|
|
||||||
config.clearRecorders();
|
|
||||||
|
|
||||||
if( mAudioRecorder.isSelected() )
|
|
||||||
{
|
{
|
||||||
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
|
@Override
|
||||||
public void setConfiguration( Channel channel )
|
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
|
@Override
|
||||||
public void validateConfiguration() throws ConfigurationValidationException
|
public void validateConfiguration() throws ConfigurationValidationException
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
package record.config;
|
package record.config;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
@@ -28,19 +29,19 @@ import controller.config.Configuration;
|
|||||||
@XmlRootElement( name = "record_configuration" )
|
@XmlRootElement( name = "record_configuration" )
|
||||||
public class RecordConfiguration extends Configuration
|
public class RecordConfiguration extends Configuration
|
||||||
{
|
{
|
||||||
private ArrayList<RecorderType> mRecorders = new ArrayList<RecorderType>();
|
private List<RecorderType> mRecorders = new ArrayList<>();
|
||||||
|
|
||||||
public RecordConfiguration()
|
public RecordConfiguration()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement( name = "recorder" )
|
@XmlElement( name = "recorder" )
|
||||||
public ArrayList<RecorderType> getRecorders()
|
public List<RecorderType> getRecorders()
|
||||||
{
|
{
|
||||||
return mRecorders;
|
return mRecorders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRecorders( ArrayList<RecorderType> recorders )
|
public void setRecorders( List<RecorderType> recorders )
|
||||||
{
|
{
|
||||||
mRecorders = recorders;
|
mRecorders = recorders;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,22 +28,21 @@ import javax.swing.JLabel;
|
|||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import source.config.SourceConfigFactory;
|
import source.config.SourceConfigFactory;
|
||||||
import source.config.SourceConfiguration;
|
import source.config.SourceConfiguration;
|
||||||
import controller.channel.AbstractChannelEditor;
|
|
||||||
import controller.channel.Channel;
|
import controller.channel.Channel;
|
||||||
|
import controller.channel.ChannelConfigurationEditor;
|
||||||
import controller.channel.ConfigurationValidationException;
|
import controller.channel.ConfigurationValidationException;
|
||||||
|
|
||||||
public class SourceComponentEditor extends AbstractChannelEditor
|
public class SourceComponentEditor extends ChannelConfigurationEditor
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JComboBox<SourceType> mComboSources;
|
private JComboBox<SourceType> mComboSources;
|
||||||
private SourceEditor mEditor;
|
private SourceEditor mEditor;
|
||||||
private SourceManager mSourceManager;
|
private SourceManager mSourceManager;
|
||||||
|
private Channel mChannel = null;
|
||||||
|
|
||||||
public SourceComponentEditor( SourceManager sourceManager, Channel channel )
|
public SourceComponentEditor( SourceManager sourceManager )
|
||||||
{
|
{
|
||||||
super( channel );
|
|
||||||
|
|
||||||
mSourceManager = sourceManager;
|
mSourceManager = sourceManager;
|
||||||
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) );
|
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) );
|
||||||
@@ -60,15 +59,15 @@ public class SourceComponentEditor extends AbstractChannelEditor
|
|||||||
if( selected != null )
|
if( selected != null )
|
||||||
{
|
{
|
||||||
SourceConfiguration config;
|
SourceConfiguration config;
|
||||||
|
|
||||||
if( selected == mChannel.getSourceConfiguration().getSourceType() )
|
if( mChannel == null ||
|
||||||
|
mChannel.getSourceConfiguration().getSourceType() != selected )
|
||||||
{
|
{
|
||||||
config = mChannel.getSourceConfiguration();
|
config = SourceConfigFactory.getSourceConfiguration( selected );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
config = SourceConfigFactory
|
config = mChannel.getSourceConfiguration();
|
||||||
.getSourceConfiguration( selected );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Remove the existing one
|
//Remove the existing one
|
||||||
@@ -91,8 +90,6 @@ public class SourceComponentEditor extends AbstractChannelEditor
|
|||||||
|
|
||||||
add( new JLabel( "Source:" ) );
|
add( new JLabel( "Source:" ) );
|
||||||
add( mComboSources, "wrap" );
|
add( mComboSources, "wrap" );
|
||||||
|
|
||||||
reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SourceEditor getSourceEditor()
|
public SourceEditor getSourceEditor()
|
||||||
@@ -100,24 +97,6 @@ public class SourceComponentEditor extends AbstractChannelEditor
|
|||||||
return mEditor;
|
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
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
@@ -127,17 +106,29 @@ public class SourceComponentEditor extends AbstractChannelEditor
|
|||||||
mChannel.setSourceConfiguration( mEditor.getConfig() );
|
mChannel.setSourceConfiguration( mEditor.getConfig() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the channel configuration. Note: this method must be invoked from
|
||||||
|
* the swing event dispatch thread.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setConfiguration( Channel channel )
|
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
|
@Override
|
||||||
public void validateConfiguration() throws ConfigurationValidationException
|
public void validateConfiguration() throws ConfigurationValidationException
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user