From ba41022853d623613cfb33ba86cdacf930edb2b1 Mon Sep 17 00:00:00 2001 From: denny Date: Sat, 19 Sep 2015 12:26:04 -0400 Subject: [PATCH] Instrumentation updates ... work in progress --- src/controller/channel/ChannelEditor.java | 9 +++- src/controller/channel/ChannelNode.java | 4 +- src/instrument/gui/DecoderSelectionFrame.java | 13 ++++-- src/instrument/gui/DecoderViewFrame.java | 38 +++++++++------ src/instrument/tap/TapGroup.java | 1 + src/module/decode/DecodeComponentEditor.java | 15 ++++-- src/module/decode/DecoderFactory.java | 46 +++++++++++-------- .../decode/mpt1327/MPT1327ConfigEditor.java | 13 ++++-- 8 files changed, 92 insertions(+), 47 deletions(-) diff --git a/src/controller/channel/ChannelEditor.java b/src/controller/channel/ChannelEditor.java index b50c47f1..21306577 100644 --- a/src/controller/channel/ChannelEditor.java +++ b/src/controller/channel/ChannelEditor.java @@ -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 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 ); diff --git a/src/controller/channel/ChannelNode.java b/src/controller/channel/ChannelNode.java index 4f19f59a..ea006c58 100644 --- a/src/controller/channel/ChannelNode.java +++ b/src/controller/channel/ChannelNode.java @@ -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() diff --git a/src/instrument/gui/DecoderSelectionFrame.java b/src/instrument/gui/DecoderSelectionFrame.java index 56298e59..ef1b3cff 100644 --- a/src/instrument/gui/DecoderSelectionFrame.java +++ b/src/instrument/gui/DecoderSelectionFrame.java @@ -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 diff --git a/src/instrument/gui/DecoderViewFrame.java b/src/instrument/gui/DecoderViewFrame.java index f9e9762c..3a11edc0 100644 --- a/src/instrument/gui/DecoderViewFrame.java +++ b/src/instrument/gui/DecoderViewFrame.java @@ -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 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 ) ); + } + } + } } diff --git a/src/instrument/tap/TapGroup.java b/src/instrument/tap/TapGroup.java index 593fe6f6..988c3181 100644 --- a/src/instrument/tap/TapGroup.java +++ b/src/instrument/tap/TapGroup.java @@ -10,6 +10,7 @@ public class TapGroup public TapGroup( String name ) { + mName = name; } public String getName() diff --git a/src/module/decode/DecodeComponentEditor.java b/src/module/decode/DecodeComponentEditor.java index 065e3f6f..46092365 100644 --- a/src/module/decode/DecodeComponentEditor.java +++ b/src/module/decode/DecodeComponentEditor.java @@ -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" ); diff --git a/src/module/decode/DecoderFactory.java b/src/module/decode/DecoderFactory.java index aedfebce..cfe0bbfa 100644 --- a/src/module/decode/DecoderFactory.java +++ b/src/module/decode/DecoderFactory.java @@ -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 decoders = new ArrayList(); - 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 ); diff --git a/src/module/decode/mpt1327/MPT1327ConfigEditor.java b/src/module/decode/mpt1327/MPT1327ConfigEditor.java index 17c11938..efe20467 100644 --- a/src/module/decode/mpt1327/MPT1327ConfigEditor.java +++ b/src/module/decode/mpt1327/MPT1327ConfigEditor.java @@ -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 maps = mChannelNode.getModel().getResourceManager() - .getPlaylistManager().getPlayist().getChannelMapList().getChannelMap(); + List maps = ( mPlaylistManager == null ? + new ArrayList() : mPlaylistManager.getPlayist() + .getChannelMapList().getChannelMap() ); ChannelMap[] mapArray = maps.toArray( new ChannelMap[ maps.size() ] );