Instrumentation updates ... work in progress

This commit is contained in:
denny
2015-09-19 12:26:04 -04:00
parent 8c2207e37c
commit ba41022853
8 changed files with 92 additions and 47 deletions

View File

@@ -43,6 +43,7 @@ import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import playlist.PlaylistManager;
import record.RecordComponentEditor;
import source.SourceComponentEditor;
import alias.AliasList;
@@ -69,12 +70,16 @@ public class ChannelEditor extends Editor implements ActionListener
private JCheckBox mChannelEnabled = new JCheckBox();
private JComboBox<AliasList> mComboAliasLists;
public ChannelEditor( ChannelNode channel )
private PlaylistManager mPlaylistManager;
public ChannelEditor( ChannelNode channel, PlaylistManager playlistManager )
{
super();
mChannelNode = channel;
mPlaylistManager = playlistManager;
initGUI();
}
@@ -132,7 +137,7 @@ public class ChannelEditor extends Editor implements ActionListener
mSourceEditor = new SourceComponentEditor( mChannelNode );
tabs.addTab( "Source", mSourceEditor );
mDecodeEditor = new DecodeComponentEditor( mChannelNode );
mDecodeEditor = new DecodeComponentEditor( mChannelNode, mPlaylistManager );
tabs.addTab( "Decoder", mDecodeEditor );
mAuxDecodeEditor = new AuxDecodeComponentEditor( mChannelNode );

View File

@@ -124,7 +124,9 @@ public class ChannelNode extends ConfigurableNode implements ChannelEventListene
@Override
public JPanel getEditor()
{
return new ChannelEditor( this );
return new ChannelEditor( this,
getChannel().getResourceManager() == null ? null :
getChannel().getResourceManager().getPlaylistManager() );
}
public Channel getChannel()

View File

@@ -19,7 +19,7 @@ public class DecoderSelectionFrame extends JInternalFrame
{
private static final long serialVersionUID = 1L;
private DecodeComponentEditor mDecodeEditor = new DecodeComponentEditor();
private DecodeComponentEditor mDecodeEditor = new DecodeComponentEditor( null );
private ResourceManager mResourceManager = new ResourceManager();
private IControllableFileSource mSource;
@@ -36,16 +36,21 @@ public class DecoderSelectionFrame extends JInternalFrame
private void initGUI()
{
setLayout( new MigLayout( "", "[grow,fill]", "[][][grow,fill]" ) );
setTitle( "Decoders" );
setPreferredSize( new Dimension( 700, 150 ) );
setSize( 700, 150 );
setPreferredSize( new Dimension( 700, 450 ) );
setSize( 700, 450 );
setResizable( true );
setClosable( true );
setIconifiable( true );
setMaximizable( false );
add( mDecodeEditor );
add( mDecodeEditor, "wrap" );
add( new AddDecoderButton(), "span" );
}
public class AddDecoderButton extends JButton

View File

@@ -117,6 +117,8 @@ public class DecoderViewFrame extends JInternalFrame
mProcessingChain.setSource( (Source)mSource );
mProcessingChain.start();
initGui();
}
@@ -184,19 +186,7 @@ public class DecoderViewFrame extends JInternalFrame
for( TapGroup group: groups )
{
List<Tap> taps = group.getTaps();
if( !taps.isEmpty() )
{
JMenu groupMenu = new JMenu( group.getName() );
for( Tap tap: taps )
{
groupMenu.add( new TapSelectionItem( tap ) );
}
menu.add( groupMenu );
}
menu.add( new TapGroupMenu( group ) );
}
}
}
@@ -346,4 +336,26 @@ public class DecoderViewFrame extends JInternalFrame
{
mLog.info( message.toString() );
}
public class TapGroupMenu extends JMenu
{
private static final long serialVersionUID = 1L;
private TapGroup mTapGroup;
public TapGroupMenu( TapGroup tapGroup )
{
super( tapGroup.getName() );
mTapGroup = tapGroup;
add( new AddAllTapsItem( mTapGroup.getTaps() ) );
add( new JSeparator() );
for( Tap tap: mTapGroup.getTaps() )
{
add( new TapSelectionItem( tap ) );
}
}
}
}

View File

@@ -10,6 +10,7 @@ public class TapGroup
public TapGroup( String name )
{
mName = name;
}
public String getName()

View File

@@ -29,6 +29,7 @@ import javax.swing.SwingUtilities;
import module.decode.config.DecodeConfigFactory;
import module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout;
import playlist.PlaylistManager;
import controller.Editor;
import controller.channel.AbstractChannelEditor;
import controller.channel.Channel;
@@ -43,14 +44,19 @@ public class DecodeComponentEditor extends AbstractChannelEditor
private DecodeEditor mEditor;
public DecodeComponentEditor()
private PlaylistManager mPlaylistManager;
public DecodeComponentEditor( PlaylistManager playlistManager )
{
this( new ChannelNode( new Channel() ) );
this( new ChannelNode( new Channel() ), playlistManager );
}
public DecodeComponentEditor( ChannelNode channelNode )
public DecodeComponentEditor( ChannelNode channelNode,
PlaylistManager playlistMangager )
{
super( channelNode );
mPlaylistManager = playlistMangager;
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) );
@@ -101,7 +107,8 @@ public class DecodeComponentEditor extends AbstractChannelEditor
}
//Change to the new one
mEditor = DecoderFactory.getEditorPanel( config, mChannelNode );
mEditor = DecoderFactory.getEditorPanel( config,
mChannelNode, mPlaylistManager );
add( mEditor, "span 2,center" );

