mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 00:57:31 -05:00
Channel Spectral Display
- Adds Channel Spectrum tab to display FFT of the audio output of the currently selected channel - Upgrades to JTransforms 3.0 FFT library - Adds three new context menus to main and channel spectral displays: -- Baseline - affects the vertical rendering baseline of the FFT -- Amplification - affects the vertical height of each FFT bin -- Averaging - affects how many FFTs are averaged to produce the display
This commit is contained in:
@@ -37,7 +37,7 @@ import source.tuner.TunerGroupNode;
|
||||
import source.tuner.TunerNode;
|
||||
import source.tuner.TunerSelectionListener;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelListener;
|
||||
import controller.channel.ChannelEventListener;
|
||||
import controller.channel.ChannelNode;
|
||||
import controller.site.Site;
|
||||
import controller.system.System;
|
||||
@@ -54,8 +54,8 @@ public class ConfigurationControllerModel extends DefaultTreeModel
|
||||
|
||||
private ResourceManager mResourceManager;
|
||||
|
||||
private ArrayList<ChannelListener> mChannelConfigChangeListeners =
|
||||
new ArrayList<ChannelListener>();
|
||||
private ArrayList<ChannelEventListener> mChannelConfigChangeListeners =
|
||||
new ArrayList<ChannelEventListener>();
|
||||
|
||||
private ArrayList<TunerSelectionListener> mTunerSelectionListeners =
|
||||
new ArrayList<TunerSelectionListener>();
|
||||
|
||||
@@ -18,22 +18,27 @@
|
||||
package controller;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import map.MapPanel;
|
||||
import message.Message;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import sample.Listener;
|
||||
import spectrum.ChannelSpectrumPanel;
|
||||
|
||||
import com.jidesoft.swing.JideSplitPane;
|
||||
import com.jidesoft.swing.JideTabbedPane;
|
||||
|
||||
import controller.activity.CallEventPanel;
|
||||
import controller.activity.MessageActivityPanel;
|
||||
import controller.channel.ChannelManager;
|
||||
import controller.state.ChannelStateList;
|
||||
|
||||
public class ControllerPanel extends JPanel
|
||||
@@ -46,7 +51,9 @@ public class ControllerPanel extends JPanel
|
||||
|
||||
private MessageActivityPanel mMessageActivityPanel =
|
||||
new MessageActivityPanel();
|
||||
|
||||
|
||||
private ChannelSpectrumPanel mChannelSpectrumPanel;
|
||||
|
||||
private JideTabbedPane mTabbedPane;
|
||||
|
||||
protected ConfigurationTreePanel mSystemControlViewPanel;
|
||||
@@ -79,14 +86,41 @@ public class ControllerPanel extends JPanel
|
||||
mSystemControlSplitPane.add( mSystemControlViewPanel );
|
||||
mSystemControlSplitPane.add( mConfigurationEditor );
|
||||
|
||||
mChannelSpectrumPanel = new ChannelSpectrumPanel( mResourceManager );
|
||||
|
||||
//Tabbed View - configuration, calls, messages, map
|
||||
mTabbedPane = new JideTabbedPane();
|
||||
mTabbedPane.setFont( this.getFont() );
|
||||
mTabbedPane.setForeground( Color.BLACK );
|
||||
mTabbedPane.addTab( "Configuration", mSystemControlSplitPane );
|
||||
mTabbedPane.addTab( "Calls", mCallEventPanel );
|
||||
mTabbedPane.addTab( "Channel Spectrum", mChannelSpectrumPanel );
|
||||
mTabbedPane.addTab( "Events", mCallEventPanel );
|
||||
mTabbedPane.addTab( "Messages", mMessageActivityPanel );
|
||||
|
||||
/**
|
||||
* Change listener to enable/disable the channel spectrum display
|
||||
* only when the tab is visible, and a channel has been selected
|
||||
*/
|
||||
mTabbedPane.addChangeListener( new ChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void stateChanged( ChangeEvent event )
|
||||
{
|
||||
int index = mTabbedPane.getSelectedIndex();
|
||||
|
||||
Component component = mTabbedPane.getComponentAt( index );
|
||||
|
||||
if( component instanceof ChannelSpectrumPanel )
|
||||
{
|
||||
mChannelSpectrumPanel.setEnabled( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
mChannelSpectrumPanel.setEnabled( false );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* Add mapping services and map panel to a new tab
|
||||
*/
|
||||
@@ -102,17 +136,13 @@ public class ControllerPanel extends JPanel
|
||||
/* Channel state list */
|
||||
mChannelStateList = new ChannelStateList( mResourceManager.getSettingsManager() );
|
||||
|
||||
/* Add message activity panel to receive channel selection events so
|
||||
* that we can display the correct message listings */
|
||||
mResourceManager.getChannelManager().addListener( mMessageActivityPanel );
|
||||
|
||||
/* Add call event panel to receive channel selection events so
|
||||
* that we can display the correct call event listings */
|
||||
mResourceManager.getChannelManager().addListener( mCallEventPanel );
|
||||
|
||||
/* Register ChannelStateList as a listener on the channel manager to
|
||||
* receive channel starts and stops and deletes */
|
||||
mResourceManager.getChannelManager().addListener( mChannelStateList );
|
||||
/* Register each of the components to receive channel events when the
|
||||
* channels are selected or change */
|
||||
ChannelManager channelManager = mResourceManager.getChannelManager();
|
||||
channelManager.addListener( mCallEventPanel );
|
||||
channelManager.addListener( mChannelStateList );
|
||||
channelManager.addListener( mChannelSpectrumPanel );
|
||||
channelManager.addListener( mMessageActivityPanel );
|
||||
|
||||
JScrollPane channelStateListScroll = new JScrollPane();
|
||||
channelStateListScroll.getViewport().setView( mChannelStateList );
|
||||
|
||||
@@ -202,6 +202,7 @@ public abstract class CallEvent
|
||||
PAGE( "Page" ),
|
||||
REGISTER( "Register" ),
|
||||
REGISTER_ESN( "ESN" ),
|
||||
REQUEST( "Request" ),
|
||||
SDM( "SDM" ),
|
||||
STATUS( "Status" ),
|
||||
UNKNOWN( "Unknown" );
|
||||
|
||||
@@ -23,10 +23,11 @@ import javax.swing.JTable;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.Channel.ChannelEvent;
|
||||
import controller.channel.ChannelListener;
|
||||
import controller.channel.ChannelEvent;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
import controller.channel.ChannelEventListener;
|
||||
|
||||
public class CallEventPanel extends JPanel implements ChannelListener
|
||||
public class CallEventPanel extends JPanel implements ChannelEventListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -46,31 +47,34 @@ public class CallEventPanel extends JPanel implements ChannelListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void occurred( Channel channel, ChannelEvent event )
|
||||
public void channelChanged( ChannelEvent event )
|
||||
{
|
||||
if( event == ChannelEvent.CHANGE_SELECTED && channel.getSelected() )
|
||||
if( event.getEvent() == Event.CHANGE_SELECTED &&
|
||||
event.getChannel().isSelected() )
|
||||
{
|
||||
if( mDisplayedChannel == null ||
|
||||
( mDisplayedChannel != null && mDisplayedChannel != channel ) )
|
||||
( mDisplayedChannel != null &&
|
||||
mDisplayedChannel != event.getChannel() ) )
|
||||
{
|
||||
removeAll();
|
||||
|
||||
JScrollPane scroller = new JScrollPane(
|
||||
channel.getProcessingChain().getChannelState()
|
||||
event.getChannel().getProcessingChain().getChannelState()
|
||||
.getCallEventTable() );
|
||||
|
||||
add( scroller );
|
||||
|
||||
mDisplayedChannel = channel;
|
||||
mDisplayedChannel = event.getChannel();
|
||||
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
else if( event == ChannelEvent.PROCESSING_STOPPED ||
|
||||
event == ChannelEvent.CHANNEL_DELETED )
|
||||
else if( event.getEvent() == Event.PROCESSING_STOPPED ||
|
||||
event.getEvent() == Event.CHANNEL_DELETED )
|
||||
{
|
||||
if( mDisplayedChannel != null && mDisplayedChannel == channel )
|
||||
if( mDisplayedChannel != null &&
|
||||
mDisplayedChannel == event.getChannel() )
|
||||
{
|
||||
mDisplayedChannel = null;
|
||||
removeAll();
|
||||
|
||||
@@ -23,10 +23,11 @@ import javax.swing.JTable;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.Channel.ChannelEvent;
|
||||
import controller.channel.ChannelListener;
|
||||
import controller.channel.ChannelEvent;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
import controller.channel.ChannelEventListener;
|
||||
|
||||
public class MessageActivityPanel extends JPanel implements ChannelListener
|
||||
public class MessageActivityPanel extends JPanel implements ChannelEventListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -44,31 +45,34 @@ public class MessageActivityPanel extends JPanel implements ChannelListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void occurred( Channel channel, ChannelEvent event )
|
||||
public void channelChanged( ChannelEvent event )
|
||||
{
|
||||
if( event == ChannelEvent.CHANGE_SELECTED && channel.getSelected() )
|
||||
if( event.getEvent() == Event.CHANGE_SELECTED &&
|
||||
event.getChannel().isSelected() )
|
||||
{
|
||||
if( mDisplayedChannel == null ||
|
||||
( mDisplayedChannel != null && mDisplayedChannel != channel ) )
|
||||
( mDisplayedChannel != null &&
|
||||
mDisplayedChannel != event.getChannel() ) )
|
||||
{
|
||||
removeAll();
|
||||
|
||||
JScrollPane scroll =
|
||||
new JScrollPane( channel.getProcessingChain()
|
||||
new JScrollPane( event.getChannel().getProcessingChain()
|
||||
.getChannelState().getMessageActivityTable() );
|
||||
|
||||
add( scroll );
|
||||
|
||||
mDisplayedChannel = channel;
|
||||
mDisplayedChannel = event.getChannel();
|
||||
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
else if( event == ChannelEvent.PROCESSING_STOPPED ||
|
||||
event == ChannelEvent.CHANNEL_DELETED )
|
||||
else if( event.getEvent() == Event.PROCESSING_STOPPED ||
|
||||
event.getEvent() == Event.CHANNEL_DELETED )
|
||||
{
|
||||
if( mDisplayedChannel != null && mDisplayedChannel == channel )
|
||||
if( mDisplayedChannel != null &&
|
||||
mDisplayedChannel == event.getChannel() )
|
||||
{
|
||||
mDisplayedChannel = null;
|
||||
removeAll();
|
||||
|
||||
@@ -47,6 +47,7 @@ import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannel.Type;
|
||||
import controller.ResourceManager;
|
||||
import controller.activity.ActivitySummaryFrame;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
import controller.config.Configuration;
|
||||
import controller.site.Site;
|
||||
import controller.state.ChannelState;
|
||||
@@ -71,8 +72,8 @@ public class Channel extends Configuration
|
||||
private static final boolean DISABLED = false;
|
||||
private static final boolean BROADCAST_CHANGE = true;
|
||||
|
||||
private CopyOnWriteArrayList<ChannelListener> mChannelListeners =
|
||||
new CopyOnWriteArrayList<ChannelListener>();
|
||||
private CopyOnWriteArrayList<ChannelEventListener> mChannelListeners =
|
||||
new CopyOnWriteArrayList<ChannelEventListener>();
|
||||
|
||||
private CopyOnWriteArrayList<Listener<Message>> mMessageListeners =
|
||||
new CopyOnWriteArrayList<Listener<Message>>();
|
||||
@@ -181,7 +182,7 @@ public class Channel extends Configuration
|
||||
* Indicates if this channel has been selected for audio output
|
||||
*/
|
||||
@XmlTransient
|
||||
public boolean getSelected()
|
||||
public boolean isSelected()
|
||||
{
|
||||
return mSelected;
|
||||
}
|
||||
@@ -195,7 +196,7 @@ public class Channel extends Configuration
|
||||
mProcessingChain.getAudioOutput().setAudioPlaybackEnabled( selected );
|
||||
}
|
||||
|
||||
fireChannelEvent( ChannelEvent.CHANGE_SELECTED );
|
||||
fireChannelEvent( Event.CHANGE_SELECTED );
|
||||
}
|
||||
|
||||
public JMenu getContextMenu()
|
||||
@@ -290,7 +291,7 @@ public class Channel extends Configuration
|
||||
setEnabled( DISABLED, BROADCAST_CHANGE );
|
||||
|
||||
/* Broadcast channel deleted event */
|
||||
fireChannelEvent( ChannelEvent.CHANNEL_DELETED );
|
||||
fireChannelEvent( Event.CHANNEL_DELETED );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -375,7 +376,7 @@ public class Channel extends Configuration
|
||||
|
||||
if( fireChangeEvent )
|
||||
{
|
||||
fireChannelEvent( ChannelEvent.CHANGE_SYSTEM );
|
||||
fireChannelEvent( Event.CHANGE_SYSTEM );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +398,7 @@ public class Channel extends Configuration
|
||||
|
||||
if( fireChangeEvent )
|
||||
{
|
||||
fireChannelEvent( ChannelEvent.CHANGE_SITE );
|
||||
fireChannelEvent( Event.CHANGE_SITE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +441,7 @@ public class Channel extends Configuration
|
||||
|
||||
if( fireChannelEvent )
|
||||
{
|
||||
fireChannelEvent( ChannelEvent.CHANGE_ENABLED );
|
||||
fireChannelEvent( Event.CHANGE_ENABLED );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +476,7 @@ public class Channel extends Configuration
|
||||
|
||||
if( fireChangeEvent )
|
||||
{
|
||||
fireChannelEvent( ChannelEvent.CHANGE_ALIAS_LIST );
|
||||
fireChannelEvent( Event.CHANGE_ALIAS_LIST );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,7 +535,7 @@ public class Channel extends Configuration
|
||||
|
||||
if( fireChangeEvent )
|
||||
{
|
||||
fireChannelEvent( ChannelEvent.CHANGE_DECODER );
|
||||
fireChannelEvent( Event.CHANGE_DECODER );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,7 +572,7 @@ public class Channel extends Configuration
|
||||
|
||||
if( fireChangeEvent )
|
||||
{
|
||||
fireChannelEvent( ChannelEvent.CHANGE_SOURCE );
|
||||
fireChannelEvent( Event.CHANGE_SOURCE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,7 +609,7 @@ public class Channel extends Configuration
|
||||
|
||||
if( fireChangeEvent )
|
||||
{
|
||||
fireChannelEvent( ChannelEvent.CHANGE_EVENT_LOGGER );
|
||||
fireChannelEvent( Event.CHANGE_EVENT_LOGGER );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,7 +646,7 @@ public class Channel extends Configuration
|
||||
|
||||
if( fireChangeEvent )
|
||||
{
|
||||
fireChannelEvent( ChannelEvent.CHANGE_RECORDER );
|
||||
fireChannelEvent( Event.CHANGE_RECORDER );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,7 +677,7 @@ public class Channel extends Configuration
|
||||
|
||||
if( fireChangeEvent )
|
||||
{
|
||||
fireChannelEvent( ChannelEvent.CHANGE_NAME );
|
||||
fireChannelEvent( Event.CHANGE_NAME );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,7 +716,7 @@ public class Channel extends Configuration
|
||||
|
||||
mProcessingChain.start();
|
||||
|
||||
fireChannelEvent( ChannelEvent.PROCESSING_STARTED );
|
||||
fireChannelEvent( Event.PROCESSING_STARTED );
|
||||
}
|
||||
|
||||
/* If this is a traffic channel, override the call fade timeout before
|
||||
@@ -762,17 +763,17 @@ public class Channel extends Configuration
|
||||
mSelected = false;
|
||||
}
|
||||
|
||||
fireChannelEvent( ChannelEvent.PROCESSING_STOPPED );
|
||||
fireChannelEvent( Event.PROCESSING_STOPPED );
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a channel change event to all registered listeners
|
||||
*/
|
||||
public void fireChannelEvent( ChannelEvent event )
|
||||
public void fireChannelEvent( Event event )
|
||||
{
|
||||
for( ChannelListener listener: mChannelListeners )
|
||||
for( ChannelEventListener listener: mChannelListeners )
|
||||
{
|
||||
listener.occurred( this, event );
|
||||
listener.channelChanged( new ChannelEvent( this, event ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,17 +781,19 @@ public class Channel extends Configuration
|
||||
* Adds a channel listener to receive all channel events from this channel
|
||||
* and automatically sends the listener a channel add event.
|
||||
*/
|
||||
public void addListener( ChannelListener listener )
|
||||
public void addListener( ChannelEventListener listener )
|
||||
{
|
||||
if( !mChannelListeners.contains( listener ) )
|
||||
{
|
||||
mChannelListeners.add( listener );
|
||||
|
||||
listener.occurred( this, ChannelEvent.CHANNEL_ADDED );
|
||||
listener.channelChanged(
|
||||
new ChannelEvent( this, Event.CHANNEL_ADDED ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.error( "Channel - attempt to add already existing channel listener [" + listener.getClass() + "]" );
|
||||
Log.error( "Channel - attempt to add already existing channel "
|
||||
+ "listener [" + listener.getClass() + "]" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,9 +801,9 @@ public class Channel extends Configuration
|
||||
* Adds a list of channel listeners to receive all channel events from this
|
||||
* channel and automatically sends each one a channel add event.
|
||||
*/
|
||||
public void addListeners( List<ChannelListener> listeners )
|
||||
public void addListeners( List<ChannelEventListener> listeners )
|
||||
{
|
||||
for( ChannelListener listener: listeners )
|
||||
for( ChannelEventListener listener: listeners )
|
||||
{
|
||||
addListener( listener );
|
||||
}
|
||||
@@ -809,7 +812,7 @@ public class Channel extends Configuration
|
||||
/**
|
||||
* Removes a channel listener from receiving channel events from this channel
|
||||
*/
|
||||
public void removeListener( ChannelListener listener )
|
||||
public void removeListener( ChannelEventListener listener )
|
||||
{
|
||||
mChannelListeners.remove( listener );
|
||||
}
|
||||
@@ -884,28 +887,4 @@ public class Channel extends Configuration
|
||||
{
|
||||
return mTrafficChannels.containsKey( channelNumber );
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel Events - used to specify channel events and changes to channel
|
||||
* configurations and settings.
|
||||
*/
|
||||
public enum ChannelEvent
|
||||
{
|
||||
CHANGE_ALIAS_LIST,
|
||||
CHANGE_DECODER,
|
||||
CHANGE_ENABLED,
|
||||
CHANGE_EVENT_LOGGER,
|
||||
CHANGE_NAME,
|
||||
CHANGE_SITE,
|
||||
CHANGE_RECORDER,
|
||||
CHANGE_SELECTED,
|
||||
CHANGE_SOURCE,
|
||||
CHANGE_SYSTEM,
|
||||
|
||||
CHANNEL_ADDED,
|
||||
CHANNEL_DELETED,
|
||||
|
||||
PROCESSING_STARTED,
|
||||
PROCESSING_STOPPED,
|
||||
}
|
||||
}
|
||||
|
||||
52
src/controller/channel/ChannelEvent.java
Normal file
52
src/controller/channel/ChannelEvent.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package controller.channel;
|
||||
|
||||
public class ChannelEvent
|
||||
{
|
||||
private Channel mChannel;
|
||||
private Event mEvent;
|
||||
|
||||
/**
|
||||
* ChannelEvent - event describing any changes to channels
|
||||
* @param channel - channel that changed
|
||||
* @param event - change event
|
||||
*/
|
||||
public ChannelEvent( Channel channel, Event event )
|
||||
{
|
||||
mChannel = channel;
|
||||
mEvent = event;
|
||||
}
|
||||
|
||||
public Channel getChannel()
|
||||
{
|
||||
return mChannel;
|
||||
}
|
||||
|
||||
public Event getEvent()
|
||||
{
|
||||
return mEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel Events - used to specify channel events and changes to channel
|
||||
* configurations and settings.
|
||||
*/
|
||||
public enum Event
|
||||
{
|
||||
CHANGE_ALIAS_LIST,
|
||||
CHANGE_DECODER,
|
||||
CHANGE_ENABLED,
|
||||
CHANGE_EVENT_LOGGER,
|
||||
CHANGE_NAME,
|
||||
CHANGE_SITE,
|
||||
CHANGE_RECORDER,
|
||||
CHANGE_SELECTED,
|
||||
CHANGE_SOURCE,
|
||||
CHANGE_SYSTEM,
|
||||
|
||||
CHANNEL_ADDED,
|
||||
CHANNEL_DELETED,
|
||||
|
||||
PROCESSING_STARTED,
|
||||
PROCESSING_STOPPED,
|
||||
}
|
||||
}
|
||||
@@ -17,16 +17,14 @@
|
||||
******************************************************************************/
|
||||
package controller.channel;
|
||||
|
||||
import controller.channel.Channel.ChannelEvent;
|
||||
|
||||
/**
|
||||
* Interface for receiving channel events. Each listener will receive
|
||||
* notification of all channel events.
|
||||
*/
|
||||
public interface ChannelListener
|
||||
public interface ChannelEventListener
|
||||
{
|
||||
/**
|
||||
* Notifies the listener that a channel has changed and what has changed
|
||||
* Notifies the listener that a channel event has occurred
|
||||
*/
|
||||
public void occurred( Channel channel, ChannelEvent event );
|
||||
public void channelChanged( ChannelEvent event );
|
||||
}
|
||||
@@ -22,14 +22,13 @@ import java.util.ArrayList;
|
||||
import message.Message;
|
||||
import sample.Listener;
|
||||
import controller.ResourceManager;
|
||||
import controller.channel.Channel.ChannelEvent;
|
||||
|
||||
public class ChannelManager implements ChannelListener
|
||||
public class ChannelManager implements ChannelEventListener
|
||||
{
|
||||
private ArrayList<Channel> mChannels = new ArrayList<Channel>();
|
||||
|
||||
private ArrayList<ChannelListener> mChannelListeners =
|
||||
new ArrayList<ChannelListener>();
|
||||
private ArrayList<ChannelEventListener> mChannelListeners =
|
||||
new ArrayList<ChannelEventListener>();
|
||||
private ArrayList<Listener<Message>> mMessageListeners =
|
||||
new ArrayList<Listener<Message>>();
|
||||
|
||||
@@ -45,18 +44,18 @@ public class ChannelManager implements ChannelListener
|
||||
*/
|
||||
@SuppressWarnings( "incomplete-switch" )
|
||||
@Override
|
||||
public void occurred( Channel channel, ChannelEvent component )
|
||||
public void channelChanged( ChannelEvent event )
|
||||
{
|
||||
switch( component )
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case CHANNEL_ADDED:
|
||||
if( !mChannels.contains( channel ) )
|
||||
if( !mChannels.contains( event.getChannel() ) )
|
||||
{
|
||||
mChannels.add( channel );
|
||||
mChannels.add( event.getChannel() );
|
||||
}
|
||||
break;
|
||||
case CHANNEL_DELETED:
|
||||
mChannels.remove( channel );
|
||||
mChannels.remove( event.getChannel() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +65,7 @@ public class ChannelManager implements ChannelListener
|
||||
* any channel change events. This listener will automatically receive
|
||||
* a channel add event as it is added to each of the existing channels.
|
||||
*/
|
||||
public void addListener( ChannelListener listener )
|
||||
public void addListener( ChannelEventListener listener )
|
||||
{
|
||||
mChannelListeners.add( listener );
|
||||
|
||||
@@ -80,7 +79,7 @@ public class ChannelManager implements ChannelListener
|
||||
* Removes a channel listener from being automatically added to all channels
|
||||
* to receive channel change events.
|
||||
*/
|
||||
public void removeListener( ChannelListener listener )
|
||||
public void removeListener( ChannelEventListener listener )
|
||||
{
|
||||
mChannelListeners.remove( listener );
|
||||
|
||||
@@ -94,7 +93,7 @@ public class ChannelManager implements ChannelListener
|
||||
* Returns the list of channel change listeners that will be automatically
|
||||
* added to all channels to receive channel change events
|
||||
*/
|
||||
public ArrayList<ChannelListener> getChannelListeners()
|
||||
public ArrayList<ChannelEventListener> getChannelListeners()
|
||||
{
|
||||
return mChannelListeners;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,8 @@ import java.text.DecimalFormat;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import log.Log;
|
||||
import source.tuner.TunerChannel;
|
||||
import controller.ConfigurableNode;
|
||||
import controller.channel.Channel.ChannelEvent;
|
||||
import controller.site.SiteNode;
|
||||
import controller.system.SystemNode;
|
||||
|
||||
@@ -33,7 +31,7 @@ import controller.system.SystemNode;
|
||||
* A channel has all of the pieces needed to wire together a source, decoder,
|
||||
* event logger and recorder and be started and stopped.
|
||||
*/
|
||||
public class ChannelNode extends ConfigurableNode implements ChannelListener
|
||||
public class ChannelNode extends ConfigurableNode implements ChannelEventListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -73,9 +71,9 @@ public class ChannelNode extends ConfigurableNode implements ChannelListener
|
||||
* Listener method to receive channel changes from the underlying chnannel
|
||||
*/
|
||||
@Override
|
||||
public void occurred( Channel channel, ChannelEvent event )
|
||||
public void channelChanged( ChannelEvent event )
|
||||
{
|
||||
switch( event )
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
/* Refresh the node for each of these events */
|
||||
case CHANGE_DECODER:
|
||||
|
||||
@@ -36,9 +36,9 @@ import settings.ColorSettingMenuItem;
|
||||
import settings.ColorSettingResetMenuItem;
|
||||
import settings.SettingsManager;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.Channel.ChannelEvent;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import controller.channel.ChannelListener;
|
||||
import controller.channel.ChannelEvent;
|
||||
import controller.channel.ChannelEventListener;
|
||||
import decode.fleetsync2.FleetsyncChannelState;
|
||||
import decode.fleetsync2.FleetsyncPanel;
|
||||
import decode.ltrnet.LTRNetChannelState;
|
||||
@@ -54,7 +54,7 @@ import decode.nbfm.NBFMPanel;
|
||||
import decode.passport.PassportChannelState;
|
||||
import decode.passport.PassportPanel;
|
||||
|
||||
public class ChannelStateList extends JPanel implements ChannelListener
|
||||
public class ChannelStateList extends JPanel implements ChannelEventListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -79,24 +79,25 @@ public class ChannelStateList extends JPanel implements ChannelListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void occurred( Channel channel, ChannelEvent event )
|
||||
public void channelChanged( ChannelEvent event )
|
||||
{
|
||||
ChannelType type = channel.getChannelType();
|
||||
ChannelType type = event.getChannel().getChannelType();
|
||||
|
||||
switch( event )
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case PROCESSING_STARTED:
|
||||
if( type == ChannelType.STANDARD )
|
||||
{
|
||||
channelStarted( channel );
|
||||
channelStarted( event.getChannel() );
|
||||
}
|
||||
else if( type == ChannelType.TRAFFIC )
|
||||
{
|
||||
for( Channel parent: mDisplayedPanels.keySet() )
|
||||
{
|
||||
if( parent.hasTrafficChannel( channel ) )
|
||||
if( parent.hasTrafficChannel( event.getChannel() ) )
|
||||
{
|
||||
mDisplayedPanels.get( parent ).trafficChannelAdded( channel );
|
||||
mDisplayedPanels.get( parent )
|
||||
.trafficChannelAdded( event.getChannel() );
|
||||
validate();
|
||||
}
|
||||
}
|
||||
@@ -105,7 +106,7 @@ public class ChannelStateList extends JPanel implements ChannelListener
|
||||
case PROCESSING_STOPPED:
|
||||
if( type == ChannelType.STANDARD )
|
||||
{
|
||||
channelStopped( channel );
|
||||
channelStopped( event.getChannel() );
|
||||
}
|
||||
/* Since we don't have a reference to the parent channel that
|
||||
* owns the traffic channel, iterate all channels to find the
|
||||
@@ -114,11 +115,12 @@ public class ChannelStateList extends JPanel implements ChannelListener
|
||||
{
|
||||
for( Channel control: mDisplayedPanels.keySet() )
|
||||
{
|
||||
if( control.hasTrafficChannel( channel ) )
|
||||
if( control.hasTrafficChannel( event.getChannel() ) )
|
||||
{
|
||||
control.removeTrafficChannel( channel );
|
||||
control.removeTrafficChannel( event.getChannel() );
|
||||
|
||||
mDisplayedPanels.get( control ).trafficChannelDeleted( channel );
|
||||
mDisplayedPanels.get( control )
|
||||
.trafficChannelDeleted( event.getChannel() );
|
||||
|
||||
validate();
|
||||
}
|
||||
@@ -252,15 +254,17 @@ public class ChannelStateList extends JPanel implements ChannelListener
|
||||
|
||||
public void setSelectedChannel( ChannelStatePanel selectedPanel )
|
||||
{
|
||||
boolean current = selectedPanel.getSelected();
|
||||
|
||||
//De-select any other selected panel
|
||||
for( ChannelStatePanel panel: mDisplayedPanels.values() )
|
||||
{
|
||||
//Turn selected off
|
||||
panel.setSelected( false );
|
||||
if( panel != selectedPanel && panel.isSelected() )
|
||||
{
|
||||
panel.setSelected( false );
|
||||
}
|
||||
}
|
||||
|
||||
selectedPanel.setSelected( !current );
|
||||
//Toggle selection state
|
||||
selectedPanel.setSelected( !selectedPanel.isSelected() );
|
||||
}
|
||||
|
||||
public class ListSelectionListener implements MouseListener
|
||||
|
||||
@@ -163,9 +163,9 @@ public abstract class ChannelStatePanel extends JPanel
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean getSelected()
|
||||
public boolean isSelected()
|
||||
{
|
||||
return mChannel.getSelected();
|
||||
return mChannel.isSelected();
|
||||
}
|
||||
|
||||
public void addPanel( final JPanel panel )
|
||||
@@ -224,13 +224,13 @@ public abstract class ChannelStatePanel extends JPanel
|
||||
|
||||
public void setSelected( boolean selected )
|
||||
{
|
||||
mChannel.setSelected( selected );
|
||||
|
||||
for( ChannelStatePanel traffic: getTrafficPanels().values() )
|
||||
{
|
||||
traffic.setSelected( false );
|
||||
}
|
||||
|
||||
|
||||
mChannel.setSelected( selected );
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public abstract class ChannelStatePanel extends JPanel
|
||||
g2.drawLine( 0, getHeight() - 1, getWidth(), getHeight() - 1 );
|
||||
|
||||
/* Draw channel selected box */
|
||||
if( mChannel.getSelected() )
|
||||
if( mChannel.isSelected() )
|
||||
{
|
||||
g2.setColor( mColorChannelSelected );
|
||||
g2.drawRect( 1, 1, getWidth() - 2, getHeight() - 2 );
|
||||
|
||||
Reference in New Issue
Block a user