Work in progress.

This commit is contained in:
denny
2016-01-13 08:59:34 -05:00
parent 7d1ec344de
commit ec10bb7e62
3 changed files with 29 additions and 15 deletions

View File

@@ -30,6 +30,7 @@ import javax.swing.JComboBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField; import javax.swing.JTextField;
import module.decode.AuxDecodeComponentEditor; import module.decode.AuxDecodeComponentEditor;
@@ -66,7 +67,8 @@ public class ChannelEditor extends JPanel
private Channel mChannel; private Channel mChannel;
private JCheckBox mChannelEnabled = new JCheckBox(); private JButton mEnableButton = new JButton( "Enable" );
private JLabel mChannelName = new JLabel( "Channel:" );
private ChannelModel mChannelModel; private ChannelModel mChannelModel;
private PlaylistManager mPlaylistManager; private PlaylistManager mPlaylistManager;
@@ -101,6 +103,22 @@ public class ChannelEditor extends JPanel
mEventLogEditor.setConfiguration( channel ); mEventLogEditor.setConfiguration( channel );
mRecordEditor.setConfiguration( channel ); mRecordEditor.setConfiguration( channel );
if( channel != null )
{
mChannelName.setText( "Channel: " + channel.getName() );
mEnableButton.setText( channel.getEnabled() ? "Disable" : "Enable" );
mEnableButton.setEnabled( true );
mEnableButton.setBackground( channel.getEnabled() ? Color.RED : Color.GREEN );
}
else
{
mChannelName.setText( "Channel: " );
mEnableButton.setText( "Enable" );
mEnableButton.setEnabled( false );
mEnableButton.setBackground( getBackground() );
}
mChannel = channel; mChannel = channel;
} }
@@ -108,12 +126,11 @@ public class ChannelEditor extends JPanel
{ {
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][][][grow][]" ) ); setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][][][grow][]" ) );
add( new JLabel( "Channel Configuration" ), "span, align center" ); mEnableButton.setEnabled( false );
add( mEnableButton, "growx,push" );
add( new JLabel( "Enabled:" ), "wrap" ); add( mChannelName, "growx,push" );
add( mNameConfigurationEditor, "growx" );
add( new JSeparator( JSeparator.HORIZONTAL ), "span,growx,push" );
JideTabbedPane tabs = new JideTabbedPane(); JideTabbedPane tabs = new JideTabbedPane();
tabs.setFont( this.getFont() ); tabs.setFont( this.getFont() );
tabs.setForeground( Color.BLACK ); tabs.setForeground( Color.BLACK );
@@ -149,11 +166,7 @@ public class ChannelEditor extends JPanel
@Override @Override
public void channelChanged( ChannelEvent event ) public void channelChanged( ChannelEvent event )
{ {
if( !EventQueue.isDispatchThread() ) mLog.debug( "Received channel event: " + event.getEvent() );
{
mLog.debug( "Not on the swing thread!!!!" );
}
if( mChannel != null && mChannel == event.getChannel() ) if( mChannel != null && mChannel == event.getChannel() )
{ {
switch( event.getEvent() ) switch( event.getEvent() )

View File

@@ -263,14 +263,16 @@ public class ChannelProcessingManager implements ChannelEventListener
private void stopProcessing( Channel channel, boolean remove ) private void stopProcessing( Channel channel, boolean remove )
{ {
channel.setEnabled( false );
if( mProcessingChains.containsKey( channel.getChannelID() ) ) if( mProcessingChains.containsKey( channel.getChannelID() ) )
{ {
ProcessingChain chain = mProcessingChains.get( channel.getChannelID() ); ProcessingChain chain = mProcessingChains.get( channel.getChannelID() );
chain.stop(); chain.stop();
mChannelModel.broadcast( mChannelModel.broadcast( new ChannelEvent( channel,
new ChannelEvent( channel, Event.NOTIFICATION_PROCESSING_STOP ) ); Event.NOTIFICATION_PROCESSING_STOP ) );
if( remove ) if( remove )
{ {
@@ -279,8 +281,6 @@ public class ChannelProcessingManager implements ChannelEventListener
chain.dispose(); chain.dispose();
} }
} }
channel.setEnabled( false );
} }
/** /**

View File

@@ -38,6 +38,7 @@ public class PlaylistEditor extends JPanel implements ListSelectionListener
mChannelModel = channelModel; mChannelModel = channelModel;
mEditor = new ChannelEditor( channelModel, playlistManager, sourceManager ); mEditor = new ChannelEditor( channelModel, playlistManager, sourceManager );
mChannelModel.addListener( mEditor );
init(); init();
} }