View File

@@ -78,6 +78,7 @@ import module.demodulate.fm.FMDemodulatorModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import playlist.PlaylistManager;
import properties.SystemProperties;
import record.RecorderType;
import record.config.RecordConfiguration;
@@ -173,7 +174,8 @@ public class DecoderFactory
int pass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
int stop = pass + 1250;
boolean recordAudio = recordConfig.getRecorders().contains( RecorderType.AUDIO );
boolean recordAudio = recordConfig == null ? false :
recordConfig.getRecorders().contains( RecorderType.AUDIO );
switch( decodeConfig.getDecoderType() )
{
@@ -273,25 +275,28 @@ public class DecoderFactory
{
List<Decoder> decoders = new ArrayList<Decoder>();
for( DecoderType auxDecoder: config.getAuxDecoders() )
if( config != null )
{
switch( auxDecoder )
for( DecoderType auxDecoder: config.getAuxDecoders() )
{
case FLEETSYNC2:
decoders.add( new Fleetsync2Decoder( aliasList ) );
break;
case MDC1200:
decoders.add( new MDCDecoder( aliasList ) );
break;
case LJ_1200:
decoders.add( new LJ1200Decoder( aliasList ) );
break;
case TAIT_1200:
decoders.add( new Tait1200Decoder( aliasList ) );
break;
default:
throw new IllegalArgumentException( "Unrecognized auxiliary "
+ "decoder type [" + auxDecoder + "]" );
switch( auxDecoder )
{
case FLEETSYNC2:
decoders.add( new Fleetsync2Decoder( aliasList ) );
break;
case MDC1200:
decoders.add( new MDCDecoder( aliasList ) );
break;
case LJ_1200:
decoders.add( new LJ1200Decoder( aliasList ) );
break;
case TAIT_1200:
decoders.add( new Tait1200Decoder( aliasList ) );
break;
default:
throw new IllegalArgumentException( "Unrecognized auxiliary "
+ "decoder type [" + auxDecoder + "]" );
}
}
}
@@ -400,7 +405,7 @@ public class DecoderFactory
}
public static DecodeEditor getEditorPanel( DecodeConfiguration config,
ChannelNode channelNode )
ChannelNode channelNode, PlaylistManager playlistManager )
{
DecodeEditor configuredPanel;
@@ -416,7 +421,8 @@ public class DecoderFactory
configuredPanel = new LTRNetEditor( config );
break;
case MPT1327:
configuredPanel = new MPT1327ConfigEditor( config, channelNode );
configuredPanel = new MPT1327ConfigEditor( config,
channelNode, playlistManager );
break;
case PASSPORT:
configuredPanel = new PassportEditor( config );

View File

@@ -18,6 +18,7 @@
package module.decode.mpt1327;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
@@ -29,6 +30,7 @@ import javax.swing.event.ChangeListener;
import module.decode.DecodeEditor;
import module.decode.config.DecodeConfiguration;
import module.decode.mpt1327.MPT1327Decoder.Sync;
import playlist.PlaylistManager;
import controller.channel.ChannelNode;
import controller.channel.map.ChannelMap;
@@ -43,12 +45,16 @@ public class MPT1327ConfigEditor extends DecodeEditor
private JLabel mTrafficChannelPoolSizeLabel;
private JSlider mTrafficChannelPoolSize;
private ChannelNode mChannelNode;
private PlaylistManager mPlaylistManager;
public MPT1327ConfigEditor( DecodeConfiguration config, ChannelNode channelNode )
public MPT1327ConfigEditor( DecodeConfiguration config,
ChannelNode channelNode,
PlaylistManager playlistManager )
{
super( config );
mChannelNode = channelNode;
mPlaylistManager = playlistManager;
initGUI();
}
@@ -63,8 +69,9 @@ public class MPT1327ConfigEditor extends DecodeEditor
/**
* ComboBox: Alias Lists
*/
ArrayList<ChannelMap> maps = mChannelNode.getModel().getResourceManager()
.getPlaylistManager().getPlayist().getChannelMapList().getChannelMap();
List<ChannelMap> maps = ( mPlaylistManager == null ?
new ArrayList<ChannelMap>() : mPlaylistManager.getPlayist()
.getChannelMapList().getChannelMap() );
ChannelMap[] mapArray = maps.toArray( new ChannelMap[ maps.size() ] );