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

View File

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

View File

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

View File

@@ -117,6 +117,8 @@ public class DecoderViewFrame extends JInternalFrame
mProcessingChain.setSource( (Source)mSource ); mProcessingChain.setSource( (Source)mSource );
mProcessingChain.start();
initGui(); initGui();
} }
@@ -184,19 +186,7 @@ public class DecoderViewFrame extends JInternalFrame
for( TapGroup group: groups ) for( TapGroup group: groups )
{ {
List<Tap> taps = group.getTaps(); menu.add( new TapGroupMenu( group ) );
if( !taps.isEmpty() )
{
JMenu groupMenu = new JMenu( group.getName() );
for( Tap tap: taps )
{
groupMenu.add( new TapSelectionItem( tap ) );
}
menu.add( groupMenu );
}
} }
} }
} }
@@ -346,4 +336,26 @@ public class DecoderViewFrame extends JInternalFrame
{ {
mLog.info( message.toString() ); 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 ) public TapGroup( String name )
{ {
mName = name;
} }
public String getName() public String getName()

View File

@@ -29,6 +29,7 @@ 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 playlist.PlaylistManager;
import controller.Editor; import controller.Editor;
import controller.channel.AbstractChannelEditor; import controller.channel.AbstractChannelEditor;
import controller.channel.Channel; import controller.channel.Channel;
@@ -43,15 +44,20 @@ public class DecodeComponentEditor extends AbstractChannelEditor
private DecodeEditor mEditor; 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 ); super( channelNode );
mPlaylistManager = playlistMangager;
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) ); setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) );
/** /**
@@ -101,7 +107,8 @@ public class DecodeComponentEditor extends AbstractChannelEditor
} }
//Change to the new one //Change to the new one
mEditor = DecoderFactory.getEditorPanel( config, mChannelNode ); mEditor = DecoderFactory.getEditorPanel( config,
mChannelNode, mPlaylistManager );
add( mEditor, "span 2,center" ); add( mEditor, "span 2,center" );

View File

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

View File

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