mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 09:37:36 -05:00
#82 WIP - converted all classes to get icons from IconManager and removed icon management from the SettingsManager
This commit is contained in:
@@ -1,3 +1,21 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* sdrtrunk
|
||||||
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
package alias;
|
package alias;
|
||||||
|
|
||||||
import alias.AliasEvent.Event;
|
import alias.AliasEvent.Event;
|
||||||
@@ -5,9 +23,9 @@ import gui.editor.Editor;
|
|||||||
import icon.Icon;
|
import icon.Icon;
|
||||||
import icon.IconCellRenderer;
|
import icon.IconCellRenderer;
|
||||||
import icon.IconManager;
|
import icon.IconManager;
|
||||||
|
import icon.IconModel;
|
||||||
import map.MapIcon;
|
import map.MapIcon;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
@@ -43,8 +61,7 @@ public class AliasNameEditor extends Editor<Alias>
|
|||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
setLayout(new MigLayout("fill,wrap 2", "[right][grow,fill]",
|
setLayout(new MigLayout("fill,wrap 2", "[right][grow,fill]", "[][][][][][][grow]"));
|
||||||
"[][][][][][][grow]"));
|
|
||||||
|
|
||||||
add(new JLabel("Name:"));
|
add(new JLabel("Name:"));
|
||||||
mName = new JTextField();
|
mName = new JTextField();
|
||||||
@@ -140,7 +157,7 @@ public class AliasNameEditor extends Editor<Alias>
|
|||||||
|
|
||||||
IconCellRenderer renderer = new IconCellRenderer(mIconManager);
|
IconCellRenderer renderer = new IconCellRenderer(mIconManager);
|
||||||
renderer.setPreferredSize(new Dimension(200, 30));
|
renderer.setPreferredSize(new Dimension(200, 30));
|
||||||
mIconCombo.setRenderer( renderer );
|
mIconCombo.setRenderer(renderer);
|
||||||
mIconCombo.addActionListener(new ActionListener()
|
mIconCombo.addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@@ -179,6 +196,8 @@ public class AliasNameEditor extends Editor<Alias>
|
|||||||
{
|
{
|
||||||
mName.setText(alias.getName());
|
mName.setText(alias.getName());
|
||||||
|
|
||||||
|
mIconCombo.setModel(new DefaultComboBoxModel<>(mIconManager.getIcons()));
|
||||||
|
|
||||||
List<String> listNames = mAliasModel.getListNames();
|
List<String> listNames = mAliasModel.getListNames();
|
||||||
|
|
||||||
if(listNames.isEmpty())
|
if(listNames.isEmpty())
|
||||||
@@ -218,7 +237,7 @@ public class AliasNameEditor extends Editor<Alias>
|
|||||||
|
|
||||||
if(iconName == null)
|
if(iconName == null)
|
||||||
{
|
{
|
||||||
iconName = SettingsManager.DEFAULT_ICON;
|
iconName = IconModel.DEFAULT_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
Icon savedIcon = mIconManager.getModel().getIcon(iconName);
|
Icon savedIcon = mIconManager.getModel().getIcon(iconName);
|
||||||
|
|||||||
@@ -266,6 +266,8 @@ public class MultipleAliasEditor extends Editor<List<Alias>>
|
|||||||
List<String> streamNames = mBroadcastModel.getBroadcastConfigurationNames();
|
List<String> streamNames = mBroadcastModel.getBroadcastConfigurationNames();
|
||||||
mStreamCombo.setModel(new DefaultComboBoxModel<String>(streamNames.toArray(new String[streamNames.size()])));
|
mStreamCombo.setModel(new DefaultComboBoxModel<String>(streamNames.toArray(new String[streamNames.size()])));
|
||||||
|
|
||||||
|
mIconCombo.setModel(new DefaultComboBoxModel<>(mIconManager.getIcons()));
|
||||||
|
|
||||||
setCheckBoxesUnselected();
|
setCheckBoxesUnselected();
|
||||||
|
|
||||||
setModified(false);
|
setModified(false);
|
||||||
|
|||||||
@@ -1,12 +1,29 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* sdrtrunk
|
||||||
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
package audio;
|
package audio;
|
||||||
|
|
||||||
import java.awt.Color;
|
import alias.Alias;
|
||||||
import java.awt.EventQueue;
|
import audio.metadata.AudioMetadata;
|
||||||
import java.awt.Font;
|
import audio.metadata.Metadata;
|
||||||
|
import audio.metadata.MetadataType;
|
||||||
import javax.swing.JLabel;
|
import audio.output.AudioOutput;
|
||||||
import javax.swing.JPanel;
|
import icon.IconManager;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
@@ -14,278 +31,279 @@ import settings.ColorSetting.ColorSettingName;
|
|||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingChangeListener;
|
import settings.SettingChangeListener;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import alias.Alias;
|
|
||||||
import audio.metadata.AudioMetadata;
|
|
||||||
import audio.metadata.Metadata;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
import audio.output.AudioOutput;
|
|
||||||
|
|
||||||
public class AudioChannelPanel extends JPanel
|
import javax.swing.*;
|
||||||
implements Listener<AudioEvent>, SettingChangeListener
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class AudioChannelPanel extends JPanel
|
||||||
|
implements Listener<AudioEvent>, SettingChangeListener
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Font mFont = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
private Font mFont = new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
||||||
private Color mLabelColor;
|
private Color mLabelColor;
|
||||||
private Color mDetailsColor;
|
private Color mDetailsColor;
|
||||||
|
|
||||||
|
private IconManager mIconManager;
|
||||||
private SettingsManager mSettingsManager;
|
private SettingsManager mSettingsManager;
|
||||||
private AudioOutput mAudioOutput;
|
private AudioOutput mAudioOutput;
|
||||||
|
|
||||||
private JLabel mChannelName = new JLabel( " " );
|
private JLabel mChannelName = new JLabel(" ");
|
||||||
private JLabel mToLabel = new JLabel( "TO:" );
|
private JLabel mToLabel = new JLabel("TO:");
|
||||||
private JLabel mTo = new JLabel( "" );
|
private JLabel mTo = new JLabel("");
|
||||||
private JLabel mToAlias = new JLabel( "" );
|
private JLabel mToAlias = new JLabel("");
|
||||||
|
|
||||||
private JLabel mMutedLabel = new JLabel( " " );
|
|
||||||
private JLabel mFromLabel = new JLabel( "FROM:" );
|
|
||||||
private JLabel mFrom = new JLabel( "" );
|
|
||||||
private JLabel mFromAlias = new JLabel( "" );
|
|
||||||
|
|
||||||
private boolean mConfigured = false;
|
|
||||||
|
|
||||||
public AudioChannelPanel( SettingsManager settingsManager, AudioOutput audioOutput )
|
|
||||||
{
|
|
||||||
mSettingsManager = settingsManager;
|
|
||||||
mSettingsManager.addListener( this );
|
|
||||||
|
|
||||||
mAudioOutput = audioOutput;
|
private JLabel mMutedLabel = new JLabel(" ");
|
||||||
|
private JLabel mFromLabel = new JLabel("FROM:");
|
||||||
if( mAudioOutput != null )
|
private JLabel mFrom = new JLabel("");
|
||||||
{
|
private JLabel mFromAlias = new JLabel("");
|
||||||
mAudioOutput.addAudioEventListener( this );
|
|
||||||
mAudioOutput.setAudioMetadataListener( new AudioMetadataProcessor() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mLabelColor = mSettingsManager.getColorSetting(
|
private boolean mConfigured = false;
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER ).getColor();
|
|
||||||
mDetailsColor = mSettingsManager.getColorSetting(
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS ).getColor();
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[][right][][grow,fill]", "[]0[]0[grow,fill]" ) );
|
|
||||||
setBackground( Color.BLACK );
|
|
||||||
|
|
||||||
mChannelName = new JLabel( mAudioOutput != null ? mAudioOutput.getChannelName() : " " );
|
|
||||||
mChannelName.setFont( mFont );
|
|
||||||
mChannelName.setForeground( mDetailsColor );
|
|
||||||
add( mChannelName );
|
|
||||||
|
|
||||||
mToLabel.setFont( mFont );
|
|
||||||
if( mAudioOutput != null )
|
|
||||||
{
|
|
||||||
mToLabel.setForeground( mLabelColor );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToLabel.setForeground( getBackground() );
|
|
||||||
}
|
|
||||||
add( mToLabel );
|
|
||||||
|
|
||||||
mTo.setFont( mFont );
|
public AudioChannelPanel(IconManager iconManager, SettingsManager settingsManager, AudioOutput audioOutput)
|
||||||
mTo.setForeground( mLabelColor );
|
|
||||||
add( mTo );
|
|
||||||
|
|
||||||
mToAlias.setFont( mFont );
|
|
||||||
mToAlias.setForeground( mLabelColor );
|
|
||||||
add( mToAlias,"wrap" );
|
|
||||||
|
|
||||||
mMutedLabel.setFont( mFont );
|
|
||||||
mMutedLabel.setForeground( Color.RED );
|
|
||||||
add( mMutedLabel );
|
|
||||||
|
|
||||||
mFromLabel.setFont( mFont );
|
|
||||||
if( mAudioOutput != null )
|
|
||||||
{
|
|
||||||
mFromLabel.setForeground( mLabelColor );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromLabel.setForeground( getBackground() );
|
|
||||||
}
|
|
||||||
add( mFromLabel );
|
|
||||||
|
|
||||||
mFrom.setFont( mFont );
|
|
||||||
mFrom.setForeground( mLabelColor );
|
|
||||||
add( mFrom );
|
|
||||||
|
|
||||||
mFromAlias.setFont( mFont );
|
|
||||||
mFromAlias.setForeground( mLabelColor );
|
|
||||||
add( mFromAlias,"wrap" );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final AudioEvent audioEvent )
|
|
||||||
{
|
|
||||||
switch( audioEvent.getType() )
|
|
||||||
{
|
|
||||||
case AUDIO_STOPPED:
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
resetLabels();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
break;
|
|
||||||
case AUDIO_MUTED:
|
|
||||||
case AUDIO_UNMUTED:
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
mMutedLabel.setText( mAudioOutput.isMuted() ? "M" : " " );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets the from and to labels. Note: this does not happen on the swing
|
|
||||||
* event thread. Only invoke from the swing thread.
|
|
||||||
*/
|
|
||||||
private void resetLabels()
|
|
||||||
{
|
|
||||||
mFrom.setText( "" );
|
|
||||||
updateAlias( mFromAlias, null );
|
|
||||||
|
|
||||||
mTo.setText( "" );
|
|
||||||
updateAlias( mToAlias, null );
|
|
||||||
|
|
||||||
mConfigured = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the alias label with text and icon from the alias. Note: this
|
|
||||||
* does not occur on the Swing event thread -- wrap any calls to this
|
|
||||||
* method with an event thread call.
|
|
||||||
*/
|
|
||||||
private void updateAlias( JLabel label, Alias alias )
|
|
||||||
{
|
|
||||||
if( alias != null )
|
|
||||||
{
|
|
||||||
label.setText( alias.getName() );
|
|
||||||
|
|
||||||
String icon = alias.getIconName();
|
|
||||||
|
|
||||||
if( icon != null )
|
|
||||||
{
|
|
||||||
label.setIcon( mSettingsManager.getImageIcon( icon,
|
|
||||||
SettingsManager.DEFAULT_ICON_SIZE ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setIcon( null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setText( "" );
|
|
||||||
label.setIcon( null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Processes audio metadata to update this panel's display values
|
|
||||||
*/
|
|
||||||
public class AudioMetadataProcessor implements Listener<AudioMetadata>
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void receive( AudioMetadata audioMetadata )
|
|
||||||
{
|
|
||||||
if( !mConfigured || audioMetadata.isUpdated() )
|
|
||||||
{
|
|
||||||
final Metadata from = audioMetadata.getMetadata( MetadataType.FROM );
|
|
||||||
|
|
||||||
final Metadata to = audioMetadata.getMetadata( MetadataType.TO );
|
|
||||||
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
if( from != null )
|
|
||||||
{
|
|
||||||
mFrom.setText( from.getValue() );
|
|
||||||
updateAlias( mFromAlias, from.getAlias() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFrom.setText( "-----" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( to != null )
|
|
||||||
{
|
|
||||||
mTo.setText( to.getValue() );
|
|
||||||
updateAlias( mToAlias, to.getAlias() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mTo.setText( "-----" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
mConfigured = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged( Setting setting )
|
|
||||||
{
|
{
|
||||||
if( setting instanceof ColorSetting )
|
mIconManager = iconManager;
|
||||||
{
|
mSettingsManager = settingsManager;
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
mSettingsManager.addListener(this);
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
mAudioOutput = audioOutput;
|
||||||
{
|
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
if(mAudioOutput != null)
|
||||||
if( mFrom != null )
|
{
|
||||||
{
|
mAudioOutput.addAudioEventListener(this);
|
||||||
mFrom.setForeground( mLabelColor );
|
mAudioOutput.setAudioMetadataListener(new AudioMetadataProcessor());
|
||||||
}
|
}
|
||||||
if( mFromAlias != null )
|
|
||||||
{
|
mLabelColor = mSettingsManager.getColorSetting(
|
||||||
mFromAlias.setForeground( mLabelColor );
|
ColorSettingName.CHANNEL_STATE_LABEL_DECODER).getColor();
|
||||||
}
|
mDetailsColor = mSettingsManager.getColorSetting(
|
||||||
if( mTo != null )
|
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS).getColor();
|
||||||
{
|
|
||||||
mTo.setForeground( mLabelColor );
|
init();
|
||||||
}
|
|
||||||
if( mToAlias != null )
|
|
||||||
{
|
|
||||||
mToAlias.setForeground( mLabelColor );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CHANNEL_STATE_LABEL_DETAILS:
|
|
||||||
if( mFromLabel != null )
|
|
||||||
{
|
|
||||||
mFromLabel.setForeground( mDetailsColor );
|
|
||||||
}
|
|
||||||
if( mToLabel != null )
|
|
||||||
{
|
|
||||||
mToLabel.setForeground( mDetailsColor );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void init()
|
||||||
public void settingDeleted( Setting setting ) {}
|
{
|
||||||
|
setLayout(new MigLayout("insets 0 0 0 0", "[][right][][grow,fill]", "[]0[]0[grow,fill]"));
|
||||||
|
setBackground(Color.BLACK);
|
||||||
|
|
||||||
|
mChannelName = new JLabel(mAudioOutput != null ? mAudioOutput.getChannelName() : " ");
|
||||||
|
mChannelName.setFont(mFont);
|
||||||
|
mChannelName.setForeground(mDetailsColor);
|
||||||
|
add(mChannelName);
|
||||||
|
|
||||||
|
mToLabel.setFont(mFont);
|
||||||
|
if(mAudioOutput != null)
|
||||||
|
{
|
||||||
|
mToLabel.setForeground(mLabelColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mToLabel.setForeground(getBackground());
|
||||||
|
}
|
||||||
|
add(mToLabel);
|
||||||
|
|
||||||
|
mTo.setFont(mFont);
|
||||||
|
mTo.setForeground(mLabelColor);
|
||||||
|
add(mTo);
|
||||||
|
|
||||||
|
mToAlias.setFont(mFont);
|
||||||
|
mToAlias.setForeground(mLabelColor);
|
||||||
|
add(mToAlias, "wrap");
|
||||||
|
|
||||||
|
mMutedLabel.setFont(mFont);
|
||||||
|
mMutedLabel.setForeground(Color.RED);
|
||||||
|
add(mMutedLabel);
|
||||||
|
|
||||||
|
mFromLabel.setFont(mFont);
|
||||||
|
if(mAudioOutput != null)
|
||||||
|
{
|
||||||
|
mFromLabel.setForeground(mLabelColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mFromLabel.setForeground(getBackground());
|
||||||
|
}
|
||||||
|
add(mFromLabel);
|
||||||
|
|
||||||
|
mFrom.setFont(mFont);
|
||||||
|
mFrom.setForeground(mLabelColor);
|
||||||
|
add(mFrom);
|
||||||
|
|
||||||
|
mFromAlias.setFont(mFont);
|
||||||
|
mFromAlias.setForeground(mLabelColor);
|
||||||
|
add(mFromAlias, "wrap");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final AudioEvent audioEvent)
|
||||||
|
{
|
||||||
|
switch(audioEvent.getType())
|
||||||
|
{
|
||||||
|
case AUDIO_STOPPED:
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
resetLabels();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case AUDIO_MUTED:
|
||||||
|
case AUDIO_UNMUTED:
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
mMutedLabel.setText(mAudioOutput.isMuted() ? "M" : " ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the from and to labels. Note: this does not happen on the swing
|
||||||
|
* event thread. Only invoke from the swing thread.
|
||||||
|
*/
|
||||||
|
private void resetLabels()
|
||||||
|
{
|
||||||
|
mFrom.setText("");
|
||||||
|
updateAlias(mFromAlias, null);
|
||||||
|
|
||||||
|
mTo.setText("");
|
||||||
|
updateAlias(mToAlias, null);
|
||||||
|
|
||||||
|
mConfigured = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the alias label with text and icon from the alias. Note: this
|
||||||
|
* does not occur on the Swing event thread -- wrap any calls to this
|
||||||
|
* method with an event thread call.
|
||||||
|
*/
|
||||||
|
private void updateAlias(JLabel label, Alias alias)
|
||||||
|
{
|
||||||
|
if(alias != null)
|
||||||
|
{
|
||||||
|
label.setText(alias.getName());
|
||||||
|
|
||||||
|
String icon = alias.getIconName();
|
||||||
|
|
||||||
|
if(icon != null)
|
||||||
|
{
|
||||||
|
label.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label.setIcon(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label.setText("");
|
||||||
|
label.setIcon(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes audio metadata to update this panel's display values
|
||||||
|
*/
|
||||||
|
public class AudioMetadataProcessor implements Listener<AudioMetadata>
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void receive(AudioMetadata audioMetadata)
|
||||||
|
{
|
||||||
|
if(!mConfigured || audioMetadata.isUpdated())
|
||||||
|
{
|
||||||
|
final Metadata from = audioMetadata.getMetadata(MetadataType.FROM);
|
||||||
|
|
||||||
|
final Metadata to = audioMetadata.getMetadata(MetadataType.TO);
|
||||||
|
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if(from != null)
|
||||||
|
{
|
||||||
|
mFrom.setText(from.getValue());
|
||||||
|
updateAlias(mFromAlias, from.getAlias());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mFrom.setText("-----");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(to != null)
|
||||||
|
{
|
||||||
|
mTo.setText(to.getValue());
|
||||||
|
updateAlias(mToAlias, to.getAlias());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mTo.setText("-----");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mConfigured = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settingChanged(Setting setting)
|
||||||
|
{
|
||||||
|
if(setting instanceof ColorSetting)
|
||||||
|
{
|
||||||
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
|
switch(colorSetting.getColorSettingName())
|
||||||
|
{
|
||||||
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
|
if(mFrom != null)
|
||||||
|
{
|
||||||
|
mFrom.setForeground(mLabelColor);
|
||||||
|
}
|
||||||
|
if(mFromAlias != null)
|
||||||
|
{
|
||||||
|
mFromAlias.setForeground(mLabelColor);
|
||||||
|
}
|
||||||
|
if(mTo != null)
|
||||||
|
{
|
||||||
|
mTo.setForeground(mLabelColor);
|
||||||
|
}
|
||||||
|
if(mToAlias != null)
|
||||||
|
{
|
||||||
|
mToAlias.setForeground(mLabelColor);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CHANNEL_STATE_LABEL_DETAILS:
|
||||||
|
if(mFromLabel != null)
|
||||||
|
{
|
||||||
|
mFromLabel.setForeground(mDetailsColor);
|
||||||
|
}
|
||||||
|
if(mToLabel != null)
|
||||||
|
{
|
||||||
|
mToLabel.setForeground(mDetailsColor);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settingDeleted(Setting setting)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,51 +1,67 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* sdrtrunk
|
||||||
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
package audio;
|
package audio;
|
||||||
|
|
||||||
import java.awt.Color;
|
import audio.output.AudioOutput;
|
||||||
import java.util.List;
|
import icon.IconManager;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JSeparator;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import audio.output.AudioOutput;
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class AudioChannelsPanel extends JPanel
|
public class AudioChannelsPanel extends JPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public AudioChannelsPanel( SettingsManager settingsManager,
|
public AudioChannelsPanel(IconManager iconManager, SettingsManager settingsManager, IAudioController controller)
|
||||||
IAudioController controller )
|
{
|
||||||
{
|
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]"));
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]") );
|
|
||||||
|
|
||||||
setBackground( Color.BLACK );
|
|
||||||
|
|
||||||
List<AudioOutput> outputs = controller.getAudioOutputs();
|
setBackground(Color.BLACK);
|
||||||
|
|
||||||
for( int x = 0; x < outputs.size(); x++ )
|
List<AudioOutput> outputs = controller.getAudioOutputs();
|
||||||
{
|
|
||||||
add( new AudioChannelPanel( settingsManager, outputs.get( x ) ), "wrap" );
|
for(int x = 0; x < outputs.size(); x++)
|
||||||
|
{
|
||||||
if( x < outputs.size() - 1 )
|
add(new AudioChannelPanel(iconManager, settingsManager, outputs.get(x)), "wrap");
|
||||||
{
|
|
||||||
addSeparator();
|
if(x < outputs.size() - 1)
|
||||||
}
|
{
|
||||||
}
|
addSeparator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Add an empty channel panel so that the panel is sized appropriately
|
/* Add an empty channel panel so that the panel is sized appropriately
|
||||||
* for either a single channel or two channels */
|
* for either a single channel or two channels */
|
||||||
if( outputs.size() == 1 )
|
if(outputs.size() == 1)
|
||||||
{
|
{
|
||||||
addSeparator();
|
addSeparator();
|
||||||
add( new AudioChannelPanel( settingsManager, null ), "wrap" );
|
add(new AudioChannelPanel(iconManager, settingsManager, null), "wrap");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSeparator()
|
private void addSeparator()
|
||||||
{
|
{
|
||||||
JSeparator separator = new JSeparator( JSeparator.HORIZONTAL );
|
JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
|
||||||
separator.setBackground( Color.DARK_GRAY );
|
separator.setBackground(Color.DARK_GRAY);
|
||||||
add( separator, "span,growx" );
|
add(separator, "span,growx");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,382 +1,411 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* sdrtrunk
|
||||||
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
package audio;
|
package audio;
|
||||||
|
|
||||||
import java.awt.Color;
|
import audio.output.AudioOutput;
|
||||||
import java.awt.EventQueue;
|
import icon.IconManager;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sample.Listener;
|
||||||
|
import settings.SettingsManager;
|
||||||
|
import source.SourceManager;
|
||||||
|
import source.mixer.MixerChannelConfiguration;
|
||||||
|
|
||||||
|
import javax.sound.sampled.FloatControl;
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.event.ChangeEvent;
|
||||||
|
import javax.swing.event.ChangeListener;
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
|
|
||||||
import javax.sound.sampled.FloatControl;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
import javax.swing.JSlider;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import sample.Listener;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
import source.SourceManager;
|
|
||||||
import source.mixer.MixerChannelConfiguration;
|
|
||||||
import audio.output.AudioOutput;
|
|
||||||
|
|
||||||
public class AudioPanel extends JPanel implements Listener<AudioEvent>
|
public class AudioPanel extends JPanel implements Listener<AudioEvent>
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private static final Logger mLog = LoggerFactory.getLogger( AudioPanel.class );
|
|
||||||
|
|
||||||
private static ImageIcon MUTED_ICON = SettingsManager.getScaledIcon(
|
|
||||||
new ImageIcon( "images/audio_muted.png" ), 38 );
|
|
||||||
private static ImageIcon UNMUTED_ICON = SettingsManager.getScaledIcon(
|
|
||||||
new ImageIcon( "images/audio_unmuted.png" ), 38 );
|
|
||||||
|
|
||||||
private SettingsManager mSettingsManager;
|
private static final Logger mLog = LoggerFactory.getLogger(AudioPanel.class);
|
||||||
private SourceManager mSourceManager;
|
|
||||||
private IAudioController mController;
|
|
||||||
|
|
||||||
private JButton mMuteButton;
|
private static ImageIcon MUTED_ICON = IconManager.getScaledIcon(
|
||||||
private AudioChannelsPanel mAudioChannelsPanel;
|
new ImageIcon("images/audio_muted.png"), 38);
|
||||||
|
private static ImageIcon UNMUTED_ICON = IconManager.getScaledIcon(
|
||||||
public AudioPanel( SettingsManager settingsManager,
|
new ImageIcon("images/audio_unmuted.png"), 38);
|
||||||
SourceManager sourceManager,
|
|
||||||
IAudioController controller )
|
|
||||||
{
|
|
||||||
mSettingsManager = settingsManager;
|
|
||||||
mSourceManager = sourceManager;
|
|
||||||
mController = controller;
|
|
||||||
|
|
||||||
mController.addControllerListener( this );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[]0[grow,fill]", "[fill]0[]") );
|
|
||||||
setBackground( Color.BLACK );
|
|
||||||
|
|
||||||
mMuteButton = new MuteButton();
|
private IconManager mIconManager;
|
||||||
mMuteButton.setBackground( getBackground() );
|
private SettingsManager mSettingsManager;
|
||||||
add( mMuteButton );
|
private SourceManager mSourceManager;
|
||||||
|
private IAudioController mController;
|
||||||
mAudioChannelsPanel = new AudioChannelsPanel( mSettingsManager, mController );
|
|
||||||
|
|
||||||
add( mAudioChannelsPanel );
|
|
||||||
|
|
||||||
addMouseListener( new MouseSelectionListener() );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( AudioEvent event )
|
|
||||||
{
|
|
||||||
switch( event.getType() )
|
|
||||||
{
|
|
||||||
case AUDIO_CONFIGURATION_CHANGE_STARTED:
|
|
||||||
break;
|
|
||||||
case AUDIO_CONFIGURATION_CHANGE_COMPLETE:
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
remove( mAudioChannelsPanel );
|
|
||||||
|
|
||||||
mAudioChannelsPanel = new AudioChannelsPanel(
|
private JButton mMuteButton;
|
||||||
mSettingsManager, mController );
|
private AudioChannelsPanel mAudioChannelsPanel;
|
||||||
|
|
||||||
add( mAudioChannelsPanel );
|
|
||||||
|
|
||||||
mAudioChannelsPanel.repaint();
|
public AudioPanel(IconManager iconManager, SettingsManager settingsManager, SourceManager sourceManager,
|
||||||
|
IAudioController controller)
|
||||||
|
{
|
||||||
|
mIconManager = iconManager;
|
||||||
|
mSettingsManager = settingsManager;
|
||||||
|
mSourceManager = sourceManager;
|
||||||
|
mController = controller;
|
||||||
|
|
||||||
revalidate();
|
mController.addControllerListener(this);
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
init();
|
||||||
* Audio output mute control menu item.
|
}
|
||||||
*/
|
|
||||||
public class AudioOutputMuteItem extends JMenuItem
|
private void init()
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
setLayout(new MigLayout("insets 0 0 0 0", "[]0[grow,fill]", "[fill]0[]"));
|
||||||
|
setBackground(Color.BLACK);
|
||||||
private AudioOutput mAudioOutput;
|
|
||||||
|
mMuteButton = new MuteButton();
|
||||||
public AudioOutputMuteItem( AudioOutput audioOutput )
|
mMuteButton.setBackground(getBackground());
|
||||||
{
|
add(mMuteButton);
|
||||||
super( audioOutput.isMuted() ? "Unmute" : "Mute" );
|
|
||||||
|
mAudioChannelsPanel = new AudioChannelsPanel(mIconManager, mSettingsManager, mController);
|
||||||
mAudioOutput = audioOutput;
|
|
||||||
|
add(mAudioChannelsPanel);
|
||||||
addActionListener( new ActionListener()
|
|
||||||
{
|
addMouseListener(new MouseSelectionListener());
|
||||||
@Override
|
}
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
@Override
|
||||||
mAudioOutput.setMuted( !mAudioOutput.isMuted() );
|
public void receive(AudioEvent event)
|
||||||
}
|
{
|
||||||
} );
|
switch(event.getType())
|
||||||
}
|
{
|
||||||
}
|
case AUDIO_CONFIGURATION_CHANGE_STARTED:
|
||||||
|
break;
|
||||||
/**
|
case AUDIO_CONFIGURATION_CHANGE_COMPLETE:
|
||||||
* Mouse listener
|
EventQueue.invokeLater(new Runnable()
|
||||||
*/
|
{
|
||||||
public class MouseSelectionListener implements MouseListener
|
@Override
|
||||||
{
|
public void run()
|
||||||
@Override
|
{
|
||||||
public void mouseClicked( MouseEvent event )
|
remove(mAudioChannelsPanel);
|
||||||
{
|
|
||||||
if( SwingUtilities.isRightMouseButton( event ) )
|
mAudioChannelsPanel = new AudioChannelsPanel(mIconManager, mSettingsManager, mController);
|
||||||
{
|
|
||||||
JPopupMenu popup = new JPopupMenu();
|
add(mAudioChannelsPanel);
|
||||||
|
|
||||||
|
mAudioChannelsPanel.repaint();
|
||||||
|
|
||||||
|
revalidate();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Audio output mute control menu item.
|
||||||
|
*/
|
||||||
|
public class AudioOutputMuteItem extends JMenuItem
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private AudioOutput mAudioOutput;
|
||||||
|
|
||||||
|
public AudioOutputMuteItem(AudioOutput audioOutput)
|
||||||
|
{
|
||||||
|
super(audioOutput.isMuted() ? "Unmute" : "Mute");
|
||||||
|
|
||||||
|
mAudioOutput = audioOutput;
|
||||||
|
|
||||||
|
addActionListener(new ActionListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e)
|
||||||
|
{
|
||||||
|
mAudioOutput.setMuted(!mAudioOutput.isMuted());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mouse listener
|
||||||
|
*/
|
||||||
|
public class MouseSelectionListener implements MouseListener
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent event)
|
||||||
|
{
|
||||||
|
if(SwingUtilities.isRightMouseButton(event))
|
||||||
|
{
|
||||||
|
JPopupMenu popup = new JPopupMenu();
|
||||||
|
|
||||||
/* Audio mixer/output selection menus */
|
/* Audio mixer/output selection menus */
|
||||||
JMenu outputMenu = new JMenu( "Audio Output" );
|
JMenu outputMenu = new JMenu("Audio Output");
|
||||||
|
|
||||||
MixerChannelConfiguration[] mixerConfigurations =
|
MixerChannelConfiguration[] mixerConfigurations =
|
||||||
mSourceManager.getMixerManager().getOutputMixers();
|
mSourceManager.getMixerManager().getOutputMixers();
|
||||||
|
|
||||||
for( MixerChannelConfiguration mixerConfig: mixerConfigurations )
|
for(MixerChannelConfiguration mixerConfig : mixerConfigurations)
|
||||||
{
|
{
|
||||||
MixerSelectionItem mixerItem = new MixerSelectionItem( mixerConfig );
|
MixerSelectionItem mixerItem = new MixerSelectionItem(mixerConfig);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
MixerChannelConfiguration current = mController.getMixerChannelConfiguration();
|
|
||||||
|
|
||||||
if( current != null && current.equals( mixerConfig ) )
|
try
|
||||||
{
|
{
|
||||||
mixerItem.setSelected( true );
|
MixerChannelConfiguration current = mController.getMixerChannelConfiguration();
|
||||||
}
|
|
||||||
}
|
if(current != null && current.equals(mixerConfig))
|
||||||
catch( AudioException e )
|
{
|
||||||
{
|
mixerItem.setSelected(true);
|
||||||
mLog.error( "Error while detecting current mixer "
|
}
|
||||||
+ "channel configuration", e );
|
}
|
||||||
}
|
catch(AudioException e)
|
||||||
|
{
|
||||||
outputMenu.add( mixerItem );
|
mLog.error("Error while detecting current mixer "
|
||||||
}
|
+ "channel configuration", e);
|
||||||
|
}
|
||||||
popup.add( outputMenu );
|
|
||||||
|
outputMenu.add(mixerItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
popup.add(outputMenu);
|
||||||
|
|
||||||
/* Audio output mute and volume control */
|
/* Audio output mute and volume control */
|
||||||
for( AudioOutput output: mController.getAudioOutputs() )
|
for(AudioOutput output : mController.getAudioOutputs())
|
||||||
{
|
{
|
||||||
JMenu menu = new JMenu( "Channel: " + output.getChannelName() );
|
JMenu menu = new JMenu("Channel: " + output.getChannelName());
|
||||||
|
|
||||||
menu.add( new AudioOutputMuteItem( output ) );
|
|
||||||
|
|
||||||
if( output.hasGainControl() )
|
|
||||||
{
|
|
||||||
JMenu volume = new JMenu( "Volume" );
|
|
||||||
volume.add( new VolumeSlider( output.getGainControl() ) );
|
|
||||||
menu.add( volume );
|
|
||||||
}
|
|
||||||
|
|
||||||
popup.add( menu );
|
|
||||||
}
|
|
||||||
|
|
||||||
popup.show( event.getComponent(), event.getX(), event.getY() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
menu.add(new AudioOutputMuteItem(output));
|
||||||
public void mousePressed( MouseEvent e ) {}
|
|
||||||
@Override
|
|
||||||
public void mouseReleased( MouseEvent e ) {}
|
|
||||||
@Override
|
|
||||||
public void mouseEntered( MouseEvent e ) {}
|
|
||||||
@Override
|
|
||||||
public void mouseExited( MouseEvent e ) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Audio volume (gain) adjustment slider control
|
|
||||||
*/
|
|
||||||
public class VolumeSlider extends JSlider
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private FloatControl mFloatControl;
|
|
||||||
|
|
||||||
public VolumeSlider( FloatControl control )
|
|
||||||
{
|
|
||||||
super( 0, 100, 0 );
|
|
||||||
|
|
||||||
setMajorTickSpacing( 25 );
|
|
||||||
setMinorTickSpacing( 5 );
|
|
||||||
setPaintTicks( true );
|
|
||||||
setPaintLabels( true );
|
|
||||||
|
|
||||||
mFloatControl = control;
|
if(output.hasGainControl())
|
||||||
|
{
|
||||||
setValue( getIntegerValue( mFloatControl.getValue() ) );
|
JMenu volume = new JMenu("Volume");
|
||||||
|
volume.add(new VolumeSlider(output.getGainControl()));
|
||||||
addChangeListener( new ChangeListener()
|
menu.add(volume);
|
||||||
{
|
}
|
||||||
@Override
|
|
||||||
public void stateChanged( ChangeEvent event )
|
|
||||||
{
|
|
||||||
mFloatControl.shift( mFloatControl.getValue(),
|
|
||||||
getFloatValue( VolumeSlider.this.getValue() ),
|
|
||||||
1000 );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
addMouseListener( new MouseListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void mouseClicked( MouseEvent event )
|
|
||||||
{
|
|
||||||
if( event.getClickCount() == 2 )
|
|
||||||
{
|
|
||||||
VolumeSlider.this.setValue( 50 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mouseReleased( MouseEvent arg0 ) {}
|
|
||||||
public void mousePressed( MouseEvent arg0 ) {}
|
|
||||||
public void mouseExited( MouseEvent arg0 ) {}
|
|
||||||
public void mouseEntered( MouseEvent arg0 ) {}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
popup.add(menu);
|
||||||
* Converts the integer value to a floating point value to use in the
|
}
|
||||||
* float control. Assumes an integer value of 50 is the 0.0 dB mid
|
|
||||||
* point (ie no gain ) value.
|
|
||||||
*/
|
|
||||||
private int getIntegerValue( float value )
|
|
||||||
{
|
|
||||||
if( value == 0.0f )
|
|
||||||
{
|
|
||||||
return 50;
|
|
||||||
}
|
|
||||||
else if( value < 0.0f )
|
|
||||||
{
|
|
||||||
float ratio = value / mFloatControl.getMinimum();
|
|
||||||
|
|
||||||
return 50 - (int)( ratio * 50.0f );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float ratio = value / mFloatControl.getMaximum();
|
|
||||||
|
|
||||||
return 50 + (int)( ratio * 50.0f );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private float getFloatValue( int value )
|
|
||||||
{
|
|
||||||
if( value == 50 )
|
|
||||||
{
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
else if( value < 50 )
|
|
||||||
{
|
|
||||||
return (float)( 50 - value ) / 50.0f * mFloatControl.getMinimum();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (float)( value - 50 ) / 50.0f * mFloatControl.getMaximum();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mixer/Channel configuration selection item
|
|
||||||
*/
|
|
||||||
public class MixerSelectionItem extends JMenuItem
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private MixerChannelConfiguration mConfiguration;
|
popup.show(event.getComponent(), event.getX(), event.getY());
|
||||||
|
}
|
||||||
public MixerSelectionItem( MixerChannelConfiguration config )
|
}
|
||||||
{
|
|
||||||
super( config.toString() );
|
|
||||||
|
|
||||||
mConfiguration = config;
|
|
||||||
|
|
||||||
addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mController.setMixerChannelConfiguration( mConfiguration );
|
|
||||||
}
|
|
||||||
catch ( AudioException e1 )
|
|
||||||
{
|
|
||||||
mLog.error( "Couldn't set mixer channel configuration "
|
|
||||||
+ "to: " + mConfiguration.toString() );
|
|
||||||
|
|
||||||
JOptionPane.showMessageDialog( MixerSelectionItem.this,
|
|
||||||
"Couldn't set [" + mConfiguration.toString() +
|
|
||||||
"] as the audio output device" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Mute button to mute all audio output channels exposed by the audio
|
public void mousePressed(MouseEvent e)
|
||||||
* controller
|
{
|
||||||
*/
|
}
|
||||||
public class MuteButton extends JButton
|
|
||||||
{
|
@Override
|
||||||
private static final long serialVersionUID = 1L;
|
public void mouseReleased(MouseEvent e)
|
||||||
|
{
|
||||||
private boolean mMuted = false;
|
}
|
||||||
|
|
||||||
public MuteButton()
|
@Override
|
||||||
{
|
public void mouseEntered(MouseEvent e)
|
||||||
setIcon( UNMUTED_ICON );
|
{
|
||||||
setBorderPainted( false );
|
}
|
||||||
|
|
||||||
addActionListener( new ActionListener()
|
@Override
|
||||||
{
|
public void mouseExited(MouseEvent e)
|
||||||
@Override
|
{
|
||||||
public void actionPerformed( ActionEvent e )
|
}
|
||||||
{
|
}
|
||||||
mMuted = !mMuted;
|
|
||||||
|
/**
|
||||||
for( AudioOutput output: mController.getAudioOutputs() )
|
* Audio volume (gain) adjustment slider control
|
||||||
{
|
*/
|
||||||
output.setMuted( mMuted );
|
public class VolumeSlider extends JSlider
|
||||||
}
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
private FloatControl mFloatControl;
|
||||||
@Override
|
|
||||||
public void run()
|
public VolumeSlider(FloatControl control)
|
||||||
{
|
{
|
||||||
setIcon( mMuted ? MUTED_ICON : UNMUTED_ICON );
|
super(0, 100, 0);
|
||||||
}
|
|
||||||
} );
|
setMajorTickSpacing(25);
|
||||||
}
|
setMinorTickSpacing(5);
|
||||||
} );
|
setPaintTicks(true);
|
||||||
}
|
setPaintLabels(true);
|
||||||
}
|
|
||||||
|
mFloatControl = control;
|
||||||
|
|
||||||
|
setValue(getIntegerValue(mFloatControl.getValue()));
|
||||||
|
|
||||||
|
addChangeListener(new ChangeListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void stateChanged(ChangeEvent event)
|
||||||
|
{
|
||||||
|
mFloatControl.shift(mFloatControl.getValue(),
|
||||||
|
getFloatValue(VolumeSlider.this.getValue()),
|
||||||
|
1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addMouseListener(new MouseListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent event)
|
||||||
|
{
|
||||||
|
if(event.getClickCount() == 2)
|
||||||
|
{
|
||||||
|
VolumeSlider.this.setValue(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mousePressed(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseExited(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseEntered(MouseEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the integer value to a floating point value to use in the
|
||||||
|
* float control. Assumes an integer value of 50 is the 0.0 dB mid
|
||||||
|
* point (ie no gain ) value.
|
||||||
|
*/
|
||||||
|
private int getIntegerValue(float value)
|
||||||
|
{
|
||||||
|
if(value == 0.0f)
|
||||||
|
{
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
else if(value < 0.0f)
|
||||||
|
{
|
||||||
|
float ratio = value / mFloatControl.getMinimum();
|
||||||
|
|
||||||
|
return 50 - (int) (ratio * 50.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float ratio = value / mFloatControl.getMaximum();
|
||||||
|
|
||||||
|
return 50 + (int) (ratio * 50.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getFloatValue(int value)
|
||||||
|
{
|
||||||
|
if(value == 50)
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
else if(value < 50)
|
||||||
|
{
|
||||||
|
return (float) (50 - value) / 50.0f * mFloatControl.getMinimum();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (float) (value - 50) / 50.0f * mFloatControl.getMaximum();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mixer/Channel configuration selection item
|
||||||
|
*/
|
||||||
|
public class MixerSelectionItem extends JMenuItem
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private MixerChannelConfiguration mConfiguration;
|
||||||
|
|
||||||
|
public MixerSelectionItem(MixerChannelConfiguration config)
|
||||||
|
{
|
||||||
|
super(config.toString());
|
||||||
|
|
||||||
|
mConfiguration = config;
|
||||||
|
|
||||||
|
addActionListener(new ActionListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mController.setMixerChannelConfiguration(mConfiguration);
|
||||||
|
}
|
||||||
|
catch(AudioException e1)
|
||||||
|
{
|
||||||
|
mLog.error("Couldn't set mixer channel configuration "
|
||||||
|
+ "to: " + mConfiguration.toString());
|
||||||
|
|
||||||
|
JOptionPane.showMessageDialog(MixerSelectionItem.this,
|
||||||
|
"Couldn't set [" + mConfiguration.toString() +
|
||||||
|
"] as the audio output device");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mute button to mute all audio output channels exposed by the audio
|
||||||
|
* controller
|
||||||
|
*/
|
||||||
|
public class MuteButton extends JButton
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private boolean mMuted = false;
|
||||||
|
|
||||||
|
public MuteButton()
|
||||||
|
{
|
||||||
|
setIcon(UNMUTED_ICON);
|
||||||
|
setBorderPainted(false);
|
||||||
|
|
||||||
|
addActionListener(new ActionListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e)
|
||||||
|
{
|
||||||
|
mMuted = !mMuted;
|
||||||
|
|
||||||
|
for(AudioOutput output : mController.getAudioOutputs())
|
||||||
|
{
|
||||||
|
output.setMuted(mMuted);
|
||||||
|
}
|
||||||
|
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
setIcon(mMuted ? MUTED_ICON : UNMUTED_ICON);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,24 +19,22 @@
|
|||||||
package audio.broadcast;
|
package audio.broadcast;
|
||||||
|
|
||||||
import alias.AliasModel;
|
import alias.AliasModel;
|
||||||
import audio.broadcast.broadcastify.BroadcastifyConfiguration;
|
|
||||||
import audio.broadcast.broadcastify.BroadcastifyConfigurationEditor;
|
|
||||||
import gui.editor.DocumentListenerEditor;
|
import gui.editor.DocumentListenerEditor;
|
||||||
import settings.SettingsManager;
|
import icon.IconManager;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
public abstract class BroadcastConfigurationEditor extends DocumentListenerEditor<BroadcastConfiguration>
|
public abstract class BroadcastConfigurationEditor extends DocumentListenerEditor<BroadcastConfiguration>
|
||||||
{
|
{
|
||||||
protected SettingsManager mSettingsManager;
|
protected IconManager mIconManager;
|
||||||
protected BroadcastModel mBroadcastModel;
|
protected BroadcastModel mBroadcastModel;
|
||||||
protected AliasModel mAliasModel;
|
protected AliasModel mAliasModel;
|
||||||
|
|
||||||
public BroadcastConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel, SettingsManager settingsManager)
|
public BroadcastConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel, IconManager iconManager)
|
||||||
{
|
{
|
||||||
mBroadcastModel = broadcastModel;
|
mBroadcastModel = broadcastModel;
|
||||||
mAliasModel = aliasModel;
|
mAliasModel = aliasModel;
|
||||||
mSettingsManager = settingsManager;
|
mIconManager = iconManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import audio.convert.MP3SilenceGenerator;
|
|||||||
import controller.ThreadPoolManager;
|
import controller.ThreadPoolManager;
|
||||||
import gui.editor.Editor;
|
import gui.editor.Editor;
|
||||||
import gui.editor.EmptyEditor;
|
import gui.editor.EmptyEditor;
|
||||||
|
import icon.IconManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import record.AudioRecorder;
|
import record.AudioRecorder;
|
||||||
@@ -155,26 +156,26 @@ public class BroadcastFactory
|
|||||||
public static Editor<BroadcastConfiguration> getEditor(BroadcastConfiguration configuration,
|
public static Editor<BroadcastConfiguration> getEditor(BroadcastConfiguration configuration,
|
||||||
BroadcastModel broadcastModel,
|
BroadcastModel broadcastModel,
|
||||||
AliasModel aliasModel,
|
AliasModel aliasModel,
|
||||||
SettingsManager settingsManager)
|
IconManager iconManager)
|
||||||
{
|
{
|
||||||
Editor<BroadcastConfiguration> editor;
|
Editor<BroadcastConfiguration> editor;
|
||||||
|
|
||||||
switch (configuration.getBroadcastServerType())
|
switch (configuration.getBroadcastServerType())
|
||||||
{
|
{
|
||||||
case BROADCASTIFY:
|
case BROADCASTIFY:
|
||||||
editor = new BroadcastifyConfigurationEditor(broadcastModel, aliasModel, settingsManager);
|
editor = new BroadcastifyConfigurationEditor(broadcastModel, aliasModel, iconManager);
|
||||||
break;
|
break;
|
||||||
case ICECAST_TCP:
|
case ICECAST_TCP:
|
||||||
editor = new IcecastTCPConfigurationEditor(broadcastModel, aliasModel, settingsManager);
|
editor = new IcecastTCPConfigurationEditor(broadcastModel, aliasModel, iconManager);
|
||||||
break;
|
break;
|
||||||
case ICECAST_HTTP:
|
case ICECAST_HTTP:
|
||||||
editor = new IcecastHTTPConfigurationEditor(broadcastModel, aliasModel, settingsManager);
|
editor = new IcecastHTTPConfigurationEditor(broadcastModel, aliasModel, iconManager);
|
||||||
break;
|
break;
|
||||||
case SHOUTCAST_V1:
|
case SHOUTCAST_V1:
|
||||||
editor = new ShoutcastV1ConfigurationEditor(broadcastModel, aliasModel, settingsManager);
|
editor = new ShoutcastV1ConfigurationEditor(broadcastModel, aliasModel, iconManager);
|
||||||
break;
|
break;
|
||||||
case SHOUTCAST_V2:
|
case SHOUTCAST_V2:
|
||||||
editor = new ShoutcastV2ConfigurationEditor(broadcastModel, aliasModel, settingsManager);
|
editor = new ShoutcastV2ConfigurationEditor(broadcastModel, aliasModel, iconManager);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
editor = new EmptyEditor<BroadcastConfiguration>();
|
editor = new EmptyEditor<BroadcastConfiguration>();
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ import alias.id.broadcast.BroadcastChannel;
|
|||||||
import audio.AudioPacket;
|
import audio.AudioPacket;
|
||||||
import audio.metadata.AudioMetadata;
|
import audio.metadata.AudioMetadata;
|
||||||
import controller.ThreadPoolManager;
|
import controller.ThreadPoolManager;
|
||||||
|
import icon.IconManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import properties.SystemProperties;
|
import properties.SystemProperties;
|
||||||
import sample.Broadcaster;
|
import sample.Broadcaster;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
@@ -67,17 +67,17 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
private Map<String,BroadcastConfiguration> mBroadcastConfigurationMap = new HashMap<>();
|
private Map<String,BroadcastConfiguration> mBroadcastConfigurationMap = new HashMap<>();
|
||||||
private Map<String,AudioBroadcaster> mBroadcasterMap = new HashMap<>();
|
private Map<String,AudioBroadcaster> mBroadcasterMap = new HashMap<>();
|
||||||
private ThreadPoolManager mThreadPoolManager;
|
private ThreadPoolManager mThreadPoolManager;
|
||||||
private SettingsManager mSettingsManager;
|
private IconManager mIconManager;
|
||||||
private StreamManager mStreamManager;
|
private StreamManager mStreamManager;
|
||||||
private Broadcaster<BroadcastEvent> mBroadcastEventBroadcaster = new Broadcaster<>();
|
private Broadcaster<BroadcastEvent> mBroadcastEventBroadcaster = new Broadcaster<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for managing Broadcast configurations and any associated broadcaster instances.
|
* Model for managing Broadcast configurations and any associated broadcaster instances.
|
||||||
*/
|
*/
|
||||||
public BroadcastModel(ThreadPoolManager threadPoolManager, SettingsManager settingsManager)
|
public BroadcastModel(ThreadPoolManager threadPoolManager, IconManager iconManager)
|
||||||
{
|
{
|
||||||
mThreadPoolManager = threadPoolManager;
|
mThreadPoolManager = threadPoolManager;
|
||||||
mSettingsManager = settingsManager;
|
mIconManager = iconManager;
|
||||||
mStreamManager = new StreamManager(threadPoolManager, new CompletedRecordingListener(), BroadcastFormat.MP3,
|
mStreamManager = new StreamManager(threadPoolManager, new CompletedRecordingListener(), BroadcastFormat.MP3,
|
||||||
SystemProperties.getInstance().getApplicationFolder(TEMPORARY_STREAM_DIRECTORY));
|
SystemProperties.getInstance().getApplicationFolder(TEMPORARY_STREAM_DIRECTORY));
|
||||||
mStreamManager.start();
|
mStreamManager.start();
|
||||||
@@ -497,11 +497,11 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
|||||||
switch(columnIndex)
|
switch(columnIndex)
|
||||||
{
|
{
|
||||||
case COLUMN_SERVER_ICON:
|
case COLUMN_SERVER_ICON:
|
||||||
String iconName = configuration.getBroadcastServerType().getIconName();
|
String iconPath = configuration.getBroadcastServerType().getIconPath();
|
||||||
|
|
||||||
if(iconName != null && mSettingsManager != null)
|
if(iconPath != null && mIconManager != null)
|
||||||
{
|
{
|
||||||
return mSettingsManager.getImageIcon(iconName, 14);
|
return mIconManager.getScaledIcon(new ImageIcon(iconPath), 14);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case COLUMN_STREAM_NAME:
|
case COLUMN_STREAM_NAME:
|
||||||
|
|||||||
@@ -22,19 +22,16 @@ import alias.AliasModel;
|
|||||||
import com.jidesoft.swing.JideSplitPane;
|
import com.jidesoft.swing.JideSplitPane;
|
||||||
import gui.editor.Editor;
|
import gui.editor.Editor;
|
||||||
import gui.editor.EmptyEditor;
|
import gui.editor.EmptyEditor;
|
||||||
|
import icon.IconManager;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
import javax.swing.event.TableColumnModelEvent;
|
|
||||||
import javax.swing.event.TableColumnModelListener;
|
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
import javax.swing.table.TableCellRenderer;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
@@ -51,7 +48,7 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
|||||||
|
|
||||||
private BroadcastModel mBroadcastModel;
|
private BroadcastModel mBroadcastModel;
|
||||||
private AliasModel mAliasModel;
|
private AliasModel mAliasModel;
|
||||||
private SettingsManager mSettingsManager;
|
private IconManager mIconManager;
|
||||||
|
|
||||||
private JTable mBroadcastConfigurationTable;
|
private JTable mBroadcastConfigurationTable;
|
||||||
private JideSplitPane mSplitPane;
|
private JideSplitPane mSplitPane;
|
||||||
@@ -61,11 +58,11 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
|||||||
private JButton mCopyButton = new JButton(COPY_BROADCAST_CONFIGURATION);
|
private JButton mCopyButton = new JButton(COPY_BROADCAST_CONFIGURATION);
|
||||||
private JButton mDeleteButton = new JButton(DELETE_BROADCAST_CONFIGURATION);
|
private JButton mDeleteButton = new JButton(DELETE_BROADCAST_CONFIGURATION);
|
||||||
|
|
||||||
public BroadcastPanel(BroadcastModel broadcastModel, AliasModel aliasModel, SettingsManager settingManager)
|
public BroadcastPanel(BroadcastModel broadcastModel, AliasModel aliasModel, IconManager iconManager)
|
||||||
{
|
{
|
||||||
mBroadcastModel = broadcastModel;
|
mBroadcastModel = broadcastModel;
|
||||||
mAliasModel = aliasModel;
|
mAliasModel = aliasModel;
|
||||||
mSettingsManager = settingManager;
|
mIconManager = iconManager;
|
||||||
mEditor = mEmptyEditor;
|
mEditor = mEmptyEditor;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
@@ -218,7 +215,7 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
|||||||
if (selectedConfiguration != null)
|
if (selectedConfiguration != null)
|
||||||
{
|
{
|
||||||
mEditor = BroadcastFactory.getEditor(selectedConfiguration, mBroadcastModel, mAliasModel,
|
mEditor = BroadcastFactory.getEditor(selectedConfiguration, mBroadcastModel, mAliasModel,
|
||||||
mSettingsManager);
|
mIconManager);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -239,7 +236,7 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
|||||||
|
|
||||||
public AddBroadcastConfigurationItem(BroadcastServerType type)
|
public AddBroadcastConfigurationItem(BroadcastServerType type)
|
||||||
{
|
{
|
||||||
super(type.toString(), mSettingsManager.getImageIcon(type.getIconName(), 14));
|
super(type.toString(), mIconManager.getScaledIcon(new ImageIcon(type.getIconPath()), 14));
|
||||||
|
|
||||||
mBroadcastServerType = type;
|
mBroadcastServerType = type;
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ public enum BroadcastServerType
|
|||||||
UNKNOWN("Unknown", null);
|
UNKNOWN("Unknown", null);
|
||||||
|
|
||||||
private String mLabel;
|
private String mLabel;
|
||||||
private String mIconName;
|
private String mIconPath;
|
||||||
|
|
||||||
BroadcastServerType(String label, String iconName)
|
BroadcastServerType(String label, String iconPath)
|
||||||
{
|
{
|
||||||
mLabel = label;
|
mLabel = label;
|
||||||
mIconName = iconName;
|
mIconPath = iconPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
@@ -41,8 +41,8 @@ public enum BroadcastServerType
|
|||||||
return mLabel;
|
return mLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIconName()
|
public String getIconPath()
|
||||||
{
|
{
|
||||||
return mIconName;
|
return mIconPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,11 @@ import audio.broadcast.BroadcastEvent;
|
|||||||
import audio.broadcast.BroadcastModel;
|
import audio.broadcast.BroadcastModel;
|
||||||
import audio.broadcast.BroadcastServerType;
|
import audio.broadcast.BroadcastServerType;
|
||||||
import com.radioreference.api.soap2.UserFeedBroadcast;
|
import com.radioreference.api.soap2.UserFeedBroadcast;
|
||||||
import gui.editor.DocumentListenerEditor;
|
import icon.IconManager;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
@@ -41,7 +40,7 @@ import java.awt.event.ActionListener;
|
|||||||
|
|
||||||
public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEditor implements Listener<UserFeedBroadcast>
|
public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEditor implements Listener<UserFeedBroadcast>
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( BroadcastifyConfigurationEditor.class );
|
private final static Logger mLog = LoggerFactory.getLogger(BroadcastifyConfigurationEditor.class);
|
||||||
|
|
||||||
private static final int ONE_MINUTE_MS = 60000;
|
private static final int ONE_MINUTE_MS = 60000;
|
||||||
|
|
||||||
@@ -57,24 +56,24 @@ public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEdito
|
|||||||
private JButton mSaveButton;
|
private JButton mSaveButton;
|
||||||
private JButton mResetButton;
|
private JButton mResetButton;
|
||||||
|
|
||||||
public BroadcastifyConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel,
|
public BroadcastifyConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel, IconManager iconManager)
|
||||||
SettingsManager settingsManager)
|
|
||||||
{
|
{
|
||||||
super(broadcastModel, aliasModel, settingsManager);
|
super(broadcastModel, aliasModel, iconManager);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[align right][grow,fill]",
|
setLayout(new MigLayout("fill,wrap 2", "[align right][grow,fill]",
|
||||||
"[][][][][][][][][][][][][grow,fill]" ) );
|
"[][][][][][][][][][][][][grow,fill]"));
|
||||||
setPreferredSize(new Dimension(150,400));
|
setPreferredSize(new Dimension(150, 400));
|
||||||
|
|
||||||
|
|
||||||
JLabel channelLabel = new JLabel("Broadcastify Stream");
|
JLabel channelLabel = new JLabel("Broadcastify Stream");
|
||||||
|
|
||||||
ImageIcon broadcastifyIcon = mSettingsManager.getImageIcon(BroadcastServerType.BROADCASTIFY.getIconName(), 25);
|
ImageIcon broadcastifyIcon = mIconManager.getScaledIcon(
|
||||||
|
new ImageIcon(BroadcastServerType.BROADCASTIFY.getIconPath()), 25);
|
||||||
channelLabel.setIcon(broadcastifyIcon);
|
channelLabel.setIcon(broadcastifyIcon);
|
||||||
add(channelLabel, "span, align center");
|
add(channelLabel, "span, align center");
|
||||||
|
|
||||||
@@ -143,7 +142,7 @@ public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEdito
|
|||||||
add(mDelayValue);
|
add(mDelayValue);
|
||||||
|
|
||||||
add(new JLabel("Delay:"));
|
add(new JLabel("Delay:"));
|
||||||
mDelay = new JSlider(0,60,0);
|
mDelay = new JSlider(0, 60, 0);
|
||||||
mDelay.setMajorTickSpacing(10);
|
mDelay.setMajorTickSpacing(10);
|
||||||
mDelay.setMinorTickSpacing(5);
|
mDelay.setMinorTickSpacing(5);
|
||||||
mDelay.addChangeListener(new ChangeListener()
|
mDelay.addChangeListener(new ChangeListener()
|
||||||
@@ -215,7 +214,7 @@ public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEdito
|
|||||||
|
|
||||||
if(hasItem())
|
if(hasItem())
|
||||||
{
|
{
|
||||||
BroadcastifyConfiguration config = (BroadcastifyConfiguration)getItem();
|
BroadcastifyConfiguration config = (BroadcastifyConfiguration) getItem();
|
||||||
|
|
||||||
mName.setText(config.getName());
|
mName.setText(config.getName());
|
||||||
mServer.setText(config.getHost());
|
mServer.setText(config.getHost());
|
||||||
@@ -223,7 +222,7 @@ public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEdito
|
|||||||
mMountPoint.setText(config.getMountPoint());
|
mMountPoint.setText(config.getMountPoint());
|
||||||
mPassword.setText(config.getPassword());
|
mPassword.setText(config.getPassword());
|
||||||
mFeedID.setText(String.valueOf(config.getFeedID()));
|
mFeedID.setText(String.valueOf(config.getFeedID()));
|
||||||
mDelay.setValue((int)(config.getDelay() / ONE_MINUTE_MS));
|
mDelay.setValue((int) (config.getDelay() / ONE_MINUTE_MS));
|
||||||
mEnabled.setSelected(config.isEnabled());
|
mEnabled.setSelected(config.isEnabled());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -244,7 +243,7 @@ public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEdito
|
|||||||
@Override
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
BroadcastifyConfiguration config = (BroadcastifyConfiguration)getItem();
|
BroadcastifyConfiguration config = (BroadcastifyConfiguration) getItem();
|
||||||
|
|
||||||
if(validateConfiguration())
|
if(validateConfiguration())
|
||||||
{
|
{
|
||||||
@@ -274,11 +273,11 @@ public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEdito
|
|||||||
if(!mBroadcastModel.isUniqueName(name, getItem()))
|
if(!mBroadcastModel.isUniqueName(name, getItem()))
|
||||||
{
|
{
|
||||||
String message = (name == null || name.isEmpty()) ?
|
String message = (name == null || name.isEmpty()) ?
|
||||||
"Please specify a stream name." : "Stream name " + name +
|
"Please specify a stream name." : "Stream name " + name +
|
||||||
"is already in use.\nPlease choose another name.";
|
"is already in use.\nPlease choose another name.";
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(BroadcastifyConfigurationEditor.this,
|
JOptionPane.showMessageDialog(BroadcastifyConfigurationEditor.this,
|
||||||
message, "Invalid Stream Name", JOptionPane.ERROR_MESSAGE);
|
message, "Invalid Stream Name", JOptionPane.ERROR_MESSAGE);
|
||||||
|
|
||||||
mName.requestFocus();
|
mName.requestFocus();
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import audio.broadcast.BroadcastConfigurationEditor;
|
|||||||
import audio.broadcast.BroadcastEvent;
|
import audio.broadcast.BroadcastEvent;
|
||||||
import audio.broadcast.BroadcastModel;
|
import audio.broadcast.BroadcastModel;
|
||||||
import audio.broadcast.BroadcastServerType;
|
import audio.broadcast.BroadcastServerType;
|
||||||
|
import icon.IconManager;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -57,10 +58,9 @@ public class IcecastHTTPConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
private JButton mSaveButton;
|
private JButton mSaveButton;
|
||||||
private JButton mResetButton;
|
private JButton mResetButton;
|
||||||
|
|
||||||
public IcecastHTTPConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel,
|
public IcecastHTTPConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel, IconManager iconManager)
|
||||||
SettingsManager settingsManager)
|
|
||||||
{
|
{
|
||||||
super(broadcastModel, aliasModel, settingsManager);
|
super(broadcastModel, aliasModel, iconManager);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ public class IcecastHTTPConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
|
|
||||||
JLabel channelLabel = new JLabel("Icecast 2 (v2.4+) Stream");
|
JLabel channelLabel = new JLabel("Icecast 2 (v2.4+) Stream");
|
||||||
|
|
||||||
ImageIcon icon = mSettingsManager.getImageIcon(BroadcastServerType.ICECAST_HTTP.getIconName(), 25);
|
ImageIcon icon = mIconManager.getScaledIcon(new ImageIcon(BroadcastServerType.ICECAST_HTTP.getIconPath()), 25);
|
||||||
channelLabel.setIcon(icon);
|
channelLabel.setIcon(icon);
|
||||||
|
|
||||||
add(channelLabel, "span, align center");
|
add(channelLabel, "span, align center");
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ import audio.broadcast.BroadcastConfigurationEditor;
|
|||||||
import audio.broadcast.BroadcastEvent;
|
import audio.broadcast.BroadcastEvent;
|
||||||
import audio.broadcast.BroadcastModel;
|
import audio.broadcast.BroadcastModel;
|
||||||
import audio.broadcast.BroadcastServerType;
|
import audio.broadcast.BroadcastServerType;
|
||||||
import audio.broadcast.broadcastify.BroadcastifyConfiguration;
|
import icon.IconManager;
|
||||||
import gui.editor.DocumentListenerEditor;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -58,10 +57,9 @@ public class IcecastTCPConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
private JButton mSaveButton;
|
private JButton mSaveButton;
|
||||||
private JButton mResetButton;
|
private JButton mResetButton;
|
||||||
|
|
||||||
public IcecastTCPConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel,
|
public IcecastTCPConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel, IconManager iconManager)
|
||||||
SettingsManager settingsManager)
|
|
||||||
{
|
{
|
||||||
super(broadcastModel, aliasModel, settingsManager);
|
super(broadcastModel, aliasModel, iconManager);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +71,7 @@ public class IcecastTCPConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
|
|
||||||
JLabel channelLabel = new JLabel("Icecast (v2.3) Stream");
|
JLabel channelLabel = new JLabel("Icecast (v2.3) Stream");
|
||||||
|
|
||||||
ImageIcon icon = mSettingsManager.getImageIcon(BroadcastServerType.ICECAST_TCP.getIconName(), 25);
|
ImageIcon icon = mIconManager.getScaledIcon(new ImageIcon(BroadcastServerType.ICECAST_TCP.getIconPath()), 25);
|
||||||
channelLabel.setIcon(icon);
|
channelLabel.setIcon(icon);
|
||||||
|
|
||||||
add(channelLabel, "span, align center");
|
add(channelLabel, "span, align center");
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ import audio.broadcast.BroadcastConfigurationEditor;
|
|||||||
import audio.broadcast.BroadcastEvent;
|
import audio.broadcast.BroadcastEvent;
|
||||||
import audio.broadcast.BroadcastModel;
|
import audio.broadcast.BroadcastModel;
|
||||||
import audio.broadcast.BroadcastServerType;
|
import audio.broadcast.BroadcastServerType;
|
||||||
|
import icon.IconManager;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
@@ -38,7 +38,7 @@ import java.awt.event.ActionListener;
|
|||||||
|
|
||||||
public class ShoutcastV1ConfigurationEditor extends BroadcastConfigurationEditor
|
public class ShoutcastV1ConfigurationEditor extends BroadcastConfigurationEditor
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( ShoutcastV1ConfigurationEditor.class );
|
private final static Logger mLog = LoggerFactory.getLogger(ShoutcastV1ConfigurationEditor.class);
|
||||||
|
|
||||||
private static final int ONE_MINUTE_MS = 60000;
|
private static final int ONE_MINUTE_MS = 60000;
|
||||||
|
|
||||||
@@ -55,22 +55,21 @@ public class ShoutcastV1ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
private JButton mSaveButton;
|
private JButton mSaveButton;
|
||||||
private JButton mResetButton;
|
private JButton mResetButton;
|
||||||
|
|
||||||
public ShoutcastV1ConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel,
|
public ShoutcastV1ConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel, IconManager iconManager)
|
||||||
SettingsManager settingsManager)
|
|
||||||
{
|
{
|
||||||
super(broadcastModel, aliasModel, settingsManager);
|
super(broadcastModel, aliasModel, iconManager);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[align right][grow,fill]",
|
setLayout(new MigLayout("fill,wrap 2", "[align right][grow,fill]",
|
||||||
"[][][][][][][][][][][][][][grow,fill]" ) );
|
"[][][][][][][][][][][][][][grow,fill]"));
|
||||||
setPreferredSize(new Dimension(150,400));
|
setPreferredSize(new Dimension(150, 400));
|
||||||
|
|
||||||
JLabel channelLabel = new JLabel("Shoutcast (v1.x) Stream");
|
JLabel channelLabel = new JLabel("Shoutcast (v1.x) Stream");
|
||||||
|
|
||||||
ImageIcon icon = mSettingsManager.getImageIcon(BroadcastServerType.SHOUTCAST_V1.getIconName(), 25);
|
ImageIcon icon = mIconManager.getScaledIcon(new ImageIcon(BroadcastServerType.SHOUTCAST_V1.getIconPath()), 25);
|
||||||
channelLabel.setIcon(icon);
|
channelLabel.setIcon(icon);
|
||||||
|
|
||||||
add(channelLabel, "span, align center");
|
add(channelLabel, "span, align center");
|
||||||
@@ -129,7 +128,7 @@ public class ShoutcastV1ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
add(mDelayValue);
|
add(mDelayValue);
|
||||||
|
|
||||||
add(new JLabel("Delay:"));
|
add(new JLabel("Delay:"));
|
||||||
mDelay = new JSlider(0,60,0);
|
mDelay = new JSlider(0, 60, 0);
|
||||||
mDelay.setMajorTickSpacing(10);
|
mDelay.setMajorTickSpacing(10);
|
||||||
mDelay.setMinorTickSpacing(5);
|
mDelay.setMinorTickSpacing(5);
|
||||||
mDelay.addChangeListener(new ChangeListener()
|
mDelay.addChangeListener(new ChangeListener()
|
||||||
@@ -201,7 +200,7 @@ public class ShoutcastV1ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
|
|
||||||
if(hasItem())
|
if(hasItem())
|
||||||
{
|
{
|
||||||
ShoutcastV1Configuration config = (ShoutcastV1Configuration)getItem();
|
ShoutcastV1Configuration config = (ShoutcastV1Configuration) getItem();
|
||||||
|
|
||||||
mName.setText(config.getName());
|
mName.setText(config.getName());
|
||||||
mServer.setText(config.getHost());
|
mServer.setText(config.getHost());
|
||||||
@@ -210,7 +209,7 @@ public class ShoutcastV1ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
mGenre.setText(config.getGenre());
|
mGenre.setText(config.getGenre());
|
||||||
mDescription.setText(config.getDescription());
|
mDescription.setText(config.getDescription());
|
||||||
mPublic.setSelected(config.isPublic());
|
mPublic.setSelected(config.isPublic());
|
||||||
mDelay.setValue((int)(config.getDelay() / ONE_MINUTE_MS));
|
mDelay.setValue((int) (config.getDelay() / ONE_MINUTE_MS));
|
||||||
mEnabled.setSelected(config.isEnabled());
|
mEnabled.setSelected(config.isEnabled());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -232,7 +231,7 @@ public class ShoutcastV1ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
@Override
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
ShoutcastV1Configuration config = (ShoutcastV1Configuration)getItem();
|
ShoutcastV1Configuration config = (ShoutcastV1Configuration) getItem();
|
||||||
|
|
||||||
if(validateConfiguration())
|
if(validateConfiguration())
|
||||||
{
|
{
|
||||||
@@ -263,11 +262,11 @@ public class ShoutcastV1ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
if(!mBroadcastModel.isUniqueName(name, getItem()))
|
if(!mBroadcastModel.isUniqueName(name, getItem()))
|
||||||
{
|
{
|
||||||
String message = (name == null || name.isEmpty()) ?
|
String message = (name == null || name.isEmpty()) ?
|
||||||
"Please specify a stream name." : "Stream name " + name +
|
"Please specify a stream name." : "Stream name " + name +
|
||||||
"is already in use.\nPlease choose another name.";
|
"is already in use.\nPlease choose another name.";
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(ShoutcastV1ConfigurationEditor.this,
|
JOptionPane.showMessageDialog(ShoutcastV1ConfigurationEditor.this,
|
||||||
message, "Invalid Stream Name", JOptionPane.ERROR_MESSAGE);
|
message, "Invalid Stream Name", JOptionPane.ERROR_MESSAGE);
|
||||||
|
|
||||||
mName.requestFocus();
|
mName.requestFocus();
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ import audio.broadcast.BroadcastConfigurationEditor;
|
|||||||
import audio.broadcast.BroadcastEvent;
|
import audio.broadcast.BroadcastEvent;
|
||||||
import audio.broadcast.BroadcastModel;
|
import audio.broadcast.BroadcastModel;
|
||||||
import audio.broadcast.BroadcastServerType;
|
import audio.broadcast.BroadcastServerType;
|
||||||
|
import icon.IconManager;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
@@ -38,7 +38,7 @@ import java.awt.event.ActionListener;
|
|||||||
|
|
||||||
public class ShoutcastV2ConfigurationEditor extends BroadcastConfigurationEditor
|
public class ShoutcastV2ConfigurationEditor extends BroadcastConfigurationEditor
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( ShoutcastV2ConfigurationEditor.class );
|
private final static Logger mLog = LoggerFactory.getLogger(ShoutcastV2ConfigurationEditor.class);
|
||||||
|
|
||||||
private static final int ONE_MINUTE_MS = 60000;
|
private static final int ONE_MINUTE_MS = 60000;
|
||||||
|
|
||||||
@@ -56,22 +56,21 @@ public class ShoutcastV2ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
private JButton mSaveButton;
|
private JButton mSaveButton;
|
||||||
private JButton mResetButton;
|
private JButton mResetButton;
|
||||||
|
|
||||||
public ShoutcastV2ConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel,
|
public ShoutcastV2ConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel, IconManager iconManager)
|
||||||
SettingsManager settingsManager)
|
|
||||||
{
|
{
|
||||||
super(broadcastModel, aliasModel, settingsManager);
|
super(broadcastModel, aliasModel, iconManager);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[align right][grow,fill]",
|
setLayout(new MigLayout("fill,wrap 2", "[align right][grow,fill]",
|
||||||
"[][][][][][][][][][][][][][grow,fill]" ) );
|
"[][][][][][][][][][][][][][grow,fill]"));
|
||||||
setPreferredSize(new Dimension(150,400));
|
setPreferredSize(new Dimension(150, 400));
|
||||||
|
|
||||||
JLabel channelLabel = new JLabel("Shoutcast (v2) Stream");
|
JLabel channelLabel = new JLabel("Shoutcast (v2) Stream");
|
||||||
|
|
||||||
ImageIcon icon = mSettingsManager.getImageIcon(BroadcastServerType.SHOUTCAST_V2.getIconName(), 25);
|
ImageIcon icon = mIconManager.getScaledIcon(new ImageIcon(BroadcastServerType.SHOUTCAST_V2.getIconPath()), 25);
|
||||||
channelLabel.setIcon(icon);
|
channelLabel.setIcon(icon);
|
||||||
|
|
||||||
add(channelLabel, "span, align center");
|
add(channelLabel, "span, align center");
|
||||||
@@ -136,7 +135,7 @@ public class ShoutcastV2ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
add(mDelayValue);
|
add(mDelayValue);
|
||||||
|
|
||||||
add(new JLabel("Delay:"));
|
add(new JLabel("Delay:"));
|
||||||
mDelay = new JSlider(0,60,0);
|
mDelay = new JSlider(0, 60, 0);
|
||||||
mDelay.setMajorTickSpacing(10);
|
mDelay.setMajorTickSpacing(10);
|
||||||
mDelay.setMinorTickSpacing(5);
|
mDelay.setMinorTickSpacing(5);
|
||||||
mDelay.addChangeListener(new ChangeListener()
|
mDelay.addChangeListener(new ChangeListener()
|
||||||
@@ -208,7 +207,7 @@ public class ShoutcastV2ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
|
|
||||||
if(hasItem())
|
if(hasItem())
|
||||||
{
|
{
|
||||||
ShoutcastV2Configuration config = (ShoutcastV2Configuration)getItem();
|
ShoutcastV2Configuration config = (ShoutcastV2Configuration) getItem();
|
||||||
|
|
||||||
mName.setText(config.getName());
|
mName.setText(config.getName());
|
||||||
mServer.setText(config.getHost());
|
mServer.setText(config.getHost());
|
||||||
@@ -218,7 +217,7 @@ public class ShoutcastV2ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
mPassword.setText(config.getPassword());
|
mPassword.setText(config.getPassword());
|
||||||
mGenre.setText(config.getGenre());
|
mGenre.setText(config.getGenre());
|
||||||
mPublic.setSelected(config.isPublic());
|
mPublic.setSelected(config.isPublic());
|
||||||
mDelay.setValue((int)(config.getDelay() / ONE_MINUTE_MS));
|
mDelay.setValue((int) (config.getDelay() / ONE_MINUTE_MS));
|
||||||
mEnabled.setSelected(config.isEnabled());
|
mEnabled.setSelected(config.isEnabled());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -241,7 +240,7 @@ public class ShoutcastV2ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
@Override
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
ShoutcastV2Configuration config = (ShoutcastV2Configuration)getItem();
|
ShoutcastV2Configuration config = (ShoutcastV2Configuration) getItem();
|
||||||
|
|
||||||
if(validateConfiguration())
|
if(validateConfiguration())
|
||||||
{
|
{
|
||||||
@@ -273,11 +272,11 @@ public class ShoutcastV2ConfigurationEditor extends BroadcastConfigurationEditor
|
|||||||
if(!mBroadcastModel.isUniqueName(name, getItem()))
|
if(!mBroadcastModel.isUniqueName(name, getItem()))
|
||||||
{
|
{
|
||||||
String message = (name == null || name.isEmpty()) ?
|
String message = (name == null || name.isEmpty()) ?
|
||||||
"Please specify a stream name." : "Stream name " + name +
|
"Please specify a stream name." : "Stream name " + name +
|
||||||
"is already in use.\nPlease choose another name.";
|
"is already in use.\nPlease choose another name.";
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(ShoutcastV2ConfigurationEditor.this,
|
JOptionPane.showMessageDialog(ShoutcastV2ConfigurationEditor.this,
|
||||||
message, "Invalid Stream Name", JOptionPane.ERROR_MESSAGE);
|
message, "Invalid Stream Name", JOptionPane.ERROR_MESSAGE);
|
||||||
|
|
||||||
mName.requestFocus();
|
mName.requestFocus();
|
||||||
|
|
||||||
|
|||||||
@@ -87,20 +87,20 @@ public class ControllerPanel extends JPanel
|
|||||||
{
|
{
|
||||||
mChannelModel = channelModel;
|
mChannelModel = channelModel;
|
||||||
|
|
||||||
mAudioPanel = new AudioPanel(settingsManager, sourceManager, audioManager);
|
mAudioPanel = new AudioPanel(iconManager, settingsManager, sourceManager, audioManager);
|
||||||
|
|
||||||
mMapPanel = new MapPanel(mapService, settingsManager);
|
mMapPanel = new MapPanel(mapService, iconManager, settingsManager);
|
||||||
|
|
||||||
mMessageActivityPanel = new MessageActivityPanel(channelProcessingManager);
|
mMessageActivityPanel = new MessageActivityPanel(channelProcessingManager);
|
||||||
|
|
||||||
mBroadcastPanel = new BroadcastPanel(broadcastModel, aliasModel, settingsManager);
|
mBroadcastPanel = new BroadcastPanel(broadcastModel, aliasModel, iconManager);
|
||||||
|
|
||||||
mCallEventPanel = new CallEventPanel(settingsManager, channelProcessingManager);
|
mCallEventPanel = new CallEventPanel(iconManager, channelProcessingManager);
|
||||||
|
|
||||||
mChannelSpectrumPanel = new ChannelSpectrumPanel(settingsManager,
|
mChannelSpectrumPanel = new ChannelSpectrumPanel(settingsManager,
|
||||||
channelProcessingManager);
|
channelProcessingManager);
|
||||||
|
|
||||||
mChannelStateList = new ChannelList(channelModel, channelProcessingManager,
|
mChannelStateList = new ChannelList(channelModel, channelProcessingManager, iconManager,
|
||||||
settingsManager, mAudioPanel);
|
settingsManager, mAudioPanel);
|
||||||
|
|
||||||
mChannelController = new ChannelController(channelModel, channelMapModel,
|
mChannelController = new ChannelController(channelModel, channelMapModel,
|
||||||
|
|||||||
@@ -139,11 +139,11 @@ public class SDRTrunk implements Listener<TunerEvent>
|
|||||||
AudioManager audioManager = new AudioManager(threadPoolManager, sourceManager.getMixerManager());
|
AudioManager audioManager = new AudioManager(threadPoolManager, sourceManager.getMixerManager());
|
||||||
channelProcessingManager.addAudioPacketListener(audioManager);
|
channelProcessingManager.addAudioPacketListener(audioManager);
|
||||||
|
|
||||||
BroadcastModel broadcastModel = new BroadcastModel(threadPoolManager, mSettingsManager);
|
BroadcastModel broadcastModel = new BroadcastModel(threadPoolManager, mIconManager);
|
||||||
|
|
||||||
channelProcessingManager.addAudioPacketListener(broadcastModel);
|
channelProcessingManager.addAudioPacketListener(broadcastModel);
|
||||||
|
|
||||||
MapService mapService = new MapService(mSettingsManager);
|
MapService mapService = new MapService(mIconManager);
|
||||||
channelProcessingManager.addMessageListener(mapService);
|
channelProcessingManager.addMessageListener(mapService);
|
||||||
|
|
||||||
mControllerPanel = new ControllerPanel(audioManager, aliasModel, broadcastModel,
|
mControllerPanel = new ControllerPanel(audioManager, aliasModel, broadcastModel,
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
public class IconManager
|
public class IconManager
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(IconManager.class);
|
private final static Logger mLog = LoggerFactory.getLogger(IconManager.class);
|
||||||
|
public static final int DEFAULT_ICON_SIZE = 12;
|
||||||
|
|
||||||
private Path mIconFolderPath;
|
private Path mIconFolderPath;
|
||||||
private Path mIconFilePath;
|
private Path mIconFilePath;
|
||||||
@@ -99,6 +100,14 @@ public class IconManager
|
|||||||
{
|
{
|
||||||
IconSet loadedIcons = load();
|
IconSet loadedIcons = load();
|
||||||
|
|
||||||
|
boolean saveRequired = false;
|
||||||
|
|
||||||
|
if(loadedIcons == null)
|
||||||
|
{
|
||||||
|
loadedIcons = getDefaultIconSet();
|
||||||
|
saveRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
mIconModel = new IconModel(loadedIcons);
|
mIconModel = new IconModel(loadedIcons);
|
||||||
mIconModel.addListDataListener(new ListDataListener()
|
mIconModel.addListDataListener(new ListDataListener()
|
||||||
{
|
{
|
||||||
@@ -120,6 +129,11 @@ public class IconManager
|
|||||||
scheduleSave();
|
scheduleSave();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(saveRequired)
|
||||||
|
{
|
||||||
|
scheduleSave();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mIconModel;
|
return mIconModel;
|
||||||
@@ -170,7 +184,7 @@ public class IconManager
|
|||||||
* @param height new height to scale the image (width will be scaled accordingly)
|
* @param height new height to scale the image (width will be scaled accordingly)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static ImageIcon getScaledIcon(ImageIcon original, int height)
|
public static ImageIcon getScaledIcon(ImageIcon original, int height)
|
||||||
{
|
{
|
||||||
double scale = (double) original.getIconHeight() / (double) height;
|
double scale = (double) original.getIconHeight() / (double) height;
|
||||||
|
|
||||||
@@ -365,11 +379,6 @@ public class IconManager
|
|||||||
mLog.info("Icons file not found at [" + getIconFilePath().toString() + "]");
|
mLog.info("Icons file not found at [" + getIconFilePath().toString() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iconSet == null)
|
|
||||||
{
|
|
||||||
iconSet = getDefaultIconSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
return iconSet;
|
return iconSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ package icon;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -31,11 +30,11 @@ public class IconModel extends DefaultListModel<Icon>
|
|||||||
public static final String DEFAULT_ICON = "No Icon";
|
public static final String DEFAULT_ICON = "No Icon";
|
||||||
|
|
||||||
private Icon mDefaultIcon;
|
private Icon mDefaultIcon;
|
||||||
private Map<String,Icon> mIconMap = new HashMap();
|
private Map<String, Icon> mIconMap = new HashMap<>();
|
||||||
|
|
||||||
public IconModel(IconSet iconSet)
|
public IconModel(IconSet iconSet)
|
||||||
{
|
{
|
||||||
for(Icon icon: iconSet.getIcons())
|
for(Icon icon : iconSet.getIcons())
|
||||||
{
|
{
|
||||||
this.addElement(icon);
|
this.addElement(icon);
|
||||||
}
|
}
|
||||||
@@ -78,6 +77,7 @@ public class IconModel extends DefaultListModel<Icon>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if this model contains an icon with the specified name
|
* Indicates if this model contains an icon with the specified name
|
||||||
|
*
|
||||||
* @param name to check
|
* @param name to check
|
||||||
* @return true if name is not null and not empty and the internal map contains an icon matching name
|
* @return true if name is not null and not empty and the internal map contains an icon matching name
|
||||||
*/
|
*/
|
||||||
@@ -131,7 +131,7 @@ public class IconModel extends DefaultListModel<Icon>
|
|||||||
{
|
{
|
||||||
if(object instanceof Icon)
|
if(object instanceof Icon)
|
||||||
{
|
{
|
||||||
mIconMap.remove(((Icon)object).getName());
|
mIconMap.remove(((Icon) object).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.removeElement(object);
|
return super.removeElement(object);
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ package icon;
|
|||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -46,7 +45,6 @@ public class IconSet
|
|||||||
mIcons.remove(icon);
|
mIcons.remove(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElementWrapper(name="icons")
|
|
||||||
@XmlElement(name = "icon")
|
@XmlElement(name = "icon")
|
||||||
public List<Icon> getIcons()
|
public List<Icon> getIcons()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,28 +1,25 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package map;
|
package map;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import icon.IconManager;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import org.jdesktop.swingx.JXMapViewer;
|
import org.jdesktop.swingx.JXMapViewer;
|
||||||
import org.jdesktop.swingx.OSMTileFactoryInfo;
|
import org.jdesktop.swingx.OSMTileFactoryInfo;
|
||||||
import org.jdesktop.swingx.input.PanKeyListener;
|
import org.jdesktop.swingx.input.PanKeyListener;
|
||||||
@@ -30,10 +27,12 @@ import org.jdesktop.swingx.input.ZoomMouseWheelListenerCursor;
|
|||||||
import org.jdesktop.swingx.mapviewer.DefaultTileFactory;
|
import org.jdesktop.swingx.mapviewer.DefaultTileFactory;
|
||||||
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
||||||
import org.jdesktop.swingx.mapviewer.TileFactoryInfo;
|
import org.jdesktop.swingx.mapviewer.TileFactoryInfo;
|
||||||
|
|
||||||
import settings.MapViewSetting;
|
import settings.MapViewSetting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class MapPanel extends JPanel implements PlottableUpdateListener
|
public class MapPanel extends JPanel implements PlottableUpdateListener
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -42,107 +41,103 @@ public class MapPanel extends JPanel implements PlottableUpdateListener
|
|||||||
private MapService mMapService;
|
private MapService mMapService;
|
||||||
private JXMapViewer mMapViewer = new JXMapViewer();
|
private JXMapViewer mMapViewer = new JXMapViewer();
|
||||||
private PlottableEntityPainter mMapPainter;
|
private PlottableEntityPainter mMapPainter;
|
||||||
|
|
||||||
public MapPanel( MapService mapService, SettingsManager settingsManager )
|
public MapPanel(MapService mapService, IconManager iconManager, SettingsManager settingsManager)
|
||||||
{
|
{
|
||||||
mSettingsManager = settingsManager;
|
mSettingsManager = settingsManager;
|
||||||
mMapService = mapService;
|
mMapService = mapService;
|
||||||
mMapPainter = new PlottableEntityPainter( mSettingsManager );
|
mMapPainter = new PlottableEntityPainter(iconManager);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0",
|
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[grow,fill]"));
|
||||||
"[grow,fill]", "[grow,fill]") );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the entity painter as the overlay painter and register this panel
|
* Set the entity painter as the overlay painter and register this panel
|
||||||
* to receive new messages (plots)
|
* to receive new messages (plots)
|
||||||
*/
|
*/
|
||||||
mMapViewer.setOverlayPainter( mMapPainter );
|
mMapViewer.setOverlayPainter(mMapPainter);
|
||||||
mMapService.addListener( this );
|
mMapService.addListener(this);
|
||||||
|
|
||||||
/**
|
|
||||||
* Map image source
|
|
||||||
*/
|
|
||||||
TileFactoryInfo info = new OSMTileFactoryInfo();
|
|
||||||
DefaultTileFactory tileFactory = new DefaultTileFactory( info );
|
|
||||||
mMapViewer.setTileFactory( tileFactory );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines how many threads will be used to fetch the background map
|
* Map image source
|
||||||
* tiles (graphics)
|
*/
|
||||||
*/
|
TileFactoryInfo info = new OSMTileFactoryInfo();
|
||||||
tileFactory.setThreadPoolSize( 8 );
|
DefaultTileFactory tileFactory = new DefaultTileFactory(info);
|
||||||
|
mMapViewer.setTileFactory(tileFactory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set initial location and zoom for the map upon display
|
* Defines how many threads will be used to fetch the background map
|
||||||
*/
|
* tiles (graphics)
|
||||||
GeoPosition syracuse = new GeoPosition( 43.048, -76.147 );
|
*/
|
||||||
int zoom = 7;
|
tileFactory.setThreadPoolSize(8);
|
||||||
|
|
||||||
MapViewSetting view = mSettingsManager
|
/**
|
||||||
.getMapViewSetting( "Default", syracuse, zoom );
|
* Set initial location and zoom for the map upon display
|
||||||
|
*/
|
||||||
mMapViewer.setAddressLocation( view.getGeoPosition() );
|
GeoPosition syracuse = new GeoPosition(43.048, -76.147);
|
||||||
mMapViewer.setZoom( view.getZoom() );
|
int zoom = 7;
|
||||||
|
|
||||||
|
MapViewSetting view = mSettingsManager.getMapViewSetting("Default", syracuse, zoom);
|
||||||
|
|
||||||
|
mMapViewer.setAddressLocation(view.getGeoPosition());
|
||||||
|
mMapViewer.setZoom(view.getZoom());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a mouse adapter for panning and scrolling
|
||||||
|
*/
|
||||||
|
MapMouseListener listener = new MapMouseListener(mMapViewer, mSettingsManager);
|
||||||
|
mMapViewer.addMouseListener(listener);
|
||||||
|
mMapViewer.addMouseMotionListener(listener);
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a mouse adapter for panning and scrolling
|
|
||||||
*/
|
|
||||||
MapMouseListener listener =
|
|
||||||
new MapMouseListener( mMapViewer, mSettingsManager );
|
|
||||||
mMapViewer.addMouseListener( listener );
|
|
||||||
mMapViewer.addMouseMotionListener( listener );
|
|
||||||
|
|
||||||
/* Map zoom listener */
|
/* Map zoom listener */
|
||||||
mMapViewer.addMouseWheelListener(
|
mMapViewer.addMouseWheelListener(new ZoomMouseWheelListenerCursor(mMapViewer));
|
||||||
new ZoomMouseWheelListenerCursor( mMapViewer ) );
|
|
||||||
|
|
||||||
/* Keyboard panning listener */
|
/* Keyboard panning listener */
|
||||||
mMapViewer.addKeyListener( new PanKeyListener( mMapViewer ) );
|
mMapViewer.addKeyListener(new PanKeyListener(mMapViewer));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a selection listener
|
* Add a selection listener
|
||||||
*/
|
*/
|
||||||
SelectionAdapter sa = new SelectionAdapter( mMapViewer );
|
SelectionAdapter sa = new SelectionAdapter(mMapViewer);
|
||||||
mMapViewer.addMouseListener( sa );
|
mMapViewer.addMouseListener(sa);
|
||||||
mMapViewer.addMouseMotionListener( sa );
|
mMapViewer.addMouseMotionListener(sa);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map component
|
* Map component
|
||||||
*/
|
*/
|
||||||
add( mMapViewer, "span" );
|
add(mMapViewer, "span");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void entitiesUpdated()
|
public void entitiesUpdated()
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater( new Runnable()
|
EventQueue.invokeLater(new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
mMapViewer.repaint();
|
mMapViewer.repaint();
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPlottableEntity( PlottableEntity entity )
|
public void addPlottableEntity(PlottableEntity entity)
|
||||||
{
|
{
|
||||||
mMapPainter.addEntity( entity );
|
mMapPainter.addEntity(entity);
|
||||||
|
|
||||||
entitiesUpdated();
|
entitiesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlottableEntity( PlottableEntity entity )
|
public void removePlottableEntity(PlottableEntity entity)
|
||||||
{
|
{
|
||||||
mMapPainter.removeEntity( entity );
|
mMapPainter.removeEntity(entity);
|
||||||
|
|
||||||
entitiesUpdated();
|
entitiesUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,31 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package map;
|
package map;
|
||||||
|
|
||||||
import java.awt.Color;
|
import alias.Alias;
|
||||||
|
import controller.NamingThreadFactory;
|
||||||
|
import icon.IconManager;
|
||||||
|
import message.Message;
|
||||||
|
import sample.Listener;
|
||||||
|
import settings.SettingsManager;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -25,159 +33,144 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import sample.Listener;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
import alias.Alias;
|
|
||||||
import controller.NamingThreadFactory;
|
|
||||||
|
|
||||||
public class MapService implements Listener<Message>
|
public class MapService implements Listener<Message>
|
||||||
{
|
{
|
||||||
private int mMaxHistory = 2;
|
private int mMaxHistory = 2;
|
||||||
private int mCullThresholdMinutes = 60;
|
private int mCullThresholdMinutes = 60;
|
||||||
|
|
||||||
private static final Color sDEFAULT_COLOR = Color.BLACK;
|
|
||||||
|
|
||||||
private final ScheduledExecutorService scheduler =
|
|
||||||
Executors.newScheduledThreadPool(1,
|
|
||||||
new NamingThreadFactory( "map tile fetcher" ) );
|
|
||||||
|
|
||||||
private ArrayList<PlottableUpdateListener> mListeners =
|
|
||||||
new ArrayList<PlottableUpdateListener>();
|
|
||||||
|
|
||||||
private HashMap<String,PlottableEntity> mEntities =
|
private static final Color sDEFAULT_COLOR = Color.BLACK;
|
||||||
new HashMap<String,PlottableEntity>();
|
|
||||||
|
|
||||||
private SettingsManager mSettingsManager;
|
private final ScheduledExecutorService scheduler =
|
||||||
|
Executors.newScheduledThreadPool(1,
|
||||||
public MapService( SettingsManager resourceManager )
|
new NamingThreadFactory("map tile fetcher"));
|
||||||
{
|
|
||||||
mSettingsManager = resourceManager;
|
|
||||||
|
|
||||||
// scheduler.scheduleAtFixedRate( new CullThread(), 5, 5, TimeUnit.MINUTES );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the max plottables (locations) history setting that is applied
|
|
||||||
* to all plottable entities
|
|
||||||
*/
|
|
||||||
public int getMaxHistory()
|
|
||||||
{
|
|
||||||
return mMaxHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
private ArrayList<PlottableUpdateListener> mListeners =
|
||||||
* Sets the max history trail for entities. Value is applied to all newly
|
new ArrayList<PlottableUpdateListener>();
|
||||||
* created PlottableEntity and all existing entities.
|
|
||||||
*/
|
|
||||||
public void setMaxHistory( int maxHistory )
|
|
||||||
{
|
|
||||||
mMaxHistory = maxHistory;
|
|
||||||
|
|
||||||
/**
|
private HashMap<String, PlottableEntity> mEntities =
|
||||||
* Update any existing entities with the new max history value
|
new HashMap<String, PlottableEntity>();
|
||||||
*/
|
|
||||||
for( PlottableEntity entity: mEntities.values() )
|
private IconManager mIconManager;
|
||||||
{
|
|
||||||
entity.setMaxHistory( mMaxHistory );
|
public MapService(IconManager resourceManager)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( Message message )
|
|
||||||
{
|
{
|
||||||
Plottable plottable = message.getPlottable();
|
mIconManager = resourceManager;
|
||||||
|
|
||||||
if( plottable != null )
|
|
||||||
{
|
|
||||||
PlottableEntity entity = mEntities.get( plottable.getID() );
|
|
||||||
|
|
||||||
if( entity == null )
|
|
||||||
{
|
|
||||||
Alias alias = plottable.getAlias();
|
|
||||||
|
|
||||||
Color color = null;
|
// scheduler.scheduleAtFixedRate( new CullThread(), 5, 5, TimeUnit.MINUTES );
|
||||||
MapIcon icon = null;
|
|
||||||
|
|
||||||
if( alias != null )
|
|
||||||
{
|
|
||||||
color = alias.getMapColor();
|
|
||||||
|
|
||||||
String iconName = alias.getIconName();
|
|
||||||
|
|
||||||
if( iconName == null )
|
|
||||||
{
|
|
||||||
iconName = SettingsManager.DEFAULT_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
icon = mSettingsManager.getMapIcon( iconName );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( color == null )
|
|
||||||
{
|
|
||||||
color = sDEFAULT_COLOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
entity = new PlottableEntity( plottable, color );
|
|
||||||
|
|
||||||
entity.setMaxHistory( mMaxHistory );
|
|
||||||
|
|
||||||
mEntities.put( plottable.getID(), entity );
|
|
||||||
|
|
||||||
for( PlottableUpdateListener listener: mListeners )
|
|
||||||
{
|
|
||||||
listener.addPlottableEntity( entity );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
entity.addPlottable( plottable );
|
|
||||||
|
|
||||||
for( PlottableUpdateListener listener: mListeners )
|
|
||||||
{
|
|
||||||
listener.entitiesUpdated();;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addListener( PlottableUpdateListener listener )
|
/**
|
||||||
{
|
* Returns the max plottables (locations) history setting that is applied
|
||||||
mListeners.add( listener );
|
* to all plottable entities
|
||||||
}
|
*/
|
||||||
|
public int getMaxHistory()
|
||||||
public void removeListener( PlottableUpdateListener listener )
|
{
|
||||||
{
|
return mMaxHistory;
|
||||||
mListeners.remove( listener );
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
public class CullThread implements Runnable
|
* Sets the max history trail for entities. Value is applied to all newly
|
||||||
{
|
* created PlottableEntity and all existing entities.
|
||||||
@Override
|
*/
|
||||||
|
public void setMaxHistory(int maxHistory)
|
||||||
|
{
|
||||||
|
mMaxHistory = maxHistory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update any existing entities with the new max history value
|
||||||
|
*/
|
||||||
|
for(PlottableEntity entity : mEntities.values())
|
||||||
|
{
|
||||||
|
entity.setMaxHistory(mMaxHistory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(Message message)
|
||||||
|
{
|
||||||
|
Plottable plottable = message.getPlottable();
|
||||||
|
|
||||||
|
if(plottable != null)
|
||||||
|
{
|
||||||
|
PlottableEntity entity = mEntities.get(plottable.getID());
|
||||||
|
|
||||||
|
if(entity == null)
|
||||||
|
{
|
||||||
|
Alias alias = plottable.getAlias();
|
||||||
|
|
||||||
|
Color color = null;
|
||||||
|
|
||||||
|
if(alias != null)
|
||||||
|
{
|
||||||
|
color = alias.getMapColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(color == null)
|
||||||
|
{
|
||||||
|
color = sDEFAULT_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
entity = new PlottableEntity(plottable, color);
|
||||||
|
|
||||||
|
entity.setMaxHistory(mMaxHistory);
|
||||||
|
|
||||||
|
mEntities.put(plottable.getID(), entity);
|
||||||
|
|
||||||
|
for(PlottableUpdateListener listener : mListeners)
|
||||||
|
{
|
||||||
|
listener.addPlottableEntity(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entity.addPlottable(plottable);
|
||||||
|
|
||||||
|
for(PlottableUpdateListener listener : mListeners)
|
||||||
|
{
|
||||||
|
listener.entitiesUpdated();
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addListener(PlottableUpdateListener listener)
|
||||||
|
{
|
||||||
|
mListeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(PlottableUpdateListener listener)
|
||||||
|
{
|
||||||
|
mListeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CullThread implements Runnable
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
long cutoffTime = System.currentTimeMillis() -
|
long cutoffTime = System.currentTimeMillis() -
|
||||||
( mCullThresholdMinutes * 1000 );
|
(mCullThresholdMinutes * 1000);
|
||||||
|
|
||||||
Set<String> ids = Collections.unmodifiableSet( mEntities.keySet() );
|
Set<String> ids = Collections.unmodifiableSet(mEntities.keySet());
|
||||||
|
|
||||||
for( String id: ids )
|
for(String id : ids)
|
||||||
{
|
{
|
||||||
PlottableEntity entity = mEntities.get( id );
|
PlottableEntity entity = mEntities.get(id);
|
||||||
|
|
||||||
if( entity.getCurrentPlottable().getTimestamp() < cutoffTime )
|
|
||||||
{
|
|
||||||
mEntities.remove( id );
|
|
||||||
|
|
||||||
/**
|
if(entity.getCurrentPlottable().getTimestamp() < cutoffTime)
|
||||||
* Let all listeners know we've removed (culled) an entity
|
{
|
||||||
*/
|
mEntities.remove(id);
|
||||||
for( PlottableUpdateListener listener: mListeners )
|
|
||||||
{
|
/**
|
||||||
listener.removePlottableEntity( entity );
|
* Let all listeners know we've removed (culled) an entity
|
||||||
}
|
*/
|
||||||
}
|
for(PlottableUpdateListener listener : mListeners)
|
||||||
}
|
{
|
||||||
|
listener.removePlottableEntity(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,71 +1,79 @@
|
|||||||
/*
|
|
||||||
* WaypointMapOverlay.java
|
|
||||||
*
|
|
||||||
* Created on April 1, 2006, 4:59 PM
|
|
||||||
*
|
|
||||||
* To change this template, choose Tools | Template Manager
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* sdrtrunk
|
||||||
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
package map;
|
package map;
|
||||||
|
|
||||||
import java.awt.Graphics2D;
|
import icon.IconManager;
|
||||||
import java.awt.Rectangle;
|
import org.jdesktop.swingx.JXMapViewer;
|
||||||
|
import org.jdesktop.swingx.painter.AbstractPainter;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jdesktop.swingx.JXMapViewer;
|
|
||||||
import org.jdesktop.swingx.painter.AbstractPainter;
|
|
||||||
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
public class PlottableEntityPainter extends AbstractPainter<JXMapViewer>
|
public class PlottableEntityPainter extends AbstractPainter<JXMapViewer>
|
||||||
{
|
{
|
||||||
private PlottableEntityRenderer mRenderer;
|
private PlottableEntityRenderer mRenderer;
|
||||||
private Set<PlottableEntity> mEntities = new HashSet<PlottableEntity>();
|
private Set<PlottableEntity> mEntities = new HashSet<PlottableEntity>();
|
||||||
|
|
||||||
public PlottableEntityPainter( SettingsManager settingsManager )
|
public PlottableEntityPainter(IconManager iconManager)
|
||||||
{
|
{
|
||||||
mRenderer = new PlottableEntityRenderer( settingsManager );
|
mRenderer = new PlottableEntityRenderer(iconManager);
|
||||||
setAntialiasing( true );
|
setAntialiasing(true);
|
||||||
setCacheable( false );
|
setCacheable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEntity( PlottableEntity entity )
|
public void addEntity(PlottableEntity entity)
|
||||||
{
|
{
|
||||||
mEntities.add( entity );
|
mEntities.add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeEntity( PlottableEntity entity )
|
|
||||||
{
|
|
||||||
mEntities.remove( entity );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearEntities()
|
|
||||||
{
|
|
||||||
mEntities.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Set<PlottableEntity> getEntities()
|
|
||||||
{
|
|
||||||
return Collections.unmodifiableSet( mEntities );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void doPaint(Graphics2D g, JXMapViewer map, int width, int height)
|
|
||||||
{
|
|
||||||
Rectangle viewportBounds = map.getViewportBounds();
|
|
||||||
|
|
||||||
g.translate( -viewportBounds.getX(), -viewportBounds.getY() );
|
public void removeEntity(PlottableEntity entity)
|
||||||
|
{
|
||||||
|
mEntities.remove(entity);
|
||||||
|
}
|
||||||
|
|
||||||
Set<PlottableEntity> entities = getEntities();
|
public void clearEntities()
|
||||||
|
{
|
||||||
for (PlottableEntity entity: entities )
|
mEntities.clear();
|
||||||
{
|
}
|
||||||
mRenderer.paintPlottableEntity( g, map, entity, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
g.translate( viewportBounds.getX(), viewportBounds.getY() );
|
private Set<PlottableEntity> getEntities()
|
||||||
}
|
{
|
||||||
|
return Collections.unmodifiableSet(mEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doPaint(Graphics2D g, JXMapViewer map, int width, int height)
|
||||||
|
{
|
||||||
|
Rectangle viewportBounds = map.getViewportBounds();
|
||||||
|
|
||||||
|
g.translate(-viewportBounds.getX(), -viewportBounds.getY());
|
||||||
|
|
||||||
|
Set<PlottableEntity> entities = getEntities();
|
||||||
|
|
||||||
|
for(PlottableEntity entity : entities)
|
||||||
|
{
|
||||||
|
mRenderer.paintPlottableEntity(g, map, entity, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
g.translate(viewportBounds.getX(), viewportBounds.getY());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,169 +1,162 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package map;
|
package map;
|
||||||
|
|
||||||
import java.awt.BasicStroke;
|
import icon.IconManager;
|
||||||
import java.awt.Color;
|
import org.jdesktop.swingx.JXMapViewer;
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.RenderingHints;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
|
|
||||||
import org.jdesktop.swingx.JXMapViewer;
|
|
||||||
|
|
||||||
import settings.SettingsManager;
|
|
||||||
|
|
||||||
public class PlottableEntityRenderer
|
public class PlottableEntityRenderer
|
||||||
{
|
{
|
||||||
private SettingsManager mSettingsManager;
|
private IconManager mIconManager;
|
||||||
|
|
||||||
public PlottableEntityRenderer( SettingsManager settingsManager )
|
public PlottableEntityRenderer(IconManager iconManager)
|
||||||
{
|
{
|
||||||
mSettingsManager = settingsManager;
|
mIconManager = iconManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintPlottableEntity( Graphics2D g,
|
public void paintPlottableEntity(Graphics2D g, JXMapViewer viewer, PlottableEntity entity, boolean antiAliasing)
|
||||||
JXMapViewer viewer,
|
{
|
||||||
PlottableEntity entity,
|
Graphics2D graphics = (Graphics2D) g.create();
|
||||||
boolean antiAliasing )
|
|
||||||
{
|
|
||||||
Graphics2D graphics = (Graphics2D)g.create();
|
|
||||||
|
|
||||||
if( antiAliasing )
|
if(antiAliasing)
|
||||||
{
|
{
|
||||||
graphics.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
|
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON );
|
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the entity's preferred color for lines and labels
|
* Use the entity's preferred color for lines and labels
|
||||||
*/
|
*/
|
||||||
graphics.setColor( entity.getColor() );
|
graphics.setColor(entity.getColor());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the lat/long geoposition to an x/y point on the viewer
|
* Convert the lat/long geoposition to an x/y point on the viewer
|
||||||
*/
|
*/
|
||||||
Point2D point = viewer.getTileFactory().geoToPixel(
|
Point2D point = viewer.getTileFactory().geoToPixel(
|
||||||
entity.getCurrentGeoPosition(), viewer.getZoom() );
|
entity.getCurrentGeoPosition(), viewer.getZoom());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paint the route first, so the icon and label overlay it
|
* Paint the route first, so the icon and label overlay it
|
||||||
*/
|
*/
|
||||||
paintRoute( graphics, viewer, entity );
|
paintRoute(graphics, viewer, entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paint the icon at the current location
|
* Paint the icon at the current location
|
||||||
*/
|
*/
|
||||||
ImageIcon icon = getIcon( entity ).getImageIcon();
|
ImageIcon icon = getIcon(entity);
|
||||||
|
|
||||||
paintIcon( graphics, point, icon );
|
|
||||||
|
|
||||||
/**
|
paintIcon(graphics, point, icon);
|
||||||
* Paint the label offset to the right of the icon
|
|
||||||
*/
|
|
||||||
paintLabel( graphics, point, entity, (int)( icon.getIconWidth() / 2 ), 0 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup
|
* Paint the label offset to the right of the icon
|
||||||
*/
|
*/
|
||||||
graphics.dispose();
|
paintLabel(graphics, point, entity, (int) (icon.getIconWidth() / 2), 0);
|
||||||
}
|
|
||||||
|
|
||||||
private MapIcon getIcon( PlottableEntity entity )
|
|
||||||
{
|
|
||||||
return mSettingsManager.getMapIcon( entity.getMapIconName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void paintIcon( Graphics2D graphics,
|
|
||||||
Point2D point,
|
|
||||||
ImageIcon icon )
|
|
||||||
{
|
|
||||||
graphics.drawImage( icon.getImage(),
|
|
||||||
(int)point.getX() - ( icon.getIconWidth() / 2 ),
|
|
||||||
(int)point.getY() - ( icon.getIconHeight() / 2 ),
|
|
||||||
null );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void paintLabel( Graphics2D graphics,
|
|
||||||
Point2D point,
|
|
||||||
PlottableEntity entity,
|
|
||||||
int xOffset,
|
|
||||||
int yOffset )
|
|
||||||
{
|
|
||||||
graphics.drawString( entity.getLabel(),
|
|
||||||
(int)point.getX() + xOffset,
|
|
||||||
(int)point.getY() + yOffset );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Paints a two-tone route from the entity's list of plottables (locations).
|
|
||||||
* using black as a wider background route, and the entity's preferred color
|
|
||||||
* as a narrower foreground route.
|
|
||||||
*/
|
|
||||||
private void paintRoute( Graphics2D graphics,
|
|
||||||
JXMapViewer viewer,
|
|
||||||
PlottableEntity entity )
|
|
||||||
{
|
|
||||||
Set<Plottable> plottables = entity.getPlottables();
|
|
||||||
|
|
||||||
if( plottables.size() > 1 )
|
|
||||||
{
|
|
||||||
// Draw the route with a black background line
|
|
||||||
graphics.setColor( Color.BLACK );
|
|
||||||
graphics.setStroke( new BasicStroke( 3 ) );
|
|
||||||
|
|
||||||
drawRoute( plottables, graphics, viewer );
|
/**
|
||||||
|
* Cleanup
|
||||||
|
*/
|
||||||
|
graphics.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
// Draw the route again, in the entity's preferred color
|
private ImageIcon getIcon(PlottableEntity entity)
|
||||||
graphics.setColor( entity.getColor() );
|
{
|
||||||
graphics.setStroke( new BasicStroke( 1 ) );
|
return mIconManager.getIcon(entity.getMapIconName(), IconManager.DEFAULT_ICON_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
drawRoute( plottables, graphics, viewer );
|
private void paintIcon(Graphics2D graphics,
|
||||||
}
|
Point2D point,
|
||||||
}
|
ImageIcon icon)
|
||||||
|
{
|
||||||
|
graphics.drawImage(icon.getImage(),
|
||||||
|
(int) point.getX() - (icon.getIconWidth() / 2),
|
||||||
|
(int) point.getY() - (icon.getIconHeight() / 2),
|
||||||
|
null);
|
||||||
|
|
||||||
/**
|
}
|
||||||
* Draws a route from a list of plottables
|
|
||||||
*/
|
|
||||||
private void drawRoute( Set<Plottable> plottables,
|
|
||||||
Graphics2D g,
|
|
||||||
JXMapViewer viewer )
|
|
||||||
{
|
|
||||||
Point2D lastPoint = null;
|
|
||||||
|
|
||||||
for (Plottable plottable: plottables )
|
private void paintLabel(Graphics2D graphics,
|
||||||
{
|
Point2D point,
|
||||||
// convert geo-coordinate to world bitmap pixel
|
PlottableEntity entity,
|
||||||
Point2D currentPoint = viewer.getTileFactory()
|
int xOffset,
|
||||||
.geoToPixel( plottable.getGeoPosition(), viewer.getZoom() );
|
int yOffset)
|
||||||
|
{
|
||||||
|
graphics.drawString(entity.getLabel(),
|
||||||
|
(int) point.getX() + xOffset,
|
||||||
|
(int) point.getY() + yOffset);
|
||||||
|
}
|
||||||
|
|
||||||
if( lastPoint != null )
|
/**
|
||||||
{
|
* Paints a two-tone route from the entity's list of plottables (locations).
|
||||||
g.drawLine( (int)lastPoint.getX(), (int)lastPoint.getY(),
|
* using black as a wider background route, and the entity's preferred color
|
||||||
(int)currentPoint.getX(), (int)currentPoint.getY() );
|
* as a narrower foreground route.
|
||||||
}
|
*/
|
||||||
|
private void paintRoute(Graphics2D graphics,
|
||||||
lastPoint = currentPoint;
|
JXMapViewer viewer,
|
||||||
}
|
PlottableEntity entity)
|
||||||
}
|
{
|
||||||
|
Set<Plottable> plottables = entity.getPlottables();
|
||||||
|
|
||||||
|
if(plottables.size() > 1)
|
||||||
|
{
|
||||||
|
// Draw the route with a black background line
|
||||||
|
graphics.setColor(Color.BLACK);
|
||||||
|
graphics.setStroke(new BasicStroke(3));
|
||||||
|
|
||||||
|
drawRoute(plottables, graphics, viewer);
|
||||||
|
|
||||||
|
// Draw the route again, in the entity's preferred color
|
||||||
|
graphics.setColor(entity.getColor());
|
||||||
|
graphics.setStroke(new BasicStroke(1));
|
||||||
|
|
||||||
|
drawRoute(plottables, graphics, viewer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a route from a list of plottables
|
||||||
|
*/
|
||||||
|
private void drawRoute(Set<Plottable> plottables,
|
||||||
|
Graphics2D g,
|
||||||
|
JXMapViewer viewer)
|
||||||
|
{
|
||||||
|
Point2D lastPoint = null;
|
||||||
|
|
||||||
|
for(Plottable plottable : plottables)
|
||||||
|
{
|
||||||
|
// convert geo-coordinate to world bitmap pixel
|
||||||
|
Point2D currentPoint = viewer.getTileFactory()
|
||||||
|
.geoToPixel(plottable.getGeoPosition(), viewer.getZoom());
|
||||||
|
|
||||||
|
if(lastPoint != null)
|
||||||
|
{
|
||||||
|
g.drawLine((int) lastPoint.getX(), (int) lastPoint.getY(),
|
||||||
|
(int) currentPoint.getX(), (int) currentPoint.getY());
|
||||||
|
}
|
||||||
|
|
||||||
|
lastPoint = currentPoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,38 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode;
|
package module.decode;
|
||||||
|
|
||||||
import java.io.File;
|
import alias.AliasList;
|
||||||
import java.util.ArrayList;
|
import alias.AliasModel;
|
||||||
import java.util.List;
|
import audio.AudioModule;
|
||||||
|
import controller.channel.Channel;
|
||||||
|
import controller.channel.Channel.ChannelType;
|
||||||
|
import controller.channel.ChannelModel;
|
||||||
|
import controller.channel.ChannelProcessingManager;
|
||||||
|
import controller.channel.map.ChannelMap;
|
||||||
|
import controller.channel.map.ChannelMapModel;
|
||||||
|
import filter.AllPassFilter;
|
||||||
|
import filter.FilterSet;
|
||||||
|
import filter.IFilter;
|
||||||
|
import gui.editor.EmptyValidatingEditor;
|
||||||
|
import gui.editor.ValidatingEditor;
|
||||||
|
import icon.IconManager;
|
||||||
import message.Message;
|
import message.Message;
|
||||||
import message.MessageDirection;
|
import message.MessageDirection;
|
||||||
import module.Module;
|
import module.Module;
|
||||||
@@ -95,479 +107,460 @@ import record.RecorderType;
|
|||||||
import record.config.RecordConfiguration;
|
import record.config.RecordConfiguration;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import util.TimeStamp;
|
import util.TimeStamp;
|
||||||
import alias.AliasList;
|
|
||||||
import alias.AliasModel;
|
import java.io.File;
|
||||||
import audio.AudioModule;
|
import java.util.ArrayList;
|
||||||
import controller.channel.Channel;
|
import java.util.List;
|
||||||
import controller.channel.Channel.ChannelType;
|
|
||||||
import controller.channel.ChannelModel;
|
|
||||||
import controller.channel.ChannelProcessingManager;
|
|
||||||
import controller.channel.map.ChannelMap;
|
|
||||||
import controller.channel.map.ChannelMapModel;
|
|
||||||
import filter.AllPassFilter;
|
|
||||||
import filter.FilterSet;
|
|
||||||
import filter.IFilter;
|
|
||||||
import gui.editor.EmptyValidatingEditor;
|
|
||||||
import gui.editor.ValidatingEditor;
|
|
||||||
|
|
||||||
public class DecoderFactory
|
public class DecoderFactory
|
||||||
{
|
{
|
||||||
public static final boolean NO_REMOVE_DC = false;
|
public static final boolean NO_REMOVE_DC = false;
|
||||||
public static final boolean REMOVE_DC = true;
|
public static final boolean REMOVE_DC = true;
|
||||||
|
|
||||||
public static final int NO_FREQUENCY_CORRECTION = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of one primary decoder and any auxiliary decoders, as
|
|
||||||
* specified in the configurations.
|
|
||||||
*
|
|
||||||
* @return list of configured decoders
|
|
||||||
*/
|
|
||||||
public static List<Module> getModules( ChannelModel channelModel,
|
|
||||||
ChannelMapModel channelMapModel,
|
|
||||||
ChannelProcessingManager channelProcessingManager,
|
|
||||||
AliasModel aliasModel,
|
|
||||||
Channel channel )
|
|
||||||
{
|
|
||||||
|
|
||||||
/* Get the optional alias list for the decode modules to use */
|
|
||||||
AliasList aliasList = aliasModel.getAliasList( channel.getAliasListName() );
|
|
||||||
|
|
||||||
List<Module> modules = getPrimaryModules( channelModel, channelMapModel,
|
|
||||||
channelProcessingManager, aliasList, channel );
|
|
||||||
|
|
||||||
modules.addAll( getAuxiliaryDecoders( channel.getAuxDecodeConfiguration(), aliasList ) );
|
|
||||||
|
|
||||||
return modules;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a primary decoder as specified in the decode configuration
|
|
||||||
*/
|
|
||||||
public static List<Module> getPrimaryModules( ChannelModel channelModel,
|
|
||||||
ChannelMapModel channelMapModel,
|
|
||||||
ChannelProcessingManager channelProcessingManager,
|
|
||||||
AliasList aliasList,
|
|
||||||
Channel channel )
|
|
||||||
{
|
|
||||||
List<Module> modules = new ArrayList<Module>();
|
|
||||||
|
|
||||||
ChannelType channelType = channel.getChannelType();
|
public static final int NO_FREQUENCY_CORRECTION = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of one primary decoder and any auxiliary decoders, as
|
||||||
|
* specified in the configurations.
|
||||||
|
*
|
||||||
|
* @return list of configured decoders
|
||||||
|
*/
|
||||||
|
public static List<Module> getModules(ChannelModel channelModel,
|
||||||
|
ChannelMapModel channelMapModel,
|
||||||
|
ChannelProcessingManager channelProcessingManager,
|
||||||
|
AliasModel aliasModel,
|
||||||
|
Channel channel)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Get the optional alias list for the decode modules to use */
|
||||||
|
AliasList aliasList = aliasModel.getAliasList(channel.getAliasListName());
|
||||||
|
|
||||||
|
List<Module> modules = getPrimaryModules(channelModel, channelMapModel,
|
||||||
|
channelProcessingManager, aliasList, channel);
|
||||||
|
|
||||||
|
modules.addAll(getAuxiliaryDecoders(channel.getAuxDecodeConfiguration(), aliasList));
|
||||||
|
|
||||||
|
return modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a primary decoder as specified in the decode configuration
|
||||||
|
*/
|
||||||
|
public static List<Module> getPrimaryModules(ChannelModel channelModel,
|
||||||
|
ChannelMapModel channelMapModel,
|
||||||
|
ChannelProcessingManager channelProcessingManager,
|
||||||
|
AliasList aliasList,
|
||||||
|
Channel channel)
|
||||||
|
{
|
||||||
|
List<Module> modules = new ArrayList<Module>();
|
||||||
|
|
||||||
|
ChannelType channelType = channel.getChannelType();
|
||||||
|
|
||||||
/* Baseband low-pass filter pass and stop frequencies */
|
/* Baseband low-pass filter pass and stop frequencies */
|
||||||
DecodeConfiguration decodeConfig = channel.getDecodeConfiguration();
|
DecodeConfiguration decodeConfig = channel.getDecodeConfiguration();
|
||||||
|
|
||||||
int iqPass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
|
|
||||||
int iqStop = iqPass + 1250;
|
|
||||||
|
|
||||||
RecordConfiguration recordConfig = channel.getRecordConfiguration();
|
int iqPass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
|
||||||
|
int iqStop = iqPass + 1250;
|
||||||
boolean recordAudio = recordConfig == null ? false :
|
|
||||||
recordConfig.getRecorders().contains( RecorderType.AUDIO );
|
|
||||||
|
|
||||||
switch( decodeConfig.getDecoderType() )
|
|
||||||
{
|
|
||||||
case AM:
|
|
||||||
modules.add( new AMDecoder( decodeConfig ) );
|
|
||||||
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.AM, channel.getName() ) );
|
|
||||||
modules.add( new AMDemodulatorModule() );
|
|
||||||
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
|
|
||||||
modules.add( new AudioModule( recordAudio ) );
|
|
||||||
break;
|
|
||||||
case NBFM:
|
|
||||||
modules.add( new NBFMDecoder( decodeConfig ) );
|
|
||||||
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.NBFM, channel.getName() ) );
|
|
||||||
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
|
|
||||||
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
|
|
||||||
modules.add( new AudioModule( recordAudio ) );
|
|
||||||
break;
|
|
||||||
case LTR_STANDARD:
|
|
||||||
MessageDirection direction = ((DecodeConfigLTRStandard)decodeConfig).getMessageDirection();
|
|
||||||
modules.add( new LTRStandardDecoder( aliasList, direction ) );
|
|
||||||
modules.add( new LTRStandardDecoderState( aliasList ) );
|
|
||||||
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
|
|
||||||
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
|
|
||||||
modules.add( new AudioModule( recordAudio ) );
|
|
||||||
break;
|
|
||||||
case LTR_NET:
|
|
||||||
modules.add( new LTRNetDecoder( (DecodeConfigLTRNet)decodeConfig, aliasList ) );
|
|
||||||
modules.add( new LTRNetDecoderState( aliasList ) );
|
|
||||||
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
|
|
||||||
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
|
|
||||||
modules.add( new AudioModule( recordAudio ) );
|
|
||||||
break;
|
|
||||||
case MPT1327:
|
|
||||||
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327)decodeConfig;
|
|
||||||
|
|
||||||
ChannelMap channelMap = channelMapModel
|
|
||||||
.getChannelMap( mptConfig.getChannelMapName() );
|
|
||||||
|
|
||||||
Sync sync = mptConfig.getSync();
|
|
||||||
|
|
||||||
modules.add( new MPT1327Decoder( aliasList, sync ) );
|
|
||||||
|
|
||||||
|
|
||||||
modules.add( new MPT1327DecoderState( aliasList, channelMap,
|
|
||||||
channelType, mptConfig.getCallTimeout() * 1000 ) );
|
|
||||||
|
|
||||||
if( channelType == ChannelType.STANDARD )
|
RecordConfiguration recordConfig = channel.getRecordConfiguration();
|
||||||
{
|
|
||||||
long timeout = mptConfig.getCallTimeout() * 1000; //convert to milliseconds
|
|
||||||
|
|
||||||
modules.add( new TrafficChannelManager( channelModel, channelProcessingManager,
|
boolean recordAudio = recordConfig == null ? false :
|
||||||
decodeConfig, recordConfig, channel.getSystem(),
|
recordConfig.getRecorders().contains(RecorderType.AUDIO);
|
||||||
channel.getSite(), ( aliasList != null ? aliasList.getName() : null ), timeout,
|
|
||||||
mptConfig.getTrafficChannelPoolSize() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
|
|
||||||
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
|
|
||||||
modules.add( new AudioModule( recordAudio ) );
|
|
||||||
break;
|
|
||||||
case PASSPORT:
|
|
||||||
modules.add( new PassportDecoder( decodeConfig, aliasList ) );
|
|
||||||
modules.add( new PassportDecoderState( aliasList ) );
|
|
||||||
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
|
|
||||||
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
|
|
||||||
modules.add( new AudioModule( recordAudio ) );
|
|
||||||
break;
|
|
||||||
case P25_PHASE1:
|
|
||||||
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1)decodeConfig;
|
|
||||||
|
|
||||||
Modulation modulation = p25Config.getModulation();
|
switch(decodeConfig.getDecoderType())
|
||||||
|
{
|
||||||
|
case AM:
|
||||||
switch( modulation )
|
modules.add(new AMDecoder(decodeConfig));
|
||||||
{
|
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.AM, channel.getName()));
|
||||||
case C4FM:
|
modules.add(new AMDemodulatorModule());
|
||||||
modules.add( new FMDemodulatorModule( 6750, 7500 ) );
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
modules.add( new P25_C4FMDecoder( aliasList, decodeConfig.getAFCMaximumCorrection() ) );
|
modules.add(new AudioModule(recordAudio));
|
||||||
modules.add( new P25DecoderState( aliasList, channelType,
|
break;
|
||||||
Modulation.C4FM, p25Config.getIgnoreDataCalls() ) );
|
case NBFM:
|
||||||
break;
|
modules.add(new NBFMDecoder(decodeConfig));
|
||||||
case CQPSK:
|
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.NBFM, channel.getName()));
|
||||||
modules.add( new P25_LSMDecoder( aliasList ) );
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
modules.add( new P25DecoderState( aliasList, channelType,
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
Modulation.CQPSK, p25Config.getIgnoreDataCalls() ) );
|
modules.add(new AudioModule(recordAudio));
|
||||||
break;
|
break;
|
||||||
default:
|
case LTR_STANDARD:
|
||||||
throw new IllegalArgumentException( "Unrecognized P25 "
|
MessageDirection direction = ((DecodeConfigLTRStandard) decodeConfig).getMessageDirection();
|
||||||
+ "Phase 1 Modulation [" + modulation + "]" );
|
modules.add(new LTRStandardDecoder(aliasList, direction));
|
||||||
}
|
modules.add(new LTRStandardDecoderState(aliasList));
|
||||||
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
|
modules.add(new AudioModule(recordAudio));
|
||||||
|
break;
|
||||||
|
case LTR_NET:
|
||||||
|
modules.add(new LTRNetDecoder((DecodeConfigLTRNet) decodeConfig, aliasList));
|
||||||
|
modules.add(new LTRNetDecoderState(aliasList));
|
||||||
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
|
modules.add(new AudioModule(recordAudio));
|
||||||
|
break;
|
||||||
|
case MPT1327:
|
||||||
|
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327) decodeConfig;
|
||||||
|
|
||||||
if( channelType == ChannelType.STANDARD )
|
ChannelMap channelMap = channelMapModel
|
||||||
{
|
.getChannelMap(mptConfig.getChannelMapName());
|
||||||
//Set call timeout to 3 seconds for P25 traffic channels
|
|
||||||
long timeout = 3000;
|
|
||||||
|
|
||||||
modules.add( new TrafficChannelManager( channelModel,
|
Sync sync = mptConfig.getSync();
|
||||||
channelProcessingManager, decodeConfig,
|
|
||||||
recordConfig, channel.getSystem(), channel.getSite(),
|
|
||||||
( aliasList != null ? aliasList.getName() : null ), timeout,
|
|
||||||
p25Config.getTrafficChannelPoolSize() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
modules.add( new P25AudioModule( recordAudio ) );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"Unknown decoder type [" +
|
|
||||||
decodeConfig.getDecoderType().toString() + "]" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return modules;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a list of auxiliary decoders, as specified in the configuration
|
|
||||||
*
|
|
||||||
* @param config - auxiliary configuration
|
|
||||||
* @param aliasList - optional alias list
|
|
||||||
* @return - list of auxiliary decoders
|
|
||||||
*/
|
|
||||||
public static List<Module> getAuxiliaryDecoders( AuxDecodeConfiguration config,
|
|
||||||
AliasList aliasList )
|
|
||||||
{
|
|
||||||
List<Module> modules = new ArrayList<>();
|
|
||||||
|
|
||||||
if( config != null )
|
modules.add(new MPT1327Decoder(aliasList, sync));
|
||||||
{
|
|
||||||
for( DecoderType auxDecoder: config.getAuxDecoders() )
|
|
||||||
{
|
|
||||||
switch( auxDecoder )
|
|
||||||
{
|
|
||||||
case FLEETSYNC2:
|
|
||||||
modules.add( new Fleetsync2Decoder( aliasList ) );
|
|
||||||
modules.add( new Fleetsync2DecoderState( aliasList ) );
|
|
||||||
break;
|
|
||||||
case MDC1200:
|
|
||||||
modules.add( new MDCDecoder( aliasList ) );
|
|
||||||
modules.add( new MDCDecoderState( aliasList ) );
|
|
||||||
break;
|
|
||||||
case LJ_1200:
|
|
||||||
modules.add( new LJ1200Decoder( aliasList ) );
|
|
||||||
modules.add( new LJ1200DecoderState( aliasList ) );
|
|
||||||
break;
|
|
||||||
case TAIT_1200:
|
|
||||||
modules.add( new Tait1200Decoder( aliasList ) );
|
|
||||||
modules.add( new Tait1200DecoderState( aliasList ) );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException( "Unrecognized auxiliary "
|
|
||||||
+ "decoder type [" + auxDecoder + "]" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return modules;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DecoderPanel getDecoderPanel( SettingsManager settingsManager,
|
|
||||||
DecoderState decoderState )
|
|
||||||
{
|
|
||||||
switch( decoderState.getDecoderType() )
|
|
||||||
{
|
|
||||||
case AM:
|
|
||||||
return new AMDecoderPanel( settingsManager, decoderState );
|
|
||||||
case FLEETSYNC2:
|
|
||||||
return new Fleetsync2DecoderPanel( settingsManager,
|
|
||||||
(Fleetsync2DecoderState)decoderState );
|
|
||||||
case LJ_1200:
|
|
||||||
return new LJ1200DecoderPanel( settingsManager,
|
|
||||||
(LJ1200DecoderState)decoderState );
|
|
||||||
case LTR_NET:
|
|
||||||
return new LTRNetDecoderPanel( settingsManager,
|
|
||||||
(LTRNetDecoderState)decoderState );
|
|
||||||
case LTR_STANDARD:
|
|
||||||
return new LTRStandardDecoderPanel( settingsManager,
|
|
||||||
(LTRStandardDecoderState)decoderState );
|
|
||||||
case MDC1200:
|
|
||||||
return new MDCDecoderPanel( settingsManager,
|
|
||||||
(MDCDecoderState)decoderState );
|
|
||||||
case MPT1327:
|
|
||||||
return new MPT1327DecoderPanel( settingsManager,
|
|
||||||
(MPT1327DecoderState)decoderState );
|
|
||||||
case NBFM:
|
|
||||||
return new NBFMDecoderPanel( settingsManager, decoderState );
|
|
||||||
case P25_PHASE1:
|
|
||||||
return new P25DecoderPanel( settingsManager,
|
|
||||||
(P25DecoderState)decoderState );
|
|
||||||
case PASSPORT:
|
|
||||||
return new PassportDecoderPanel( settingsManager,
|
|
||||||
(PassportDecoderState)decoderState );
|
|
||||||
case TAIT_1200:
|
|
||||||
return new Tait1200DecoderPanel( settingsManager,
|
|
||||||
(Tait1200DecoderState)decoderState );
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException( "Unrecognized decoder: " +
|
|
||||||
decoderState.getDecoderType().getDisplayString() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assembles a filter set containing filters for the primary channel
|
|
||||||
* decoder and each of the auxiliary decoders
|
|
||||||
*/
|
|
||||||
public static FilterSet<Message> getMessageFilters( List<Module> modules )
|
|
||||||
{
|
|
||||||
FilterSet<Message> filterSet = new FilterSet<>();
|
|
||||||
|
|
||||||
for( Module module: modules )
|
modules.add(new MPT1327DecoderState(aliasList, channelMap,
|
||||||
{
|
channelType, mptConfig.getCallTimeout() * 1000));
|
||||||
if( module instanceof Decoder )
|
|
||||||
{
|
if(channelType == ChannelType.STANDARD)
|
||||||
filterSet.addFilters( getMessageFilter(
|
{
|
||||||
((Decoder)module).getDecoderType() ) );
|
long timeout = mptConfig.getCallTimeout() * 1000; //convert to milliseconds
|
||||||
}
|
|
||||||
}
|
modules.add(new TrafficChannelManager(channelModel, channelProcessingManager,
|
||||||
|
decodeConfig, recordConfig, channel.getSystem(),
|
||||||
|
channel.getSite(), (aliasList != null ? aliasList.getName() : null), timeout,
|
||||||
|
mptConfig.getTrafficChannelPoolSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
|
modules.add(new AudioModule(recordAudio));
|
||||||
|
break;
|
||||||
|
case PASSPORT:
|
||||||
|
modules.add(new PassportDecoder(decodeConfig, aliasList));
|
||||||
|
modules.add(new PassportDecoderState(aliasList));
|
||||||
|
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||||
|
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||||
|
modules.add(new AudioModule(recordAudio));
|
||||||
|
break;
|
||||||
|
case P25_PHASE1:
|
||||||
|
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1) decodeConfig;
|
||||||
|
|
||||||
|
Modulation modulation = p25Config.getModulation();
|
||||||
|
|
||||||
|
|
||||||
|
switch(modulation)
|
||||||
|
{
|
||||||
|
case C4FM:
|
||||||
|
modules.add(new FMDemodulatorModule(6750, 7500));
|
||||||
|
modules.add(new P25_C4FMDecoder(aliasList, decodeConfig.getAFCMaximumCorrection()));
|
||||||
|
modules.add(new P25DecoderState(aliasList, channelType,
|
||||||
|
Modulation.C4FM, p25Config.getIgnoreDataCalls()));
|
||||||
|
break;
|
||||||
|
case CQPSK:
|
||||||
|
modules.add(new P25_LSMDecoder(aliasList));
|
||||||
|
modules.add(new P25DecoderState(aliasList, channelType,
|
||||||
|
Modulation.CQPSK, p25Config.getIgnoreDataCalls()));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unrecognized P25 "
|
||||||
|
+ "Phase 1 Modulation [" + modulation + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(channelType == ChannelType.STANDARD)
|
||||||
|
{
|
||||||
|
//Set call timeout to 3 seconds for P25 traffic channels
|
||||||
|
long timeout = 3000;
|
||||||
|
|
||||||
|
modules.add(new TrafficChannelManager(channelModel,
|
||||||
|
channelProcessingManager, decodeConfig,
|
||||||
|
recordConfig, channel.getSystem(), channel.getSite(),
|
||||||
|
(aliasList != null ? aliasList.getName() : null), timeout,
|
||||||
|
p25Config.getTrafficChannelPoolSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
modules.add(new P25AudioModule(recordAudio));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Unknown decoder type [" +
|
||||||
|
decodeConfig.getDecoderType().toString() + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
return modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a list of auxiliary decoders, as specified in the configuration
|
||||||
|
*
|
||||||
|
* @param config - auxiliary configuration
|
||||||
|
* @param aliasList - optional alias list
|
||||||
|
* @return - list of auxiliary decoders
|
||||||
|
*/
|
||||||
|
public static List<Module> getAuxiliaryDecoders(AuxDecodeConfiguration config,
|
||||||
|
AliasList aliasList)
|
||||||
|
{
|
||||||
|
List<Module> modules = new ArrayList<>();
|
||||||
|
|
||||||
|
if(config != null)
|
||||||
|
{
|
||||||
|
for(DecoderType auxDecoder : config.getAuxDecoders())
|
||||||
|
{
|
||||||
|
switch(auxDecoder)
|
||||||
|
{
|
||||||
|
case FLEETSYNC2:
|
||||||
|
modules.add(new Fleetsync2Decoder(aliasList));
|
||||||
|
modules.add(new Fleetsync2DecoderState(aliasList));
|
||||||
|
break;
|
||||||
|
case MDC1200:
|
||||||
|
modules.add(new MDCDecoder(aliasList));
|
||||||
|
modules.add(new MDCDecoderState(aliasList));
|
||||||
|
break;
|
||||||
|
case LJ_1200:
|
||||||
|
modules.add(new LJ1200Decoder(aliasList));
|
||||||
|
modules.add(new LJ1200DecoderState(aliasList));
|
||||||
|
break;
|
||||||
|
case TAIT_1200:
|
||||||
|
modules.add(new Tait1200Decoder(aliasList));
|
||||||
|
modules.add(new Tait1200DecoderState(aliasList));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unrecognized auxiliary "
|
||||||
|
+ "decoder type [" + auxDecoder + "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DecoderPanel getDecoderPanel(IconManager iconManager, SettingsManager settingsManager,
|
||||||
|
DecoderState decoderState)
|
||||||
|
{
|
||||||
|
switch(decoderState.getDecoderType())
|
||||||
|
{
|
||||||
|
case AM:
|
||||||
|
return new AMDecoderPanel(iconManager, settingsManager, decoderState);
|
||||||
|
case FLEETSYNC2:
|
||||||
|
return new Fleetsync2DecoderPanel(iconManager, settingsManager, (Fleetsync2DecoderState) decoderState);
|
||||||
|
case LJ_1200:
|
||||||
|
return new LJ1200DecoderPanel(iconManager, settingsManager, (LJ1200DecoderState) decoderState);
|
||||||
|
case LTR_NET:
|
||||||
|
return new LTRNetDecoderPanel(iconManager, settingsManager, (LTRNetDecoderState) decoderState);
|
||||||
|
case LTR_STANDARD:
|
||||||
|
return new LTRStandardDecoderPanel(iconManager, settingsManager, (LTRStandardDecoderState) decoderState);
|
||||||
|
case MDC1200:
|
||||||
|
return new MDCDecoderPanel(iconManager, settingsManager, (MDCDecoderState) decoderState);
|
||||||
|
case MPT1327:
|
||||||
|
return new MPT1327DecoderPanel(iconManager, settingsManager, (MPT1327DecoderState) decoderState);
|
||||||
|
case NBFM:
|
||||||
|
return new NBFMDecoderPanel(iconManager, settingsManager, decoderState);
|
||||||
|
case P25_PHASE1:
|
||||||
|
return new P25DecoderPanel(iconManager, settingsManager, (P25DecoderState) decoderState);
|
||||||
|
case PASSPORT:
|
||||||
|
return new PassportDecoderPanel(iconManager, settingsManager, (PassportDecoderState) decoderState);
|
||||||
|
case TAIT_1200:
|
||||||
|
return new Tait1200DecoderPanel(iconManager, settingsManager, (Tait1200DecoderState) decoderState);
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unrecognized decoder: " +
|
||||||
|
decoderState.getDecoderType().getDisplayString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assembles a filter set containing filters for the primary channel
|
||||||
|
* decoder and each of the auxiliary decoders
|
||||||
|
*/
|
||||||
|
public static FilterSet<Message> getMessageFilters(List<Module> modules)
|
||||||
|
{
|
||||||
|
FilterSet<Message> filterSet = new FilterSet<>();
|
||||||
|
|
||||||
|
for(Module module : modules)
|
||||||
|
{
|
||||||
|
if(module instanceof Decoder)
|
||||||
|
{
|
||||||
|
filterSet.addFilters(getMessageFilter(
|
||||||
|
((Decoder) module).getDecoderType()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If we don't have any filters, add an ALL-PASS filter */
|
/* If we don't have any filters, add an ALL-PASS filter */
|
||||||
if( filterSet.getFilters().isEmpty() )
|
if(filterSet.getFilters().isEmpty())
|
||||||
{
|
{
|
||||||
filterSet.addFilter( new AllPassFilter<Message>() );
|
filterSet.addFilter(new AllPassFilter<Message>());
|
||||||
}
|
}
|
||||||
|
|
||||||
return filterSet;
|
return filterSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a set of IMessageFilter objects (FilterSets or Filters) that
|
|
||||||
* can process all of the messages produced by the specified decoder type.
|
|
||||||
*/
|
|
||||||
public static List<IFilter<Message>> getMessageFilter( DecoderType decoder )
|
|
||||||
{
|
|
||||||
ArrayList<IFilter<Message>> filters = new ArrayList<IFilter<Message>>();
|
|
||||||
|
|
||||||
switch( decoder )
|
/**
|
||||||
{
|
* Returns a set of IMessageFilter objects (FilterSets or Filters) that
|
||||||
case FLEETSYNC2:
|
* can process all of the messages produced by the specified decoder type.
|
||||||
filters.add( new FleetsyncMessageFilter() );
|
*/
|
||||||
break;
|
public static List<IFilter<Message>> getMessageFilter(DecoderType decoder)
|
||||||
case LJ_1200:
|
{
|
||||||
filters.add( new LJ1200MessageFilter() );
|
ArrayList<IFilter<Message>> filters = new ArrayList<IFilter<Message>>();
|
||||||
break;
|
|
||||||
case LTR_NET:
|
|
||||||
filters.add( new LTRNetMessageFilter() );
|
|
||||||
break;
|
|
||||||
case LTR_STANDARD:
|
|
||||||
filters.add( new LTRStandardMessageFilter() );
|
|
||||||
break;
|
|
||||||
case MDC1200:
|
|
||||||
filters.add( new MDCMessageFilter() );
|
|
||||||
break;
|
|
||||||
case MPT1327:
|
|
||||||
filters.add( new MPT1327MessageFilter() );
|
|
||||||
break;
|
|
||||||
case P25_PHASE1:
|
|
||||||
case P25_PHASE2:
|
|
||||||
filters.add( new P25MessageFilterSet() );
|
|
||||||
break;
|
|
||||||
case PASSPORT:
|
|
||||||
filters.add( new PassportMessageFilter() );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DecodeConfiguration getDefaultDecodeConfiguration()
|
switch(decoder)
|
||||||
{
|
{
|
||||||
return getDecodeConfiguration( DecoderType.NBFM );
|
case FLEETSYNC2:
|
||||||
}
|
filters.add(new FleetsyncMessageFilter());
|
||||||
|
break;
|
||||||
public static DecodeConfiguration getDecodeConfiguration( DecoderType decoder )
|
case LJ_1200:
|
||||||
{
|
filters.add(new LJ1200MessageFilter());
|
||||||
DecodeConfiguration retVal;
|
break;
|
||||||
|
case LTR_NET:
|
||||||
|
filters.add(new LTRNetMessageFilter());
|
||||||
|
break;
|
||||||
|
case LTR_STANDARD:
|
||||||
|
filters.add(new LTRStandardMessageFilter());
|
||||||
|
break;
|
||||||
|
case MDC1200:
|
||||||
|
filters.add(new MDCMessageFilter());
|
||||||
|
break;
|
||||||
|
case MPT1327:
|
||||||
|
filters.add(new MPT1327MessageFilter());
|
||||||
|
break;
|
||||||
|
case P25_PHASE1:
|
||||||
|
case P25_PHASE2:
|
||||||
|
filters.add(new P25MessageFilterSet());
|
||||||
|
break;
|
||||||
|
case PASSPORT:
|
||||||
|
filters.add(new PassportMessageFilter());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch( decoder )
|
return filters;
|
||||||
{
|
}
|
||||||
case AM:
|
|
||||||
return new DecodeConfigAM();
|
|
||||||
case LTR_NET:
|
|
||||||
return new DecodeConfigLTRNet();
|
|
||||||
case LTR_STANDARD:
|
|
||||||
return new DecodeConfigLTRStandard();
|
|
||||||
case MPT1327:
|
|
||||||
return new DecodeConfigMPT1327();
|
|
||||||
case NBFM:
|
|
||||||
return new DecodeConfigNBFM();
|
|
||||||
case PASSPORT:
|
|
||||||
return new DecodeConfigPassport();
|
|
||||||
case P25_PHASE1:
|
|
||||||
return new DecodeConfigP25Phase1();
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException( "DecodeConfigFactory - unknown decoder type ["
|
|
||||||
+ decoder.toString() + "]" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ValidatingEditor<Channel> getEditor( DecoderType type, ChannelMapModel model )
|
|
||||||
{
|
|
||||||
switch( type )
|
|
||||||
{
|
|
||||||
case AM:
|
|
||||||
return new AMDecoderEditor();
|
|
||||||
case LTR_NET:
|
|
||||||
return new LTRNetDecoderEditor();
|
|
||||||
case LTR_STANDARD:
|
|
||||||
return new LTRStandardDecoderEditor();
|
|
||||||
case MPT1327:
|
|
||||||
return new MPT1327DecoderEditor( model );
|
|
||||||
case NBFM:
|
|
||||||
return new NBFMDecoderEditor();
|
|
||||||
case P25_PHASE1:
|
|
||||||
return new P25DecoderEditor();
|
|
||||||
case PASSPORT:
|
|
||||||
return new PassportDecoderEditor();
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new EmptyValidatingEditor<Channel>( "a decoder" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public static DecodeConfiguration getDefaultDecodeConfiguration()
|
||||||
* Creates a copy of the configuration
|
{
|
||||||
*/
|
return getDecodeConfiguration(DecoderType.NBFM);
|
||||||
public static DecodeConfiguration copy( DecodeConfiguration config )
|
}
|
||||||
{
|
|
||||||
if( config != null )
|
|
||||||
{
|
|
||||||
switch( config.getDecoderType() )
|
|
||||||
{
|
|
||||||
case AM:
|
|
||||||
DecodeConfigAM originalAM = (DecodeConfigAM)config;
|
|
||||||
DecodeConfigAM copyAM = new DecodeConfigAM();
|
|
||||||
copyAM.setAFC( originalAM.getAFC() );
|
|
||||||
copyAM.setAFCMaximumCorrection( originalAM.getAFCMaximumCorrection() );
|
|
||||||
return copyAM;
|
|
||||||
case LTR_NET:
|
|
||||||
DecodeConfigLTRNet originalLTRNet = (DecodeConfigLTRNet)config;
|
|
||||||
DecodeConfigLTRNet copyLTRNet = new DecodeConfigLTRNet();
|
|
||||||
copyLTRNet.setAFC( originalLTRNet.getAFC() );
|
|
||||||
copyLTRNet.setAFCMaximumCorrection( originalLTRNet.getAFCMaximumCorrection() );
|
|
||||||
copyLTRNet.setMessageDirection( originalLTRNet.getMessageDirection() );
|
|
||||||
return copyLTRNet;
|
|
||||||
case LTR_STANDARD:
|
|
||||||
DecodeConfigLTRStandard originalLTRStandard = (DecodeConfigLTRStandard)config;
|
|
||||||
DecodeConfigLTRStandard copyLTRStandard = new DecodeConfigLTRStandard();
|
|
||||||
copyLTRStandard.setAFC( originalLTRStandard.getAFC() );
|
|
||||||
copyLTRStandard.setAFCMaximumCorrection( originalLTRStandard.getAFCMaximumCorrection() );
|
|
||||||
copyLTRStandard.setMessageDirection( originalLTRStandard.getMessageDirection() );
|
|
||||||
return copyLTRStandard;
|
|
||||||
case MPT1327:
|
|
||||||
DecodeConfigMPT1327 originalMPT = (DecodeConfigMPT1327)config;
|
|
||||||
DecodeConfigMPT1327 copyMPT = new DecodeConfigMPT1327();
|
|
||||||
copyMPT.setAFC( originalMPT.getAFC() );
|
|
||||||
copyMPT.setAFCMaximumCorrection( originalMPT.getAFCMaximumCorrection() );
|
|
||||||
copyMPT.setCallTimeout( originalMPT.getCallTimeout() );
|
|
||||||
copyMPT.setChannelMapName( originalMPT.getChannelMapName() );
|
|
||||||
copyMPT.setSync( originalMPT.getSync() );
|
|
||||||
copyMPT.setTrafficChannelPoolSize( originalMPT.getTrafficChannelPoolSize() );
|
|
||||||
return copyMPT;
|
|
||||||
case NBFM:
|
|
||||||
DecodeConfigNBFM originalNBFM = (DecodeConfigNBFM)config;
|
|
||||||
DecodeConfigNBFM copyNBFM = new DecodeConfigNBFM();
|
|
||||||
copyNBFM.setAFC( originalNBFM.getAFC() );
|
|
||||||
copyNBFM.setAFCMaximumCorrection( originalNBFM.getAFCMaximumCorrection() );
|
|
||||||
return copyNBFM;
|
|
||||||
case P25_PHASE1:
|
|
||||||
DecodeConfigP25Phase1 originalP25 = (DecodeConfigP25Phase1)config;
|
|
||||||
DecodeConfigP25Phase1 copyP25 = new DecodeConfigP25Phase1();
|
|
||||||
copyP25.setAFC( originalP25.getAFC() );
|
|
||||||
copyP25.setAFCMaximumCorrection( originalP25.getAFCMaximumCorrection() );
|
|
||||||
copyP25.setIgnoreDataCalls( originalP25.getIgnoreDataCalls() );
|
|
||||||
copyP25.setModulation( originalP25.getModulation() );
|
|
||||||
copyP25.setTrafficChannelPoolSize( originalP25.getTrafficChannelPoolSize() );
|
|
||||||
return copyP25;
|
|
||||||
case PASSPORT:
|
|
||||||
DecodeConfigPassport originalPass = (DecodeConfigPassport)config;
|
|
||||||
DecodeConfigPassport copyPass = new DecodeConfigPassport();
|
|
||||||
copyPass.setAFC( originalPass.getAFC() );
|
|
||||||
copyPass.setAFCMaximumCorrection( originalPass.getAFCMaximumCorrection() );
|
|
||||||
return copyPass;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException( "Unrecognized decoder "
|
|
||||||
+ "configuration type:" + config.getDecoderType() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getRecordingFilename( String token )
|
public static DecodeConfiguration getDecodeConfiguration(DecoderType decoder)
|
||||||
{
|
{
|
||||||
//Get the base recording filename
|
DecodeConfiguration retVal;
|
||||||
|
|
||||||
|
switch(decoder)
|
||||||
|
{
|
||||||
|
case AM:
|
||||||
|
return new DecodeConfigAM();
|
||||||
|
case LTR_NET:
|
||||||
|
return new DecodeConfigLTRNet();
|
||||||
|
case LTR_STANDARD:
|
||||||
|
return new DecodeConfigLTRStandard();
|
||||||
|
case MPT1327:
|
||||||
|
return new DecodeConfigMPT1327();
|
||||||
|
case NBFM:
|
||||||
|
return new DecodeConfigNBFM();
|
||||||
|
case PASSPORT:
|
||||||
|
return new DecodeConfigPassport();
|
||||||
|
case P25_PHASE1:
|
||||||
|
return new DecodeConfigP25Phase1();
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("DecodeConfigFactory - unknown decoder type ["
|
||||||
|
+ decoder.toString() + "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ValidatingEditor<Channel> getEditor(DecoderType type, ChannelMapModel model)
|
||||||
|
{
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case AM:
|
||||||
|
return new AMDecoderEditor();
|
||||||
|
case LTR_NET:
|
||||||
|
return new LTRNetDecoderEditor();
|
||||||
|
case LTR_STANDARD:
|
||||||
|
return new LTRStandardDecoderEditor();
|
||||||
|
case MPT1327:
|
||||||
|
return new MPT1327DecoderEditor(model);
|
||||||
|
case NBFM:
|
||||||
|
return new NBFMDecoderEditor();
|
||||||
|
case P25_PHASE1:
|
||||||
|
return new P25DecoderEditor();
|
||||||
|
case PASSPORT:
|
||||||
|
return new PassportDecoderEditor();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new EmptyValidatingEditor<Channel>("a decoder");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a copy of the configuration
|
||||||
|
*/
|
||||||
|
public static DecodeConfiguration copy(DecodeConfiguration config)
|
||||||
|
{
|
||||||
|
if(config != null)
|
||||||
|
{
|
||||||
|
switch(config.getDecoderType())
|
||||||
|
{
|
||||||
|
case AM:
|
||||||
|
DecodeConfigAM originalAM = (DecodeConfigAM) config;
|
||||||
|
DecodeConfigAM copyAM = new DecodeConfigAM();
|
||||||
|
copyAM.setAFC(originalAM.getAFC());
|
||||||
|
copyAM.setAFCMaximumCorrection(originalAM.getAFCMaximumCorrection());
|
||||||
|
return copyAM;
|
||||||
|
case LTR_NET:
|
||||||
|
DecodeConfigLTRNet originalLTRNet = (DecodeConfigLTRNet) config;
|
||||||
|
DecodeConfigLTRNet copyLTRNet = new DecodeConfigLTRNet();
|
||||||
|
copyLTRNet.setAFC(originalLTRNet.getAFC());
|
||||||
|
copyLTRNet.setAFCMaximumCorrection(originalLTRNet.getAFCMaximumCorrection());
|
||||||
|
copyLTRNet.setMessageDirection(originalLTRNet.getMessageDirection());
|
||||||
|
return copyLTRNet;
|
||||||
|
case LTR_STANDARD:
|
||||||
|
DecodeConfigLTRStandard originalLTRStandard = (DecodeConfigLTRStandard) config;
|
||||||
|
DecodeConfigLTRStandard copyLTRStandard = new DecodeConfigLTRStandard();
|
||||||
|
copyLTRStandard.setAFC(originalLTRStandard.getAFC());
|
||||||
|
copyLTRStandard.setAFCMaximumCorrection(originalLTRStandard.getAFCMaximumCorrection());
|
||||||
|
copyLTRStandard.setMessageDirection(originalLTRStandard.getMessageDirection());
|
||||||
|
return copyLTRStandard;
|
||||||
|
case MPT1327:
|
||||||
|
DecodeConfigMPT1327 originalMPT = (DecodeConfigMPT1327) config;
|
||||||
|
DecodeConfigMPT1327 copyMPT = new DecodeConfigMPT1327();
|
||||||
|
copyMPT.setAFC(originalMPT.getAFC());
|
||||||
|
copyMPT.setAFCMaximumCorrection(originalMPT.getAFCMaximumCorrection());
|
||||||
|
copyMPT.setCallTimeout(originalMPT.getCallTimeout());
|
||||||
|
copyMPT.setChannelMapName(originalMPT.getChannelMapName());
|
||||||
|
copyMPT.setSync(originalMPT.getSync());
|
||||||
|
copyMPT.setTrafficChannelPoolSize(originalMPT.getTrafficChannelPoolSize());
|
||||||
|
return copyMPT;
|
||||||
|
case NBFM:
|
||||||
|
DecodeConfigNBFM originalNBFM = (DecodeConfigNBFM) config;
|
||||||
|
DecodeConfigNBFM copyNBFM = new DecodeConfigNBFM();
|
||||||
|
copyNBFM.setAFC(originalNBFM.getAFC());
|
||||||
|
copyNBFM.setAFCMaximumCorrection(originalNBFM.getAFCMaximumCorrection());
|
||||||
|
return copyNBFM;
|
||||||
|
case P25_PHASE1:
|
||||||
|
DecodeConfigP25Phase1 originalP25 = (DecodeConfigP25Phase1) config;
|
||||||
|
DecodeConfigP25Phase1 copyP25 = new DecodeConfigP25Phase1();
|
||||||
|
copyP25.setAFC(originalP25.getAFC());
|
||||||
|
copyP25.setAFCMaximumCorrection(originalP25.getAFCMaximumCorrection());
|
||||||
|
copyP25.setIgnoreDataCalls(originalP25.getIgnoreDataCalls());
|
||||||
|
copyP25.setModulation(originalP25.getModulation());
|
||||||
|
copyP25.setTrafficChannelPoolSize(originalP25.getTrafficChannelPoolSize());
|
||||||
|
return copyP25;
|
||||||
|
case PASSPORT:
|
||||||
|
DecodeConfigPassport originalPass = (DecodeConfigPassport) config;
|
||||||
|
DecodeConfigPassport copyPass = new DecodeConfigPassport();
|
||||||
|
copyPass.setAFC(originalPass.getAFC());
|
||||||
|
copyPass.setAFCMaximumCorrection(originalPass.getAFCMaximumCorrection());
|
||||||
|
return copyPass;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unrecognized decoder "
|
||||||
|
+ "configuration type:" + config.getDecoderType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getRecordingFilename(String token)
|
||||||
|
{
|
||||||
|
//Get the base recording filename
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append( SystemProperties.getInstance()
|
sb.append(SystemProperties.getInstance()
|
||||||
.getApplicationFolder( "recordings" ) );
|
.getApplicationFolder("recordings"));
|
||||||
sb.append( File.separator );
|
sb.append(File.separator);
|
||||||
sb.append( TimeStamp.getTimeStamp( "_" ) );
|
sb.append(TimeStamp.getTimeStamp("_"));
|
||||||
sb.append( "_" );
|
sb.append("_");
|
||||||
sb.append( token );
|
sb.append(token);
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,82 +1,84 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.am;
|
package module.decode.am;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import icon.IconManager;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import module.decode.state.DecoderState;
|
import module.decode.state.DecoderState;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
public class AMDecoderPanel extends DecoderPanel
|
public class AMDecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( "AM" );
|
private JLabel mProtocol = new JLabel("AM");
|
||||||
|
|
||||||
public AMDecoderPanel( SettingsManager settingsManager, DecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
|
||||||
|
|
||||||
mProtocol.setFont( mFontDecoder );
|
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
add( mProtocol, "wrap" );
|
public AMDecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
|
||||||
}
|
{
|
||||||
|
super(iconManager, settingsManager, decoderState);
|
||||||
|
|
||||||
@Override
|
init();
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
}
|
||||||
|
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
|
|
||||||
|
mProtocol.setFont(mFontDecoder);
|
||||||
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
add(mProtocol, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
super.settingChanged( setting );
|
super.settingChanged(setting);
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
if(setting instanceof ColorSetting)
|
||||||
{
|
{
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
switch(colorSetting.getColorSettingName())
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
if( mProtocol != null )
|
if(mProtocol != null)
|
||||||
{
|
{
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,28 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.event;
|
package module.decode.event;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
|
||||||
|
|
||||||
import settings.SettingsManager;
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
|
import icon.IconManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom renderer for JTable cells that contain Alias objects. Renders the
|
* Custom renderer for JTable cells that contain Alias objects. Renders the
|
||||||
@@ -30,45 +31,45 @@ import alias.Alias;
|
|||||||
*/
|
*/
|
||||||
public class CallEventAliasCellRenderer extends DefaultTableCellRenderer
|
public class CallEventAliasCellRenderer extends DefaultTableCellRenderer
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private SettingsManager mSettingsManager;
|
private IconManager mIconManager;
|
||||||
|
|
||||||
public CallEventAliasCellRenderer( SettingsManager settingsManager )
|
public CallEventAliasCellRenderer(IconManager iconManager)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
mSettingsManager = settingsManager;
|
mIconManager = iconManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue( Object obj )
|
public void setValue(Object obj)
|
||||||
{
|
{
|
||||||
if( obj != null && obj instanceof Alias )
|
if(obj != null && obj instanceof Alias)
|
||||||
{
|
{
|
||||||
Alias alias = (Alias)obj;
|
Alias alias = (Alias) obj;
|
||||||
|
|
||||||
setText( alias.getName() );
|
setText(alias.getName());
|
||||||
|
|
||||||
ImageIcon icon = getIcon( alias, SettingsManager.DEFAULT_ICON_SIZE );
|
ImageIcon icon = getIcon(alias, IconManager.DEFAULT_ICON_SIZE);
|
||||||
|
|
||||||
if( icon != null )
|
if(icon != null)
|
||||||
{
|
{
|
||||||
setIcon( icon );
|
setIcon(icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setText( " " );
|
setText(" ");
|
||||||
setIcon( null );
|
setIcon(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImageIcon getIcon( Alias alias, int height )
|
private ImageIcon getIcon(Alias alias, int height)
|
||||||
{
|
{
|
||||||
if( mSettingsManager != null && alias != null )
|
if(mIconManager != null && alias != null)
|
||||||
{
|
{
|
||||||
return mSettingsManager.getImageIcon( alias.getIconName(), height );
|
return mIconManager.getIcon(alias.getIconName(), height);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,34 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.event;
|
package module.decode.event;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.JTable;
|
|
||||||
|
|
||||||
import module.ProcessingChain;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
import controller.channel.Channel;
|
import controller.channel.Channel;
|
||||||
import controller.channel.ChannelEvent;
|
import controller.channel.ChannelEvent;
|
||||||
import controller.channel.ChannelEvent.Event;
|
import controller.channel.ChannelEvent.Event;
|
||||||
import controller.channel.ChannelEventListener;
|
import controller.channel.ChannelEventListener;
|
||||||
import controller.channel.ChannelProcessingManager;
|
import controller.channel.ChannelProcessingManager;
|
||||||
|
import icon.IconManager;
|
||||||
|
import module.ProcessingChain;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class CallEventPanel extends JPanel implements ChannelEventListener
|
public class CallEventPanel extends JPanel implements ChannelEventListener
|
||||||
{
|
{
|
||||||
@@ -41,100 +39,91 @@ public class CallEventPanel extends JPanel implements ChannelEventListener
|
|||||||
private CallEventAliasCellRenderer mRenderer;
|
private CallEventAliasCellRenderer mRenderer;
|
||||||
private ChannelProcessingManager mChannelProcessingManager;
|
private ChannelProcessingManager mChannelProcessingManager;
|
||||||
|
|
||||||
public CallEventPanel( SettingsManager settingsManager,
|
public CallEventPanel(IconManager iconManager, ChannelProcessingManager channelProcessingManager)
|
||||||
ChannelProcessingManager channelProcessingManager )
|
|
||||||
{
|
|
||||||
mChannelProcessingManager = channelProcessingManager;
|
|
||||||
|
|
||||||
setLayout( new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]") );
|
|
||||||
|
|
||||||
JTable table = new JTable( new CallEventModel() );
|
|
||||||
table.setAutoCreateRowSorter( true );
|
|
||||||
table.setAutoResizeMode( JTable.AUTO_RESIZE_LAST_COLUMN );
|
|
||||||
|
|
||||||
mRenderer = new CallEventAliasCellRenderer( settingsManager );
|
|
||||||
|
|
||||||
table.getColumnModel().getColumn( CallEventModel.FROM_ALIAS )
|
|
||||||
.setCellRenderer( mRenderer );
|
|
||||||
|
|
||||||
table.getColumnModel().getColumn( CallEventModel.TO_ALIAS )
|
|
||||||
.setCellRenderer( mRenderer );
|
|
||||||
|
|
||||||
mEmptyScroller = new JScrollPane( table );
|
|
||||||
|
|
||||||
add( mEmptyScroller );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void channelChanged( final ChannelEvent event )
|
|
||||||
{
|
{
|
||||||
if( event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
|
mChannelProcessingManager = channelProcessingManager;
|
||||||
event.getChannel().isSelected() )
|
|
||||||
{
|
|
||||||
if( mDisplayedChannel == null ||
|
|
||||||
( mDisplayedChannel != null &&
|
|
||||||
mDisplayedChannel != event.getChannel() ) )
|
|
||||||
{
|
|
||||||
ProcessingChain chain = mChannelProcessingManager
|
|
||||||
.getProcessingChain( event.getChannel() );
|
|
||||||
|
|
||||||
if( chain != null )
|
|
||||||
{
|
|
||||||
final CallEventModel model = chain.getCallEventModel();
|
|
||||||
|
|
||||||
if( model != null )
|
|
||||||
{
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
removeAll();
|
|
||||||
|
|
||||||
JTable table = new JTable( model );
|
|
||||||
|
|
||||||
table.setAutoCreateRowSorter( true );
|
setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]"));
|
||||||
table.setAutoResizeMode( JTable.AUTO_RESIZE_LAST_COLUMN );
|
|
||||||
|
|
||||||
table.getColumnModel().getColumn( CallEventModel.FROM_ALIAS )
|
|
||||||
.setCellRenderer( mRenderer );
|
|
||||||
|
|
||||||
table.getColumnModel().getColumn( CallEventModel.TO_ALIAS )
|
JTable table = new JTable(new CallEventModel());
|
||||||
.setCellRenderer( mRenderer );
|
table.setAutoCreateRowSorter(true);
|
||||||
|
table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
|
||||||
add( new JScrollPane( table ) );
|
|
||||||
|
|
||||||
mDisplayedChannel = event.getChannel();
|
|
||||||
|
|
||||||
revalidate();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( event.getEvent() == Event.NOTIFICATION_PROCESSING_STOP ||
|
|
||||||
event.getEvent() == Event.REQUEST_DISABLE )
|
|
||||||
{
|
|
||||||
if( mDisplayedChannel != null &&
|
|
||||||
mDisplayedChannel == event.getChannel() )
|
|
||||||
{
|
|
||||||
mDisplayedChannel = null;
|
|
||||||
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
removeAll();
|
|
||||||
add( mEmptyScroller );
|
|
||||||
|
|
||||||
revalidate();
|
mRenderer = new CallEventAliasCellRenderer(iconManager);
|
||||||
repaint();
|
|
||||||
}
|
table.getColumnModel().getColumn(CallEventModel.FROM_ALIAS).setCellRenderer(mRenderer);
|
||||||
} );
|
|
||||||
}
|
table.getColumnModel().getColumn(CallEventModel.TO_ALIAS).setCellRenderer(mRenderer);
|
||||||
}
|
|
||||||
|
mEmptyScroller = new JScrollPane(table);
|
||||||
|
|
||||||
|
add(mEmptyScroller);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelChanged(final ChannelEvent event)
|
||||||
|
{
|
||||||
|
if(event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE && event.getChannel().isSelected())
|
||||||
|
{
|
||||||
|
if(mDisplayedChannel == null || (mDisplayedChannel != null && mDisplayedChannel != event.getChannel()))
|
||||||
|
{
|
||||||
|
ProcessingChain chain = mChannelProcessingManager.getProcessingChain(event.getChannel());
|
||||||
|
|
||||||
|
if(chain != null)
|
||||||
|
{
|
||||||
|
final CallEventModel model = chain.getCallEventModel();
|
||||||
|
|
||||||
|
if(model != null)
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
removeAll();
|
||||||
|
|
||||||
|
JTable table = new JTable(model);
|
||||||
|
|
||||||
|
table.setAutoCreateRowSorter(true);
|
||||||
|
table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
|
||||||
|
|
||||||
|
table.getColumnModel().getColumn(CallEventModel.FROM_ALIAS)
|
||||||
|
.setCellRenderer(mRenderer);
|
||||||
|
|
||||||
|
table.getColumnModel().getColumn(CallEventModel.TO_ALIAS)
|
||||||
|
.setCellRenderer(mRenderer);
|
||||||
|
|
||||||
|
add(new JScrollPane(table));
|
||||||
|
|
||||||
|
mDisplayedChannel = event.getChannel();
|
||||||
|
|
||||||
|
revalidate();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(event.getEvent() == Event.NOTIFICATION_PROCESSING_STOP || event.getEvent() == Event.REQUEST_DISABLE)
|
||||||
|
{
|
||||||
|
if(mDisplayedChannel != null && mDisplayedChannel == event.getChannel())
|
||||||
|
{
|
||||||
|
mDisplayedChannel = null;
|
||||||
|
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
removeAll();
|
||||||
|
add(mEmptyScroller);
|
||||||
|
|
||||||
|
revalidate();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,202 +1,201 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.fleetsync2;
|
package module.decode.fleetsync2;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import icon.IconManager;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.ColorSetting.ColorSettingName;
|
import settings.ColorSetting.ColorSettingName;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class Fleetsync2DecoderPanel extends DecoderPanel
|
public class Fleetsync2DecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( Fleetsync2DecoderPanel.class );
|
private final static Logger mLog = LoggerFactory.getLogger(Fleetsync2DecoderPanel.class);
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String PROTOCOL = "FSync II";
|
private static final String PROTOCOL = "FSync II";
|
||||||
|
|
||||||
private JLabel mToLabel = new JLabel( " " );
|
private JLabel mToLabel = new JLabel(" ");
|
||||||
private JLabel mTo = new JLabel( " " );
|
private JLabel mTo = new JLabel(" ");
|
||||||
private JLabel mToAlias = new JLabel( " " );
|
private JLabel mToAlias = new JLabel(" ");
|
||||||
|
|
||||||
private JLabel mFromLabel = new JLabel( " " );
|
private JLabel mFromLabel = new JLabel(" ");
|
||||||
private JLabel mFrom = new JLabel( " " );
|
private JLabel mFrom = new JLabel(" ");
|
||||||
private JLabel mFromAlias = new JLabel( " " );
|
private JLabel mFromAlias = new JLabel(" ");
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( PROTOCOL );
|
|
||||||
private JLabel mMessage = new JLabel( " " );
|
|
||||||
private JLabel mMessageType = new JLabel( " " );
|
|
||||||
|
|
||||||
public Fleetsync2DecoderPanel( SettingsManager settingsManager,
|
|
||||||
Fleetsync2DecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
private JLabel mProtocol = new JLabel(PROTOCOL);
|
||||||
public Fleetsync2DecoderState getDecoderState()
|
private JLabel mMessage = new JLabel(" ");
|
||||||
{
|
private JLabel mMessageType = new JLabel(" ");
|
||||||
return (Fleetsync2DecoderState)super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
/* Calling super init will get and broadcast color settings to properly
|
|
||||||
* setup the jlabel colors */
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
|
||||||
|
|
||||||
mToLabel.setFont( mFontAuxDecoder );
|
public Fleetsync2DecoderPanel(IconManager iconManager, SettingsManager settingsManager,
|
||||||
mToLabel.setForeground( mColorLabelAuxDecoder );
|
Fleetsync2DecoderState decoderState)
|
||||||
add( mToLabel );
|
|
||||||
|
|
||||||
mTo.setFont( mFontAuxDecoder );
|
|
||||||
mTo.setForeground( mColorLabelAuxDecoder );
|
|
||||||
add( mTo );
|
|
||||||
|
|
||||||
mToAlias.setFont( mFontAuxDecoder );
|
|
||||||
mToAlias.setForeground( mColorLabelAuxDecoder );
|
|
||||||
add( mToAlias, "wrap" );
|
|
||||||
|
|
||||||
mFromLabel.setFont( mFontAuxDecoder );
|
|
||||||
mFromLabel.setForeground( mColorLabelAuxDecoder );
|
|
||||||
add( mFromLabel );
|
|
||||||
|
|
||||||
mFrom.setFont( mFontAuxDecoder );
|
|
||||||
mFrom.setForeground( mColorLabelAuxDecoder );
|
|
||||||
add( mFrom );
|
|
||||||
|
|
||||||
mFromAlias.setFont( mFontAuxDecoder );
|
|
||||||
mFromAlias.setForeground( mColorLabelAuxDecoder );
|
|
||||||
add( mFromAlias, "wrap" );
|
|
||||||
|
|
||||||
mProtocol.setFont( mFontAuxDecoder );
|
|
||||||
mProtocol.setForeground( mColorLabelAuxDecoder );
|
|
||||||
add( mProtocol );
|
|
||||||
|
|
||||||
mMessageType.setFont( mFontAuxDecoder );
|
|
||||||
mMessageType.setForeground( mColorLabelAuxDecoder );
|
|
||||||
add( mMessageType );
|
|
||||||
|
|
||||||
mMessage.setFont( mFontAuxDecoder );
|
|
||||||
mMessage.setForeground( mColorLabelAuxDecoder );
|
|
||||||
add( mMessage, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater( new Runnable()
|
super(iconManager, settingsManager, decoderState);
|
||||||
{
|
|
||||||
@Override
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Fleetsync2DecoderState getDecoderState()
|
||||||
|
{
|
||||||
|
return (Fleetsync2DecoderState) super.getDecoderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init()
|
||||||
|
{
|
||||||
|
/* Calling super init will get and broadcast color settings to properly
|
||||||
|
* setup the jlabel colors */
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
|
|
||||||
|
mToLabel.setFont(mFontAuxDecoder);
|
||||||
|
mToLabel.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mToLabel);
|
||||||
|
|
||||||
|
mTo.setFont(mFontAuxDecoder);
|
||||||
|
mTo.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mTo);
|
||||||
|
|
||||||
|
mToAlias.setFont(mFontAuxDecoder);
|
||||||
|
mToAlias.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mToAlias, "wrap");
|
||||||
|
|
||||||
|
mFromLabel.setFont(mFontAuxDecoder);
|
||||||
|
mFromLabel.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mFromLabel);
|
||||||
|
|
||||||
|
mFrom.setFont(mFontAuxDecoder);
|
||||||
|
mFrom.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mFrom);
|
||||||
|
|
||||||
|
mFromAlias.setFont(mFontAuxDecoder);
|
||||||
|
mFromAlias.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mFromAlias, "wrap");
|
||||||
|
|
||||||
|
mProtocol.setFont(mFontAuxDecoder);
|
||||||
|
mProtocol.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mProtocol);
|
||||||
|
|
||||||
|
mMessageType.setFont(mFontAuxDecoder);
|
||||||
|
mMessageType.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mMessageType);
|
||||||
|
|
||||||
|
mMessage.setFont(mFontAuxDecoder);
|
||||||
|
mMessage.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mMessage, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
switch( changedAttribute )
|
switch(changedAttribute)
|
||||||
{
|
{
|
||||||
case FROM_TALKGROUP:
|
case FROM_TALKGROUP:
|
||||||
String from = getDecoderState().getFromID();
|
String from = getDecoderState().getFromID();
|
||||||
|
|
||||||
if( from != null )
|
|
||||||
{
|
|
||||||
mFromLabel.setText( "FROM:" );
|
|
||||||
mFrom.setText( from );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromLabel.setText( " " );
|
|
||||||
mFrom.setText( " " );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP_ALIAS:
|
|
||||||
setAliasLabel( mFromAlias, getDecoderState().getFromIDAlias() );
|
|
||||||
break;
|
|
||||||
case MESSAGE:
|
|
||||||
mMessage.setText( getDecoderState().getMessage() );
|
|
||||||
break;
|
|
||||||
case MESSAGE_TYPE:
|
|
||||||
mMessageType.setText( getDecoderState().getMessageType() );
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
String to = getDecoderState().getToID();
|
|
||||||
|
|
||||||
if( to != null )
|
|
||||||
{
|
|
||||||
mToLabel.setText( "TO:" );
|
|
||||||
mTo.setText( to );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToLabel.setText( " " );
|
|
||||||
mTo.setText( " " );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
setAliasLabel( mToAlias, getDecoderState().getToIDAlias() );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged( Setting setting )
|
|
||||||
{
|
|
||||||
super.settingChanged( setting );
|
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting)setting;
|
|
||||||
|
|
||||||
if( color.getColorSettingName() ==
|
if(from != null)
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER )
|
{
|
||||||
{
|
mFromLabel.setText("FROM:");
|
||||||
mFromLabel.setForeground( color.getColor() );
|
mFrom.setText(from);
|
||||||
mFrom.setForeground( color.getColor() );
|
}
|
||||||
mFromAlias.setForeground( color.getColor() );
|
else
|
||||||
mToLabel.setForeground( color.getColor() );
|
{
|
||||||
mTo.setForeground( color.getColor() );
|
mFromLabel.setText(" ");
|
||||||
mToAlias.setForeground( color.getColor() );
|
mFrom.setText(" ");
|
||||||
mProtocol.setForeground( color.getColor() );
|
}
|
||||||
mMessageType.setForeground( color.getColor() );
|
break;
|
||||||
mMessage.setForeground( color.getColor() );
|
case FROM_TALKGROUP_ALIAS:
|
||||||
}
|
setAliasLabel(mFromAlias, getDecoderState().getFromIDAlias());
|
||||||
}
|
break;
|
||||||
|
case MESSAGE:
|
||||||
|
mMessage.setText(getDecoderState().getMessage());
|
||||||
|
break;
|
||||||
|
case MESSAGE_TYPE:
|
||||||
|
mMessageType.setText(getDecoderState().getMessageType());
|
||||||
|
break;
|
||||||
|
case TO_TALKGROUP:
|
||||||
|
String to = getDecoderState().getToID();
|
||||||
|
|
||||||
|
if(to != null)
|
||||||
|
{
|
||||||
|
mToLabel.setText("TO:");
|
||||||
|
mTo.setText(to);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mToLabel.setText(" ");
|
||||||
|
mTo.setText(" ");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TO_TALKGROUP_ALIAS:
|
||||||
|
setAliasLabel(mToAlias, getDecoderState().getToIDAlias());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settingChanged(Setting setting)
|
||||||
|
{
|
||||||
|
super.settingChanged(setting);
|
||||||
|
|
||||||
|
if(setting instanceof ColorSetting)
|
||||||
|
{
|
||||||
|
ColorSetting color = (ColorSetting) setting;
|
||||||
|
|
||||||
|
if(color.getColorSettingName() ==
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
||||||
|
{
|
||||||
|
mFromLabel.setForeground(color.getColor());
|
||||||
|
mFrom.setForeground(color.getColor());
|
||||||
|
mFromAlias.setForeground(color.getColor());
|
||||||
|
mToLabel.setForeground(color.getColor());
|
||||||
|
mTo.setForeground(color.getColor());
|
||||||
|
mToAlias.setForeground(color.getColor());
|
||||||
|
mProtocol.setForeground(color.getColor());
|
||||||
|
mMessageType.setForeground(color.getColor());
|
||||||
|
mMessage.setForeground(color.getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.lj1200;
|
package module.decode.lj1200;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
|
import icon.IconManager;
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@@ -28,98 +28,100 @@ import settings.ColorSetting.ColorSettingName;
|
|||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
public class LJ1200DecoderPanel extends DecoderPanel
|
public class LJ1200DecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String PROTOCOL = "LJ-1200";
|
private static final String PROTOCOL = "LJ-1200";
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( PROTOCOL );
|
private JLabel mProtocol = new JLabel(PROTOCOL);
|
||||||
private JLabel mTo = new JLabel();
|
private JLabel mTo = new JLabel();
|
||||||
private JLabel mToAlias = new JLabel();
|
private JLabel mToAlias = new JLabel();
|
||||||
|
|
||||||
public LJ1200DecoderPanel( SettingsManager settingsManager, LJ1200DecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
/* Calling super init will get and broadcast color settings to properly
|
|
||||||
* setup the jlabel colors */
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "" ) );
|
|
||||||
|
|
||||||
mProtocol.setFont( mFontDecoder );
|
public LJ1200DecoderPanel(IconManager iconManager, SettingsManager settingsManager, LJ1200DecoderState decoderState)
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mTo.setFont( mFontDecoder );
|
|
||||||
mTo.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mToAlias.setFont( mFontDecoder );
|
|
||||||
mToAlias.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
add( mProtocol );
|
|
||||||
add( mTo );
|
|
||||||
add( mToAlias, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public LJ1200DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (LJ1200DecoderState)super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
|
||||||
{
|
{
|
||||||
switch( changedAttribute )
|
super(iconManager, settingsManager, decoderState);
|
||||||
{
|
|
||||||
case TO_TALKGROUP:
|
init();
|
||||||
mTo.setText( getDecoderState().getAddress() );
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
Alias alias = getDecoderState().getAddressAlias();
|
|
||||||
|
|
||||||
if( alias != null )
|
|
||||||
{
|
|
||||||
mToAlias.setText( alias.getName() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToAlias.setText( "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged( Setting setting )
|
|
||||||
{
|
|
||||||
super.settingChanged( setting );
|
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting)setting;
|
|
||||||
|
|
||||||
if( color.getColorSettingName() ==
|
public void dispose()
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER )
|
{
|
||||||
{
|
super.dispose();
|
||||||
mProtocol.setForeground( color.getColor() );
|
}
|
||||||
mTo.setForeground( color.getColor() );
|
|
||||||
mToAlias.setForeground( color.getColor() );
|
protected void init()
|
||||||
}
|
{
|
||||||
}
|
/* Calling super init will get and broadcast color settings to properly
|
||||||
|
* setup the jlabel colors */
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", ""));
|
||||||
|
|
||||||
|
mProtocol.setFont(mFontDecoder);
|
||||||
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mTo.setFont(mFontDecoder);
|
||||||
|
mTo.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mToAlias.setFont(mFontDecoder);
|
||||||
|
mToAlias.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
add(mProtocol);
|
||||||
|
add(mTo);
|
||||||
|
add(mToAlias, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
public LJ1200DecoderState getDecoderState()
|
||||||
|
{
|
||||||
|
return (LJ1200DecoderState) super.getDecoderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
switch(changedAttribute)
|
||||||
|
{
|
||||||
|
case TO_TALKGROUP:
|
||||||
|
mTo.setText(getDecoderState().getAddress());
|
||||||
|
repaint();
|
||||||
|
break;
|
||||||
|
case TO_TALKGROUP_ALIAS:
|
||||||
|
Alias alias = getDecoderState().getAddressAlias();
|
||||||
|
|
||||||
|
if(alias != null)
|
||||||
|
{
|
||||||
|
mToAlias.setText(alias.getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mToAlias.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
repaint();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settingChanged(Setting setting)
|
||||||
|
{
|
||||||
|
super.settingChanged(setting);
|
||||||
|
|
||||||
|
if(setting instanceof ColorSetting)
|
||||||
|
{
|
||||||
|
ColorSetting color = (ColorSetting) setting;
|
||||||
|
|
||||||
|
if(color.getColorSettingName() ==
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
||||||
|
{
|
||||||
|
mProtocol.setForeground(color.getColor());
|
||||||
|
mTo.setForeground(color.getColor());
|
||||||
|
mToAlias.setForeground(color.getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,157 +1,157 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.ltrnet;
|
package module.decode.ltrnet;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import alias.Alias;
|
||||||
|
import icon.IconManager;
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import alias.Alias;
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class LTRNetDecoderPanel extends DecoderPanel
|
public class LTRNetDecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( "LTR-Net" );
|
private JLabel mProtocol = new JLabel("LTR-Net");
|
||||||
private JLabel mTalkgroup = new JLabel();
|
private JLabel mTalkgroup = new JLabel();
|
||||||
private JLabel mTalkgroupAlias = new JLabel();
|
private JLabel mTalkgroupAlias = new JLabel();
|
||||||
|
|
||||||
private JLabel mLCN = new JLabel( "LCN:" );
|
private JLabel mLCN = new JLabel("LCN:");
|
||||||
private JLabel mDescription = new JLabel();
|
private JLabel mDescription = new JLabel();
|
||||||
|
|
||||||
public LTRNetDecoderPanel( SettingsManager settingsManager,
|
|
||||||
LTRNetDecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
|
||||||
|
|
||||||
mProtocol.setFont( mFontDecoder );
|
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mTalkgroup.setFont( mFontDecoder );
|
public LTRNetDecoderPanel(IconManager iconManager, SettingsManager settingsManager, LTRNetDecoderState decoderState)
|
||||||
mTalkgroup.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mTalkgroupAlias.setFont( mFontDecoder );
|
|
||||||
mTalkgroupAlias.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mLCN.setFont( mFontDecoder );
|
|
||||||
mLCN.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mDescription.setFont( mFontDecoder );
|
|
||||||
mDescription.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
add( mProtocol );
|
|
||||||
add( mTalkgroup );
|
|
||||||
add( mTalkgroupAlias, "wrap" );
|
|
||||||
|
|
||||||
add( mLCN );
|
|
||||||
add( mDescription, "span" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public LTRNetDecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (LTRNetDecoderState)super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater( new Runnable()
|
super(iconManager, settingsManager, decoderState);
|
||||||
{
|
|
||||||
@Override
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
|
|
||||||
|
mProtocol.setFont(mFontDecoder);
|
||||||
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mTalkgroup.setFont(mFontDecoder);
|
||||||
|
mTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mTalkgroupAlias.setFont(mFontDecoder);
|
||||||
|
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mLCN.setFont(mFontDecoder);
|
||||||
|
mLCN.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mDescription.setFont(mFontDecoder);
|
||||||
|
mDescription.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
add(mProtocol);
|
||||||
|
add(mTalkgroup);
|
||||||
|
add(mTalkgroupAlias, "wrap");
|
||||||
|
|
||||||
|
add(mLCN);
|
||||||
|
add(mDescription, "span");
|
||||||
|
}
|
||||||
|
|
||||||
|
public LTRNetDecoderState getDecoderState()
|
||||||
|
{
|
||||||
|
return (LTRNetDecoderState) super.getDecoderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
LTRNetDecoderState state = getDecoderState();
|
LTRNetDecoderState state = getDecoderState();
|
||||||
|
|
||||||
switch( changedAttribute )
|
switch(changedAttribute)
|
||||||
{
|
{
|
||||||
case TO_TALKGROUP:
|
case TO_TALKGROUP:
|
||||||
mTalkgroup.setText( state.getToTalkgroup() );
|
mTalkgroup.setText(state.getToTalkgroup());
|
||||||
break;
|
break;
|
||||||
case TO_TALKGROUP_ALIAS:
|
case TO_TALKGROUP_ALIAS:
|
||||||
Alias tgAlias = state.getToTalkgroupAlias();
|
Alias tgAlias = state.getToTalkgroupAlias();
|
||||||
setAliasLabel( mTalkgroupAlias, tgAlias );
|
setAliasLabel(mTalkgroupAlias, tgAlias);
|
||||||
break;
|
break;
|
||||||
case DESCRIPTION:
|
case DESCRIPTION:
|
||||||
mDescription.setText( state.getDescription() );
|
mDescription.setText(state.getDescription());
|
||||||
break;
|
break;
|
||||||
case CHANNEL_NUMBER:
|
case CHANNEL_NUMBER:
|
||||||
mLCN.setText( "LCN: " + state.getChannelNumber() );
|
mLCN.setText("LCN: " + state.getChannelNumber());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
super.settingChanged( setting );
|
super.settingChanged(setting);
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
if(setting instanceof ColorSetting)
|
||||||
{
|
{
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
switch(colorSetting.getColorSettingName())
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
if( mProtocol != null )
|
if(mProtocol != null)
|
||||||
{
|
{
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mTalkgroup != null )
|
if(mTalkgroup != null)
|
||||||
{
|
{
|
||||||
mTalkgroup.setForeground( mColorLabelDecoder );
|
mTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mTalkgroupAlias != null )
|
if(mTalkgroupAlias != null)
|
||||||
{
|
{
|
||||||
mTalkgroupAlias.setForeground( mColorLabelDecoder );
|
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mLCN != null )
|
if(mLCN != null)
|
||||||
{
|
{
|
||||||
mLCN.setForeground( mColorLabelDecoder );
|
mLCN.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mDescription != null )
|
if(mDescription != null)
|
||||||
{
|
{
|
||||||
mDescription.setForeground( mColorLabelDecoder );
|
mDescription.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,163 +1,164 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.ltrstandard;
|
package module.decode.ltrstandard;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import alias.Alias;
|
||||||
|
import icon.IconManager;
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import alias.Alias;
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class LTRStandardDecoderPanel extends DecoderPanel
|
public class LTRStandardDecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( "LTR Standard" );
|
private JLabel mProtocol = new JLabel("LTR Standard");
|
||||||
private JLabel mTalkgroup = new JLabel();
|
private JLabel mTalkgroup = new JLabel();
|
||||||
private JLabel mTalkgroupAlias = new JLabel();
|
private JLabel mTalkgroupAlias = new JLabel();
|
||||||
|
|
||||||
private JLabel mLCN = new JLabel( "LCN:" );
|
private JLabel mLCN = new JLabel("LCN:");
|
||||||
|
|
||||||
public LTRStandardDecoderPanel( SettingsManager settingsManager,
|
|
||||||
LTRStandardDecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
|
||||||
|
|
||||||
mProtocol.setFont( mFontDecoder );
|
public LTRStandardDecoderPanel(IconManager iconManager, SettingsManager settingsManager,
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
LTRStandardDecoderState decoderState)
|
||||||
|
{
|
||||||
|
super(iconManager, settingsManager, decoderState);
|
||||||
|
|
||||||
mTalkgroup.setFont( mFontDecoder );
|
init();
|
||||||
mTalkgroup.setForeground( mColorLabelDecoder );
|
}
|
||||||
|
|
||||||
mTalkgroupAlias.setFont( mFontDecoder );
|
public void dispose()
|
||||||
mTalkgroupAlias.setForeground( mColorLabelDecoder );
|
{
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
mLCN.setFont( mFontDecoder );
|
public void init()
|
||||||
mLCN.setForeground( mColorLabelDecoder );
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
add( mProtocol );
|
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
add( mTalkgroup );
|
|
||||||
add( mTalkgroupAlias, "wrap" );
|
mProtocol.setFont(mFontDecoder);
|
||||||
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
add( mLCN, "wrap" );
|
|
||||||
}
|
mTalkgroup.setFont(mFontDecoder);
|
||||||
|
mTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
public LTRStandardDecoderState getDecoderState()
|
|
||||||
{
|
mTalkgroupAlias.setFont(mFontDecoder);
|
||||||
return (LTRStandardDecoderState)super.getDecoderState();
|
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
}
|
|
||||||
|
mLCN.setFont(mFontDecoder);
|
||||||
|
mLCN.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
add(mProtocol);
|
||||||
|
add(mTalkgroup);
|
||||||
|
add(mTalkgroupAlias, "wrap");
|
||||||
|
|
||||||
|
add(mLCN, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
public LTRStandardDecoderState getDecoderState()
|
||||||
|
{
|
||||||
|
return (LTRStandardDecoderState) super.getDecoderState();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( final ChangedAttribute attribute )
|
public void receive(final ChangedAttribute attribute)
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater( new Runnable()
|
EventQueue.invokeLater(new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
LTRStandardDecoderState state = getDecoderState();
|
LTRStandardDecoderState state = getDecoderState();
|
||||||
|
|
||||||
switch( attribute )
|
switch(attribute)
|
||||||
{
|
{
|
||||||
case CHANNEL_NUMBER:
|
case CHANNEL_NUMBER:
|
||||||
if( state.getChannelNumber() != 0 )
|
if(state.getChannelNumber() != 0)
|
||||||
{
|
{
|
||||||
mLCN.setText( "LCN: " + state.getChannelNumber() );
|
mLCN.setText("LCN: " + state.getChannelNumber());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TO_TALKGROUP:
|
case TO_TALKGROUP:
|
||||||
mTalkgroup.setText( state.getTalkgroup() );
|
mTalkgroup.setText(state.getTalkgroup());
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
case TO_TALKGROUP_ALIAS:
|
case TO_TALKGROUP_ALIAS:
|
||||||
Alias alias = state.getTalkgroupAlias();
|
Alias alias = state.getTalkgroupAlias();
|
||||||
|
|
||||||
if( alias != null )
|
if(alias != null)
|
||||||
{
|
{
|
||||||
mTalkgroupAlias.setText( alias.getName() );
|
mTalkgroupAlias.setText(alias.getName());
|
||||||
mTalkgroupAlias.setIcon( mSettingsManager
|
mTalkgroupAlias.setIcon(mIconManager.getIcon(alias.getIconName(),
|
||||||
.getImageIcon( alias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
|
IconManager.DEFAULT_ICON_SIZE));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mTalkgroupAlias.setText( null );
|
mTalkgroupAlias.setText(null);
|
||||||
mTalkgroupAlias.setIcon( null );
|
mTalkgroupAlias.setIcon(null);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
super.settingChanged( setting );
|
super.settingChanged(setting);
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
if(setting instanceof ColorSetting)
|
||||||
{
|
{
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
switch(colorSetting.getColorSettingName())
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
if( mProtocol != null )
|
if(mProtocol != null)
|
||||||
{
|
{
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mTalkgroup != null )
|
if(mTalkgroup != null)
|
||||||
{
|
{
|
||||||
mTalkgroup.setForeground( mColorLabelDecoder );
|
mTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mTalkgroupAlias != null )
|
if(mTalkgroupAlias != null)
|
||||||
{
|
{
|
||||||
mTalkgroupAlias.setForeground( mColorLabelDecoder );
|
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mLCN != null )
|
if(mLCN != null)
|
||||||
{
|
{
|
||||||
mLCN.setForeground( mColorLabelDecoder );
|
mLCN.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,25 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.mdc1200;
|
package module.decode.mdc1200;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
|
import icon.IconManager;
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@@ -30,154 +28,156 @@ import settings.ColorSetting.ColorSettingName;
|
|||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class MDCDecoderPanel extends DecoderPanel
|
public class MDCDecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String sPROTOCOL = "MDC-1200";
|
private static final String sPROTOCOL = "MDC-1200";
|
||||||
|
|
||||||
private JLabel mFromLabel = new JLabel( " " );
|
private JLabel mFromLabel = new JLabel(" ");
|
||||||
private JLabel mFrom = new JLabel();
|
private JLabel mFrom = new JLabel();
|
||||||
private JLabel mFromAlias = new JLabel();
|
private JLabel mFromAlias = new JLabel();
|
||||||
|
|
||||||
private JLabel mToLabel = new JLabel( " " );
|
private JLabel mToLabel = new JLabel(" ");
|
||||||
private JLabel mTo = new JLabel();
|
private JLabel mTo = new JLabel();
|
||||||
private JLabel mToAlias = new JLabel();
|
private JLabel mToAlias = new JLabel();
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( sPROTOCOL );
|
private JLabel mProtocol = new JLabel(sPROTOCOL);
|
||||||
private JLabel mMessage = new JLabel();
|
private JLabel mMessage = new JLabel();
|
||||||
private JLabel mMessageType = new JLabel();
|
private JLabel mMessageType = new JLabel();
|
||||||
|
|
||||||
public MDCDecoderPanel( SettingsManager settingsManager,
|
|
||||||
MDCDecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MDCDecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (MDCDecoderState)super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
/* Calling super init will get and broadcast color settings to properly
|
|
||||||
* setup the jlabel colors */
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
|
||||||
|
|
||||||
add( mFromLabel );
|
public MDCDecoderPanel(IconManager iconManager, SettingsManager settingsManager, MDCDecoderState decoderState)
|
||||||
add( mFrom );
|
|
||||||
add( mFromAlias, "wrap" );
|
|
||||||
|
|
||||||
add( mToLabel );
|
|
||||||
add( mTo );
|
|
||||||
add( mToAlias, "wrap" );
|
|
||||||
|
|
||||||
add( mProtocol );
|
|
||||||
add( mMessageType );
|
|
||||||
add( mMessage, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater( new Runnable()
|
super(iconManager, settingsManager, decoderState);
|
||||||
{
|
|
||||||
@Override
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MDCDecoderState getDecoderState()
|
||||||
|
{
|
||||||
|
return (MDCDecoderState) super.getDecoderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init()
|
||||||
|
{
|
||||||
|
/* Calling super init will get and broadcast color settings to properly
|
||||||
|
* setup the jlabel colors */
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
|
|
||||||
|
add(mFromLabel);
|
||||||
|
add(mFrom);
|
||||||
|
add(mFromAlias, "wrap");
|
||||||
|
|
||||||
|
add(mToLabel);
|
||||||
|
add(mTo);
|
||||||
|
add(mToAlias, "wrap");
|
||||||
|
|
||||||
|
add(mProtocol);
|
||||||
|
add(mMessageType);
|
||||||
|
add(mMessage, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
switch( changedAttribute )
|
switch(changedAttribute)
|
||||||
{
|
{
|
||||||
case FROM_TALKGROUP:
|
case FROM_TALKGROUP:
|
||||||
String from = getDecoderState().getFrom();
|
String from = getDecoderState().getFrom();
|
||||||
|
|
||||||
if( from != null )
|
if(from != null)
|
||||||
{
|
{
|
||||||
mFromLabel.setText( "FM:" );
|
mFromLabel.setText("FM:");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mFromLabel.setText( " " );
|
mFromLabel.setText(" ");
|
||||||
}
|
}
|
||||||
mFrom.setText( from );
|
mFrom.setText(from);
|
||||||
break;
|
break;
|
||||||
case FROM_TALKGROUP_ALIAS:
|
case FROM_TALKGROUP_ALIAS:
|
||||||
Alias fromAlias = getDecoderState().getFromAlias();
|
Alias fromAlias = getDecoderState().getFromAlias();
|
||||||
|
|
||||||
if( fromAlias != null )
|
if(fromAlias != null)
|
||||||
{
|
{
|
||||||
mFromAlias.setText( fromAlias.getName() );
|
mFromAlias.setText(fromAlias.getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mFromAlias.setText( null );
|
mFromAlias.setText(null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TO_TALKGROUP:
|
case TO_TALKGROUP:
|
||||||
String to = getDecoderState().getTo();
|
String to = getDecoderState().getTo();
|
||||||
|
|
||||||
if( to != null )
|
if(to != null)
|
||||||
{
|
{
|
||||||
mToLabel.setText( "TO:" );
|
mToLabel.setText("TO:");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mToLabel.setText( " " );
|
mToLabel.setText(" ");
|
||||||
}
|
}
|
||||||
mTo.setText( to );
|
mTo.setText(to);
|
||||||
break;
|
break;
|
||||||
case TO_TALKGROUP_ALIAS:
|
case TO_TALKGROUP_ALIAS:
|
||||||
Alias toAlias = getDecoderState().getToAlias();
|
Alias toAlias = getDecoderState().getToAlias();
|
||||||
|
|
||||||
if( toAlias != null )
|
if(toAlias != null)
|
||||||
{
|
{
|
||||||
mToAlias.setText( toAlias.getName() );
|
mToAlias.setText(toAlias.getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mToAlias.setText( null );
|
mToAlias.setText(null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MESSAGE:
|
case MESSAGE:
|
||||||
mMessage.setText( getDecoderState().getMessage() );
|
mMessage.setText(getDecoderState().getMessage());
|
||||||
break;
|
break;
|
||||||
case MESSAGE_TYPE:
|
case MESSAGE_TYPE:
|
||||||
mMessageType.setText( getDecoderState().getMessageType() );
|
mMessageType.setText(getDecoderState().getMessageType());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
super.settingChanged( setting );
|
super.settingChanged(setting);
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting)setting;
|
|
||||||
|
|
||||||
if( color.getColorSettingName() ==
|
if(setting instanceof ColorSetting)
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER )
|
{
|
||||||
{
|
ColorSetting color = (ColorSetting) setting;
|
||||||
mFromLabel.setForeground( color.getColor() );
|
|
||||||
mFrom.setForeground( color.getColor() );
|
if(color.getColorSettingName() ==
|
||||||
mFromAlias.setForeground( color.getColor() );
|
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
||||||
mToLabel.setForeground( color.getColor() );
|
{
|
||||||
mTo.setForeground( color.getColor() );
|
mFromLabel.setForeground(color.getColor());
|
||||||
mToAlias.setForeground( color.getColor() );
|
mFrom.setForeground(color.getColor());
|
||||||
mProtocol.setForeground( color.getColor() );
|
mFromAlias.setForeground(color.getColor());
|
||||||
mMessageType.setForeground( color.getColor() );
|
mToLabel.setForeground(color.getColor());
|
||||||
mMessage.setForeground( color.getColor() );
|
mTo.setForeground(color.getColor());
|
||||||
}
|
mToAlias.setForeground(color.getColor());
|
||||||
}
|
mProtocol.setForeground(color.getColor());
|
||||||
|
mMessageType.setForeground(color.getColor());
|
||||||
|
mMessage.setForeground(color.getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,200 +1,200 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.mpt1327;
|
package module.decode.mpt1327;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import controller.channel.Channel.ChannelType;
|
||||||
|
import icon.IconManager;
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import controller.channel.Channel.ChannelType;
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class MPT1327DecoderPanel extends DecoderPanel
|
public class MPT1327DecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( "" );
|
private JLabel mProtocol = new JLabel("");
|
||||||
private JLabel mSiteOrToTalkgroup = new JLabel( "" );
|
private JLabel mSiteOrToTalkgroup = new JLabel("");
|
||||||
private JLabel mSiteOrToTalkgroupAlias = new JLabel( "" );
|
private JLabel mSiteOrToTalkgroupAlias = new JLabel("");
|
||||||
|
|
||||||
private JLabel mFromTalkgroupLabel = new JLabel( "" );
|
private JLabel mFromTalkgroupLabel = new JLabel("");
|
||||||
private JLabel mFromTalkgroup = new JLabel( "" );
|
private JLabel mFromTalkgroup = new JLabel("");
|
||||||
private JLabel mFromTalkgroupAliasLabel = new JLabel( "" );
|
private JLabel mFromTalkgroupAliasLabel = new JLabel("");
|
||||||
|
|
||||||
public MPT1327DecoderPanel( SettingsManager settingsManager,
|
public MPT1327DecoderPanel(IconManager iconManager, SettingsManager settingsManager, MPT1327DecoderState decoderState)
|
||||||
MPT1327DecoderState decoderState )
|
{
|
||||||
{
|
super(iconManager, settingsManager, decoderState);
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
init();
|
||||||
init();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public MPT1327DecoderState getDecoderState()
|
public MPT1327DecoderState getDecoderState()
|
||||||
{
|
{
|
||||||
return (MPT1327DecoderState)super.getDecoderState();
|
return (MPT1327DecoderState) super.getDecoderState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
|
||||||
|
|
||||||
mProtocol.setText( "MPT1327" );
|
public void init()
|
||||||
mProtocol.setFont( mFontDecoder );
|
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
MPT1327DecoderState mptState = getDecoderState();
|
|
||||||
|
|
||||||
mSiteOrToTalkgroup.setFont( mFontDecoder );
|
|
||||||
mSiteOrToTalkgroup.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mSiteOrToTalkgroupAlias.setFont( mFontDecoder );
|
|
||||||
mSiteOrToTalkgroupAlias.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mFromTalkgroupLabel.setFont( mFontDetails );
|
|
||||||
mFromTalkgroupLabel.setForeground( mColorLabelDetails );
|
|
||||||
|
|
||||||
mFromTalkgroup.setFont( mFontDecoder );
|
|
||||||
mFromTalkgroup.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mFromTalkgroupAliasLabel.setFont( mFontDecoder );
|
|
||||||
mFromTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
|
|
||||||
switch( mptState.getChannelType() )
|
|
||||||
{
|
|
||||||
case STANDARD:
|
|
||||||
mSiteOrToTalkgroup.setText( mptState.getSite() );
|
|
||||||
setAliasLabel( mSiteOrToTalkgroupAlias, mptState.getSiteAlias() );
|
|
||||||
break;
|
|
||||||
case TRAFFIC:
|
|
||||||
mSiteOrToTalkgroup.setText( mptState.getToTalkgroup() );
|
|
||||||
setAliasLabel( mSiteOrToTalkgroupAlias, mptState.getToTalkgroupAlias() );
|
|
||||||
|
|
||||||
mFromTalkgroupLabel.setText( "From:" );
|
|
||||||
mFromTalkgroup.setText( getDecoderState().getFromTalkgroup() );
|
|
||||||
setAliasLabel( mFromTalkgroupAliasLabel, mptState.getFromTalkgroupAlias() );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException( "Unrecognized channel "
|
|
||||||
+ "type in MPT1327 Decoder [" + getDecoderState()
|
|
||||||
.getChannelType().name() + "]" );
|
|
||||||
}
|
|
||||||
|
|
||||||
add( mProtocol );
|
|
||||||
add( mSiteOrToTalkgroup );
|
|
||||||
add( mSiteOrToTalkgroupAlias, "wrap" );
|
|
||||||
|
|
||||||
if( mptState.getChannelType() == ChannelType.TRAFFIC )
|
|
||||||
{
|
|
||||||
add( mFromTalkgroupLabel );
|
|
||||||
add( mFromTalkgroup );
|
|
||||||
add( mFromTalkgroupAliasLabel, "wrap" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
|
||||||
{
|
{
|
||||||
final MPT1327DecoderState state = getDecoderState();
|
super.init();
|
||||||
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
{
|
|
||||||
@Override
|
mProtocol.setText("MPT1327");
|
||||||
|
mProtocol.setFont(mFontDecoder);
|
||||||
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
MPT1327DecoderState mptState = getDecoderState();
|
||||||
|
|
||||||
|
mSiteOrToTalkgroup.setFont(mFontDecoder);
|
||||||
|
mSiteOrToTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mSiteOrToTalkgroupAlias.setFont(mFontDecoder);
|
||||||
|
mSiteOrToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mFromTalkgroupLabel.setFont(mFontDetails);
|
||||||
|
mFromTalkgroupLabel.setForeground(mColorLabelDetails);
|
||||||
|
|
||||||
|
mFromTalkgroup.setFont(mFontDecoder);
|
||||||
|
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mFromTalkgroupAliasLabel.setFont(mFontDecoder);
|
||||||
|
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
|
||||||
|
switch(mptState.getChannelType())
|
||||||
|
{
|
||||||
|
case STANDARD:
|
||||||
|
mSiteOrToTalkgroup.setText(mptState.getSite());
|
||||||
|
setAliasLabel(mSiteOrToTalkgroupAlias, mptState.getSiteAlias());
|
||||||
|
break;
|
||||||
|
case TRAFFIC:
|
||||||
|
mSiteOrToTalkgroup.setText(mptState.getToTalkgroup());
|
||||||
|
setAliasLabel(mSiteOrToTalkgroupAlias, mptState.getToTalkgroupAlias());
|
||||||
|
|
||||||
|
mFromTalkgroupLabel.setText("From:");
|
||||||
|
mFromTalkgroup.setText(getDecoderState().getFromTalkgroup());
|
||||||
|
setAliasLabel(mFromTalkgroupAliasLabel, mptState.getFromTalkgroupAlias());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unrecognized channel "
|
||||||
|
+ "type in MPT1327 Decoder [" + getDecoderState()
|
||||||
|
.getChannelType().name() + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
add(mProtocol);
|
||||||
|
add(mSiteOrToTalkgroup);
|
||||||
|
add(mSiteOrToTalkgroupAlias, "wrap");
|
||||||
|
|
||||||
|
if(mptState.getChannelType() == ChannelType.TRAFFIC)
|
||||||
|
{
|
||||||
|
add(mFromTalkgroupLabel);
|
||||||
|
add(mFromTalkgroup);
|
||||||
|
add(mFromTalkgroupAliasLabel, "wrap");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
final MPT1327DecoderState state = getDecoderState();
|
||||||
|
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
switch( changedAttribute )
|
switch(changedAttribute)
|
||||||
{
|
{
|
||||||
case CHANNEL_SITE_NUMBER:
|
case CHANNEL_SITE_NUMBER:
|
||||||
mSiteOrToTalkgroup.setText( String.valueOf( state.getSite() ) );
|
mSiteOrToTalkgroup.setText(String.valueOf(state.getSite()));
|
||||||
setAliasLabel( mSiteOrToTalkgroupAlias, state.getSiteAlias(), false );
|
setAliasLabel(mSiteOrToTalkgroupAlias, state.getSiteAlias(), false);
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case TO_TALKGROUP:
|
case TO_TALKGROUP:
|
||||||
mSiteOrToTalkgroup.setText( state.getToTalkgroup() );
|
mSiteOrToTalkgroup.setText(state.getToTalkgroup());
|
||||||
setAliasLabel( mSiteOrToTalkgroupAlias, state.getToTalkgroupAlias() );
|
setAliasLabel(mSiteOrToTalkgroupAlias, state.getToTalkgroupAlias());
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case FROM_TALKGROUP:
|
case FROM_TALKGROUP:
|
||||||
mFromTalkgroup.setText( state.getFromTalkgroup() );
|
mFromTalkgroup.setText(state.getFromTalkgroup());
|
||||||
setAliasLabel( mFromTalkgroupAliasLabel, state.getFromTalkgroupAlias() );
|
setAliasLabel(mFromTalkgroupAliasLabel, state.getFromTalkgroupAlias());
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
super.settingChanged( setting );
|
super.settingChanged(setting);
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
if(setting instanceof ColorSetting)
|
||||||
{
|
{
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
switch(colorSetting.getColorSettingName())
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
if( mProtocol != null )
|
if(mProtocol != null)
|
||||||
{
|
{
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mSiteOrToTalkgroup != null )
|
if(mSiteOrToTalkgroup != null)
|
||||||
{
|
{
|
||||||
mSiteOrToTalkgroup.setForeground( mColorLabelDecoder );
|
mSiteOrToTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mSiteOrToTalkgroupAlias != null )
|
if(mSiteOrToTalkgroupAlias != null)
|
||||||
{
|
{
|
||||||
mSiteOrToTalkgroupAlias.setForeground( mColorLabelDecoder );
|
mSiteOrToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mFromTalkgroup != null )
|
if(mFromTalkgroup != null)
|
||||||
{
|
{
|
||||||
mFromTalkgroup.setForeground( mColorLabelDecoder );
|
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mFromTalkgroupAliasLabel != null )
|
if(mFromTalkgroupAliasLabel != null)
|
||||||
{
|
{
|
||||||
mFromTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
|
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_LABEL_DETAILS:
|
case CHANNEL_STATE_LABEL_DETAILS:
|
||||||
if( mFromTalkgroupLabel != null )
|
if(mFromTalkgroupLabel != null)
|
||||||
{
|
{
|
||||||
mFromTalkgroupLabel.setForeground( mColorLabelDetails );
|
mFromTalkgroupLabel.setForeground(mColorLabelDetails);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,33 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.mpt1327;
|
package module.decode.mpt1327;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import alias.Alias;
|
||||||
|
import icon.IconManager;
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import alias.Alias;
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class MPT1327TrafficPanel extends DecoderPanel
|
public class MPT1327TrafficPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
@@ -39,141 +40,140 @@ public class MPT1327TrafficPanel extends DecoderPanel
|
|||||||
private JLabel mToLabel;
|
private JLabel mToLabel;
|
||||||
private JLabel mToTalkgroupLabel;
|
private JLabel mToTalkgroupLabel;
|
||||||
private JLabel mToTalkgroupAliasLabel;
|
private JLabel mToTalkgroupAliasLabel;
|
||||||
|
|
||||||
public MPT1327TrafficPanel( SettingsManager settingsManager, MPT1327DecoderState decoderState )
|
public MPT1327TrafficPanel(IconManager iconManager, SettingsManager settingsManager,
|
||||||
{
|
MPT1327DecoderState decoderState)
|
||||||
super( settingsManager, decoderState );
|
{
|
||||||
|
super(iconManager, settingsManager, decoderState);
|
||||||
init();
|
|
||||||
}
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
public MPT1327DecoderState getDecoderState()
|
public MPT1327DecoderState getDecoderState()
|
||||||
{
|
{
|
||||||
return (MPT1327DecoderState)super.getDecoderState();
|
return (MPT1327DecoderState) super.getDecoderState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
mProtocolLabel = new JLabel( "MPT1327" );
|
|
||||||
mProtocolLabel.setFont( mFontDecoder );
|
|
||||||
mProtocolLabel.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mFromTalkgroupLabel = new JLabel();
|
public void init()
|
||||||
mFromTalkgroupLabel.setFont( mFontDecoder );
|
|
||||||
mFromTalkgroupLabel.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mFromTalkgroupAliasLabel = new JLabel();
|
|
||||||
mFromTalkgroupAliasLabel.setFont( mFontDecoder );
|
|
||||||
mFromTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mToLabel = new JLabel( "TO:" );
|
|
||||||
mToLabel.setFont( mFontDetails );
|
|
||||||
mToLabel.setForeground( mColorLabelDetails );
|
|
||||||
|
|
||||||
mToTalkgroupLabel = new JLabel( getDecoderState().getFromTalkgroup() );
|
|
||||||
mToTalkgroupLabel.setFont( mFontDecoder );
|
|
||||||
mToTalkgroupLabel.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mToTalkgroupAliasLabel = new JLabel();
|
|
||||||
mToTalkgroupAliasLabel.setFont( mFontDecoder );
|
|
||||||
mToTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
add( mProtocolLabel );
|
|
||||||
add( mFromTalkgroupLabel );
|
|
||||||
add( mFromTalkgroupAliasLabel, "wrap" );
|
|
||||||
|
|
||||||
add( mToLabel );
|
|
||||||
add( mToTalkgroupLabel );
|
|
||||||
add( mToTalkgroupAliasLabel, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
|
||||||
{
|
{
|
||||||
final MPT1327DecoderState state = getDecoderState();
|
mProtocolLabel = new JLabel("MPT1327");
|
||||||
|
mProtocolLabel.setFont(mFontDecoder);
|
||||||
EventQueue.invokeLater( new Runnable()
|
mProtocolLabel.setForeground(mColorLabelDecoder);
|
||||||
{
|
|
||||||
@Override
|
mFromTalkgroupLabel = new JLabel();
|
||||||
|
mFromTalkgroupLabel.setFont(mFontDecoder);
|
||||||
|
mFromTalkgroupLabel.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mFromTalkgroupAliasLabel = new JLabel();
|
||||||
|
mFromTalkgroupAliasLabel.setFont(mFontDecoder);
|
||||||
|
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mToLabel = new JLabel("TO:");
|
||||||
|
mToLabel.setFont(mFontDetails);
|
||||||
|
mToLabel.setForeground(mColorLabelDetails);
|
||||||
|
|
||||||
|
mToTalkgroupLabel = new JLabel(getDecoderState().getFromTalkgroup());
|
||||||
|
mToTalkgroupLabel.setFont(mFontDecoder);
|
||||||
|
mToTalkgroupLabel.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mToTalkgroupAliasLabel = new JLabel();
|
||||||
|
mToTalkgroupAliasLabel.setFont(mFontDecoder);
|
||||||
|
mToTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
add(mProtocolLabel);
|
||||||
|
add(mFromTalkgroupLabel);
|
||||||
|
add(mFromTalkgroupAliasLabel, "wrap");
|
||||||
|
|
||||||
|
add(mToLabel);
|
||||||
|
add(mToTalkgroupLabel);
|
||||||
|
add(mToTalkgroupAliasLabel, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
final MPT1327DecoderState state = getDecoderState();
|
||||||
|
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
switch( changedAttribute )
|
switch(changedAttribute)
|
||||||
{
|
{
|
||||||
case FROM_TALKGROUP:
|
case FROM_TALKGROUP:
|
||||||
String talkgroup = state.getFromTalkgroup();
|
String talkgroup = state.getFromTalkgroup();
|
||||||
|
|
||||||
mFromTalkgroupLabel.setText( talkgroup );
|
|
||||||
|
|
||||||
Alias alias = state.getFromTalkgroupAlias();
|
|
||||||
|
|
||||||
if( alias != null )
|
|
||||||
{
|
|
||||||
mFromTalkgroupAliasLabel.setText( alias.getName() );
|
|
||||||
|
|
||||||
String icon = alias.getIconName();
|
|
||||||
|
|
||||||
mFromTalkgroupAliasLabel.setIcon( mSettingsManager
|
|
||||||
.getImageIcon( icon, SettingsManager.DEFAULT_ICON_SIZE ) );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
String toTalkgroup = state.getToTalkgroup();
|
|
||||||
|
|
||||||
mToTalkgroupLabel.setText( toTalkgroup );
|
|
||||||
|
|
||||||
Alias toAlias = state.getToTalkgroupAlias();
|
|
||||||
|
|
||||||
if( toAlias != null )
|
|
||||||
{
|
|
||||||
mToTalkgroupAliasLabel.setText( toAlias.getName() );
|
|
||||||
|
|
||||||
String icon = toAlias.getIconName();
|
|
||||||
|
|
||||||
if( icon != null )
|
|
||||||
{
|
|
||||||
mToTalkgroupAliasLabel.setIcon( mSettingsManager
|
|
||||||
.getImageIcon( icon, 12 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
mFromTalkgroupLabel.setText(talkgroup);
|
||||||
|
|
||||||
|
Alias alias = state.getFromTalkgroupAlias();
|
||||||
|
|
||||||
|
if(alias != null)
|
||||||
|
{
|
||||||
|
mFromTalkgroupAliasLabel.setText(alias.getName());
|
||||||
|
|
||||||
|
String icon = alias.getIconName();
|
||||||
|
|
||||||
|
mFromTalkgroupAliasLabel.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TO_TALKGROUP:
|
||||||
|
String toTalkgroup = state.getToTalkgroup();
|
||||||
|
|
||||||
|
mToTalkgroupLabel.setText(toTalkgroup);
|
||||||
|
|
||||||
|
Alias toAlias = state.getToTalkgroupAlias();
|
||||||
|
|
||||||
|
if(toAlias != null)
|
||||||
|
{
|
||||||
|
mToTalkgroupAliasLabel.setText(toAlias.getName());
|
||||||
|
|
||||||
|
String icon = toAlias.getIconName();
|
||||||
|
|
||||||
|
if(icon != null)
|
||||||
|
{
|
||||||
|
mToTalkgroupAliasLabel.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
repaint();
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
super.settingChanged( setting );
|
super.settingChanged(setting);
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
if(setting instanceof ColorSetting)
|
||||||
{
|
{
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
switch(colorSetting.getColorSettingName())
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
mProtocolLabel.setForeground( mColorLabelDecoder );
|
mProtocolLabel.setForeground(mColorLabelDecoder);
|
||||||
mFromTalkgroupLabel.setForeground( mColorLabelDecoder );
|
mFromTalkgroupLabel.setForeground(mColorLabelDecoder);
|
||||||
mFromTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
|
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||||
mToTalkgroupLabel.setForeground( mColorLabelDecoder );
|
mToTalkgroupLabel.setForeground(mColorLabelDecoder);
|
||||||
mToTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
|
mToTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_LABEL_DETAILS:
|
case CHANNEL_STATE_LABEL_DETAILS:
|
||||||
mToLabel.setForeground( mColorLabelDetails );
|
mToLabel.setForeground(mColorLabelDetails);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.nbfm;
|
package module.decode.nbfm;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import icon.IconManager;
|
||||||
|
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import module.decode.state.DecoderState;
|
import module.decode.state.DecoderState;
|
||||||
@@ -28,52 +28,53 @@ import settings.ColorSetting.ColorSettingName;
|
|||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
public class NBFMDecoderPanel extends DecoderPanel
|
public class NBFMDecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( "NBFM" );
|
private JLabel mProtocol = new JLabel("NBFM");
|
||||||
|
|
||||||
public NBFMDecoderPanel( SettingsManager settingsManager,
|
|
||||||
DecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
public NBFMDecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
|
||||||
|
|
||||||
mProtocol.setFont( mFontDecoder );
|
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
add( mProtocol, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( ChangedAttribute t )
|
|
||||||
{
|
|
||||||
/* Not implemented */
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged( Setting setting )
|
|
||||||
{
|
{
|
||||||
super.settingChanged( setting );
|
super(iconManager, settingsManager, decoderState);
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting)setting;
|
|
||||||
|
|
||||||
if( color.getColorSettingName() ==
|
init();
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER )
|
}
|
||||||
{
|
|
||||||
mProtocol.setForeground( color.getColor() );
|
protected void init()
|
||||||
}
|
{
|
||||||
}
|
super.init();
|
||||||
|
|
||||||
|
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
|
|
||||||
|
mProtocol.setFont(mFontDecoder);
|
||||||
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
add(mProtocol, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(ChangedAttribute t)
|
||||||
|
{
|
||||||
|
/* Not implemented */
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settingChanged(Setting setting)
|
||||||
|
{
|
||||||
|
super.settingChanged(setting);
|
||||||
|
|
||||||
|
if(setting instanceof ColorSetting)
|
||||||
|
{
|
||||||
|
ColorSetting color = (ColorSetting) setting;
|
||||||
|
|
||||||
|
if(color.getColorSettingName() ==
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_DECODER)
|
||||||
|
{
|
||||||
|
mProtocol.setForeground(color.getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,228 +1,226 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.p25;
|
package module.decode.p25;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import alias.Alias;
|
||||||
|
import icon.IconManager;
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import alias.Alias;
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class P25DecoderPanel extends DecoderPanel
|
public class P25DecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JLabel mProtocol;
|
private JLabel mProtocol;
|
||||||
private JLabel mTo = new JLabel( " " );
|
private JLabel mTo = new JLabel(" ");
|
||||||
private JLabel mToAlias = new JLabel( " " );
|
private JLabel mToAlias = new JLabel(" ");
|
||||||
|
|
||||||
private JLabel mNAC = new JLabel( "NAC:" );
|
|
||||||
private JLabel mFrom = new JLabel( " " );
|
|
||||||
private JLabel mFromAlias = new JLabel( " " );
|
|
||||||
|
|
||||||
private JLabel mSystem = new JLabel( "SYS:" );
|
|
||||||
private JLabel mSite = new JLabel( "Site:" );
|
|
||||||
private JLabel mSiteAlias = new JLabel( "" );
|
|
||||||
|
|
||||||
|
|
||||||
public P25DecoderPanel( SettingsManager settingsManager,
|
|
||||||
P25DecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
mProtocol = new JLabel( "P25-1 " + decoderState.getModulation().getShortLabel() );
|
private JLabel mNAC = new JLabel("NAC:");
|
||||||
|
private JLabel mFrom = new JLabel(" ");
|
||||||
init();
|
private JLabel mFromAlias = new JLabel(" ");
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
|
||||||
|
|
||||||
mProtocol.setFont( mFontDecoder );
|
private JLabel mSystem = new JLabel("SYS:");
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
private JLabel mSite = new JLabel("Site:");
|
||||||
|
private JLabel mSiteAlias = new JLabel("");
|
||||||
|
|
||||||
mTo.setFont( mFontDecoder );
|
|
||||||
mTo.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mToAlias.setFont( mFontDecoder );
|
|
||||||
mToAlias.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mNAC.setFont( mFontDetails );
|
public P25DecoderPanel(IconManager iconManager, SettingsManager settingsManager, P25DecoderState decoderState)
|
||||||
mNAC.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mFrom.setFont( mFontDecoder );
|
|
||||||
mFrom.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mFromAlias.setFont( mFontDecoder );
|
|
||||||
mFromAlias.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mSystem.setFont( mFontDetails );
|
|
||||||
mSystem.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mSiteAlias.setFont( mFontDecoder );
|
|
||||||
mSiteAlias.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mSite.setFont( mFontDetails );
|
|
||||||
mSite.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
add( mProtocol );
|
|
||||||
add( mTo );
|
|
||||||
add( mToAlias, "wrap" );
|
|
||||||
|
|
||||||
add( mNAC );
|
|
||||||
add( mFrom );
|
|
||||||
add( mFromAlias, "wrap" );
|
|
||||||
|
|
||||||
add( mSystem );
|
|
||||||
add( mSite );
|
|
||||||
add( mSiteAlias, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public P25DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (P25DecoderState)super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
|
||||||
{
|
{
|
||||||
final P25DecoderState state = getDecoderState();
|
super(iconManager, settingsManager, decoderState);
|
||||||
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
mProtocol = new JLabel("P25-1 " + decoderState.getModulation().getShortLabel());
|
||||||
{
|
|
||||||
@Override
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
|
|
||||||
|
mProtocol.setFont(mFontDecoder);
|
||||||
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mTo.setFont(mFontDecoder);
|
||||||
|
mTo.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mToAlias.setFont(mFontDecoder);
|
||||||
|
mToAlias.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mNAC.setFont(mFontDetails);
|
||||||
|
mNAC.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mFrom.setFont(mFontDecoder);
|
||||||
|
mFrom.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mFromAlias.setFont(mFontDecoder);
|
||||||
|
mFromAlias.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mSystem.setFont(mFontDetails);
|
||||||
|
mSystem.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mSiteAlias.setFont(mFontDecoder);
|
||||||
|
mSiteAlias.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mSite.setFont(mFontDetails);
|
||||||
|
mSite.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
add(mProtocol);
|
||||||
|
add(mTo);
|
||||||
|
add(mToAlias, "wrap");
|
||||||
|
|
||||||
|
add(mNAC);
|
||||||
|
add(mFrom);
|
||||||
|
add(mFromAlias, "wrap");
|
||||||
|
|
||||||
|
add(mSystem);
|
||||||
|
add(mSite);
|
||||||
|
add(mSiteAlias, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
public P25DecoderState getDecoderState()
|
||||||
|
{
|
||||||
|
return (P25DecoderState) super.getDecoderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
final P25DecoderState state = getDecoderState();
|
||||||
|
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
|
||||||
switch( changedAttribute )
|
|
||||||
{
|
|
||||||
case NAC:
|
|
||||||
mNAC.setText( "NAC:" + state.getNAC() );
|
|
||||||
break;
|
|
||||||
case SYSTEM:
|
|
||||||
mSystem.setText( "SYS:" + state.getSystem() );
|
|
||||||
break;
|
|
||||||
case SITE:
|
|
||||||
mSite.setText( "SITE:" + state.getSite() );
|
|
||||||
break;
|
|
||||||
case SITE_ALIAS:
|
|
||||||
mSiteAlias.setText( state.getSiteAlias() );
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP:
|
|
||||||
if( state.getFromTalkgroup() == null )
|
|
||||||
{
|
|
||||||
mFrom.setText( " " );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFrom.setText( state.getFromTalkgroup() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP_ALIAS:
|
|
||||||
Alias from = state.getFromAlias();
|
|
||||||
|
|
||||||
if( from != null )
|
|
||||||
{
|
|
||||||
mFromAlias.setText( from.getName() );
|
|
||||||
|
|
||||||
final String icon = from.getIconName();
|
|
||||||
|
|
||||||
if( icon != null && mSettingsManager != null )
|
|
||||||
{
|
|
||||||
mFromAlias.setIcon( mSettingsManager.getImageIcon(
|
|
||||||
icon, SettingsManager.DEFAULT_ICON_SIZE ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromAlias.setText( " " );
|
|
||||||
mFromAlias.setIcon( null );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
if( state.getToTalkgroup() == null )
|
|
||||||
{
|
|
||||||
mTo.setText( " " );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mTo.setText( state.getToTalkgroup() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
final Alias to = state.getToAlias();
|
|
||||||
|
|
||||||
if( to != null )
|
|
||||||
{
|
|
||||||
mToAlias.setText( to.getName() );
|
|
||||||
|
|
||||||
final String icon = to.getIconName();
|
switch(changedAttribute)
|
||||||
|
{
|
||||||
if( icon != null && mSettingsManager != null )
|
case NAC:
|
||||||
{
|
mNAC.setText("NAC:" + state.getNAC());
|
||||||
mToAlias.setIcon( mSettingsManager.getImageIcon(
|
break;
|
||||||
icon, SettingsManager.DEFAULT_ICON_SIZE ) );
|
case SYSTEM:
|
||||||
}
|
mSystem.setText("SYS:" + state.getSystem());
|
||||||
}
|
break;
|
||||||
else
|
case SITE:
|
||||||
{
|
mSite.setText("SITE:" + state.getSite());
|
||||||
mToAlias.setText( " " );
|
break;
|
||||||
mToAlias.setIcon( null );
|
case SITE_ALIAS:
|
||||||
}
|
mSiteAlias.setText(state.getSiteAlias());
|
||||||
break;
|
break;
|
||||||
default:
|
case FROM_TALKGROUP:
|
||||||
break;
|
if(state.getFromTalkgroup() == null)
|
||||||
}
|
{
|
||||||
|
mFrom.setText(" ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mFrom.setText(state.getFromTalkgroup());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FROM_TALKGROUP_ALIAS:
|
||||||
|
Alias from = state.getFromAlias();
|
||||||
|
|
||||||
repaint();
|
if(from != null)
|
||||||
}
|
{
|
||||||
});
|
mFromAlias.setText(from.getName());
|
||||||
|
|
||||||
|
final String icon = from.getIconName();
|
||||||
|
|
||||||
|
if(icon != null && mIconManager != null)
|
||||||
|
{
|
||||||
|
mFromAlias.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mFromAlias.setText(" ");
|
||||||
|
mFromAlias.setIcon(null);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TO_TALKGROUP:
|
||||||
|
if(state.getToTalkgroup() == null)
|
||||||
|
{
|
||||||
|
mTo.setText(" ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mTo.setText(state.getToTalkgroup());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TO_TALKGROUP_ALIAS:
|
||||||
|
final Alias to = state.getToAlias();
|
||||||
|
|
||||||
|
if(to != null)
|
||||||
|
{
|
||||||
|
mToAlias.setText(to.getName());
|
||||||
|
|
||||||
|
final String icon = to.getIconName();
|
||||||
|
|
||||||
|
if(icon != null && mIconManager != null)
|
||||||
|
{
|
||||||
|
mToAlias.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mToAlias.setText(" ");
|
||||||
|
mToAlias.setIcon(null);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
super.settingChanged( setting );
|
super.settingChanged(setting);
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
if(setting instanceof ColorSetting)
|
||||||
{
|
{
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
switch(colorSetting.getColorSettingName())
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
if( mProtocol != null )
|
if(mProtocol != null)
|
||||||
{
|
{
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,226 +1,225 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.passport;
|
package module.decode.passport;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
import alias.Alias;
|
||||||
|
import icon.IconManager;
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import alias.Alias;
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class PassportDecoderPanel extends DecoderPanel
|
public class PassportDecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( "Passport" );
|
private JLabel mProtocol = new JLabel("Passport");
|
||||||
private JLabel mToTalkgroup = new JLabel();
|
private JLabel mToTalkgroup = new JLabel();
|
||||||
private JLabel mToTalkgroupAlias = new JLabel();
|
private JLabel mToTalkgroupAlias = new JLabel();
|
||||||
|
|
||||||
private JLabel mSiteAndChannel = new JLabel( "Site:" );
|
private JLabel mSiteAndChannel = new JLabel("Site:");
|
||||||
private JLabel mFromTalkgroup = new JLabel();
|
private JLabel mFromTalkgroup = new JLabel();
|
||||||
private JLabel mFromTalkgroupAlias = new JLabel();
|
private JLabel mFromTalkgroupAlias = new JLabel();
|
||||||
|
|
||||||
public PassportDecoderPanel( SettingsManager settingsManager,
|
|
||||||
PassportDecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
|
||||||
|
|
||||||
mProtocol.setFont( mFontDecoder );
|
public PassportDecoderPanel(IconManager iconManager, SettingsManager settingsManager, PassportDecoderState decoderState)
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mToTalkgroup.setFont( mFontDecoder );
|
|
||||||
mToTalkgroup.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mToTalkgroupAlias.setFont( mFontDecoder );
|
|
||||||
mToTalkgroupAlias.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mSiteAndChannel.setFont( mFontDecoder );
|
|
||||||
mSiteAndChannel.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mFromTalkgroup.setFont( mFontDecoder );
|
|
||||||
mFromTalkgroup.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
mFromTalkgroupAlias.setFont( mFontDecoder );
|
|
||||||
mFromTalkgroupAlias.setForeground( mColorLabelDecoder );
|
|
||||||
|
|
||||||
add( mProtocol );
|
|
||||||
add( mToTalkgroup );
|
|
||||||
add( mToTalkgroupAlias, "wrap" );
|
|
||||||
|
|
||||||
add( mSiteAndChannel );
|
|
||||||
add( mFromTalkgroup );
|
|
||||||
add( mFromTalkgroupAlias, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public PassportDecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (PassportDecoderState)super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater( new Runnable()
|
super(iconManager, settingsManager, decoderState);
|
||||||
{
|
|
||||||
@Override
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
|
|
||||||
|
mProtocol.setFont(mFontDecoder);
|
||||||
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mToTalkgroup.setFont(mFontDecoder);
|
||||||
|
mToTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mToTalkgroupAlias.setFont(mFontDecoder);
|
||||||
|
mToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mSiteAndChannel.setFont(mFontDecoder);
|
||||||
|
mSiteAndChannel.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mFromTalkgroup.setFont(mFontDecoder);
|
||||||
|
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
mFromTalkgroupAlias.setFont(mFontDecoder);
|
||||||
|
mFromTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
|
|
||||||
|
add(mProtocol);
|
||||||
|
add(mToTalkgroup);
|
||||||
|
add(mToTalkgroupAlias, "wrap");
|
||||||
|
|
||||||
|
add(mSiteAndChannel);
|
||||||
|
add(mFromTalkgroup);
|
||||||
|
add(mFromTalkgroupAlias, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
public PassportDecoderState getDecoderState()
|
||||||
|
{
|
||||||
|
return (PassportDecoderState) super.getDecoderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
PassportDecoderState state = getDecoderState();
|
PassportDecoderState state = getDecoderState();
|
||||||
|
|
||||||
switch( changedAttribute )
|
switch(changedAttribute)
|
||||||
{
|
{
|
||||||
case TO_TALKGROUP:
|
case TO_TALKGROUP:
|
||||||
String tg = state.getTalkgroup();
|
String tg = state.getTalkgroup();
|
||||||
|
|
||||||
if( tg != null )
|
if(tg != null)
|
||||||
{
|
{
|
||||||
mToTalkgroup.setText( "TG:" + tg );
|
mToTalkgroup.setText("TG:" + tg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mToTalkgroup.setText( null );
|
mToTalkgroup.setText(null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TO_TALKGROUP_ALIAS:
|
case TO_TALKGROUP_ALIAS:
|
||||||
Alias toAlias = state.getTalkgroupAlias();
|
Alias toAlias = state.getTalkgroupAlias();
|
||||||
|
|
||||||
if( toAlias != null )
|
if(toAlias != null)
|
||||||
{
|
{
|
||||||
mToTalkgroupAlias.setText( toAlias.getName() );
|
mToTalkgroupAlias.setText(toAlias.getName());
|
||||||
|
|
||||||
mToTalkgroupAlias.setIcon( mSettingsManager
|
mToTalkgroupAlias.setIcon(mIconManager.getIcon(toAlias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
|
||||||
.getImageIcon( toAlias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
mToTalkgroupAlias.setText(null);
|
||||||
mToTalkgroupAlias.setText( null );
|
mToTalkgroupAlias.setIcon(null);
|
||||||
mToTalkgroupAlias.setIcon( null );
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case FROM_TALKGROUP:
|
||||||
case FROM_TALKGROUP:
|
String mid = state.getMobileID();
|
||||||
String mid = state.getMobileID();
|
|
||||||
|
if(mid != null)
|
||||||
if( mid != null )
|
{
|
||||||
{
|
mFromTalkgroup.setText("MIN:" + mid);
|
||||||
mFromTalkgroup.setText( "MIN:" + mid );
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
mFromTalkgroup.setText(null);
|
||||||
mFromTalkgroup.setText( null );
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case FROM_TALKGROUP_ALIAS:
|
||||||
case FROM_TALKGROUP_ALIAS:
|
Alias fromAlias = state.getMobileIDAlias();
|
||||||
Alias fromAlias = state.getMobileIDAlias();
|
|
||||||
|
if(fromAlias != null)
|
||||||
if( fromAlias != null )
|
{
|
||||||
{
|
mFromTalkgroupAlias.setText(fromAlias.getName());
|
||||||
mFromTalkgroupAlias.setText( fromAlias.getName() );
|
|
||||||
|
mFromTalkgroupAlias.setIcon(mIconManager
|
||||||
mFromTalkgroupAlias.setIcon( mSettingsManager
|
.getIcon(fromAlias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
|
||||||
.getImageIcon( fromAlias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
mFromTalkgroupAlias.setText(null);
|
||||||
mFromTalkgroupAlias.setText( null );
|
mFromTalkgroupAlias.setIcon(null);
|
||||||
mFromTalkgroupAlias.setIcon( null );
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case CHANNEL_NUMBER:
|
||||||
case CHANNEL_NUMBER:
|
StringBuilder sb = new StringBuilder();
|
||||||
StringBuilder sb = new StringBuilder();
|
sb.append("Site: ");
|
||||||
sb.append( "Site: " );
|
sb.append(state.getSiteNumber());
|
||||||
sb.append( state.getSiteNumber() );
|
sb.append("/");
|
||||||
sb.append( "/" );
|
sb.append(state.getChannelNumber());
|
||||||
sb.append( state.getChannelNumber() );
|
|
||||||
|
mSiteAndChannel.setText(sb.toString());
|
||||||
mSiteAndChannel.setText( sb.toString() );
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
repaint();
|
||||||
repaint();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
super.settingChanged( setting );
|
super.settingChanged(setting);
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
if(setting instanceof ColorSetting)
|
||||||
{
|
{
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
switch(colorSetting.getColorSettingName())
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
if( mColorLabelDecoder != null )
|
if(mColorLabelDecoder != null)
|
||||||
{
|
{
|
||||||
if( mProtocol != null )
|
if(mProtocol != null)
|
||||||
{
|
{
|
||||||
mProtocol.setForeground( mColorLabelDecoder );
|
mProtocol.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mToTalkgroup != null )
|
if(mToTalkgroup != null)
|
||||||
{
|
{
|
||||||
mToTalkgroup.setForeground( mColorLabelDecoder );
|
mToTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mToTalkgroupAlias != null )
|
if(mToTalkgroupAlias != null)
|
||||||
{
|
{
|
||||||
mToTalkgroupAlias.setForeground( mColorLabelDecoder );
|
mToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mSiteAndChannel != null )
|
if(mSiteAndChannel != null)
|
||||||
{
|
{
|
||||||
mSiteAndChannel.setForeground( mColorLabelDecoder );
|
mSiteAndChannel.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mFromTalkgroup != null )
|
if(mFromTalkgroup != null)
|
||||||
{
|
{
|
||||||
mFromTalkgroup.setForeground( mColorLabelDecoder );
|
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
if( mFromTalkgroupAlias != null )
|
if(mFromTalkgroupAlias != null)
|
||||||
{
|
{
|
||||||
mFromTalkgroupAlias.setForeground( mColorLabelDecoder );
|
mFromTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,23 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.state;
|
package module.decode.state;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
import java.awt.event.MouseListener;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
import javax.swing.JSeparator;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.ColorSetting.ColorSettingName;
|
|
||||||
import settings.ColorSettingMenuItem;
|
|
||||||
import settings.ColorSettingResetMenuItem;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
import audio.AudioPanel;
|
import audio.AudioPanel;
|
||||||
import controller.channel.Channel;
|
import controller.channel.Channel;
|
||||||
import controller.channel.ChannelEvent;
|
import controller.channel.ChannelEvent;
|
||||||
@@ -41,266 +25,293 @@ import controller.channel.ChannelEvent.Event;
|
|||||||
import controller.channel.ChannelEventListener;
|
import controller.channel.ChannelEventListener;
|
||||||
import controller.channel.ChannelModel;
|
import controller.channel.ChannelModel;
|
||||||
import controller.channel.ChannelProcessingManager;
|
import controller.channel.ChannelProcessingManager;
|
||||||
|
import icon.IconManager;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import settings.ColorSetting.ColorSettingName;
|
||||||
|
import settings.ColorSettingMenuItem;
|
||||||
|
import settings.ColorSettingResetMenuItem;
|
||||||
|
import settings.SettingsManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gui wrapper for the list of currently processing primary channels
|
* Gui wrapper for the list of currently processing primary channels
|
||||||
*/
|
*/
|
||||||
public class ChannelList extends JPanel implements ChannelEventListener
|
public class ChannelList extends JPanel implements ChannelEventListener
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Map<Channel,ChannelPanel> mDisplayedPanels = new ConcurrentHashMap<>();
|
private Map<Channel, ChannelPanel> mDisplayedPanels = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private ChannelModel mChannelModel;
|
private ChannelModel mChannelModel;
|
||||||
private ChannelProcessingManager mChannelProcessingManager;
|
private ChannelProcessingManager mChannelProcessingManager;
|
||||||
|
private IconManager mIconManager;
|
||||||
private SettingsManager mSettingsManager;
|
private SettingsManager mSettingsManager;
|
||||||
private AudioPanel mAudioPanel;
|
private AudioPanel mAudioPanel;
|
||||||
|
|
||||||
public ChannelList( ChannelModel channelModel,
|
|
||||||
ChannelProcessingManager channelProcessingManager,
|
|
||||||
SettingsManager settingsManager,
|
|
||||||
AudioPanel audioPanel )
|
|
||||||
{
|
|
||||||
mChannelModel = channelModel;
|
|
||||||
mChannelProcessingManager = channelProcessingManager;
|
|
||||||
mSettingsManager = settingsManager;
|
|
||||||
mAudioPanel = audioPanel;
|
|
||||||
|
|
||||||
init();
|
public ChannelList(ChannelModel channelModel,
|
||||||
|
ChannelProcessingManager channelProcessingManager,
|
||||||
|
IconManager iconManager,
|
||||||
|
SettingsManager settingsManager,
|
||||||
|
AudioPanel audioPanel)
|
||||||
|
{
|
||||||
|
mChannelModel = channelModel;
|
||||||
|
mChannelProcessingManager = channelProcessingManager;
|
||||||
|
mIconManager = iconManager;
|
||||||
|
mSettingsManager = settingsManager;
|
||||||
|
mAudioPanel = audioPanel;
|
||||||
|
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0,wrap 1", "[grow,fill]", "[]0[]") );
|
setLayout(new MigLayout("insets 0 0 0 0,wrap 1", "[grow,fill]", "[]0[]"));
|
||||||
setBackground( Color.BLACK );
|
setBackground(Color.BLACK);
|
||||||
|
|
||||||
addMouseListener( new ListSelectionListener() );
|
addMouseListener(new ListSelectionListener());
|
||||||
|
|
||||||
add( mAudioPanel );
|
add(mAudioPanel);
|
||||||
|
|
||||||
JSeparator separator = new JSeparator( JSeparator.HORIZONTAL );
|
JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
|
||||||
add( separator );
|
add(separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelChanged( ChannelEvent event )
|
public void channelChanged(ChannelEvent event)
|
||||||
{
|
{
|
||||||
switch( event.getEvent() )
|
switch(event.getEvent())
|
||||||
{
|
|
||||||
case NOTIFICATION_PROCESSING_START:
|
|
||||||
addChannelPanel( event.getChannel() );
|
|
||||||
break;
|
|
||||||
case NOTIFICATION_PROCESSING_STOP:
|
|
||||||
removeChannelPanel( event.getChannel() );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addChannelPanel( Channel channel )
|
|
||||||
{
|
|
||||||
if( !mDisplayedPanels.containsKey( channel ) )
|
|
||||||
{
|
|
||||||
ChannelPanel channelPanel = new ChannelPanel( mChannelModel,
|
|
||||||
mChannelProcessingManager, mSettingsManager, channel );
|
|
||||||
|
|
||||||
add( channelPanel );
|
|
||||||
|
|
||||||
mDisplayedPanels.put( channel, channelPanel );
|
|
||||||
|
|
||||||
revalidate();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeChannelPanel( Channel channel )
|
|
||||||
{
|
|
||||||
if( mDisplayedPanels.containsKey( channel ) )
|
|
||||||
{
|
|
||||||
ChannelPanel panel = mDisplayedPanels.remove( channel );
|
|
||||||
|
|
||||||
if( panel != null )
|
|
||||||
{
|
|
||||||
remove( panel );
|
|
||||||
|
|
||||||
panel.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
revalidate();
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ListSelectionListener implements MouseListener
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void mouseClicked( MouseEvent e )
|
|
||||||
{
|
{
|
||||||
Component component = getComponentAt( e.getPoint() );
|
case NOTIFICATION_PROCESSING_START:
|
||||||
|
addChannelPanel(event.getChannel());
|
||||||
|
break;
|
||||||
|
case NOTIFICATION_PROCESSING_STOP:
|
||||||
|
removeChannelPanel(event.getChannel());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( component instanceof ChannelPanel )
|
private void addChannelPanel(Channel channel)
|
||||||
{
|
{
|
||||||
ChannelPanel panel = (ChannelPanel)component;
|
if(!mDisplayedPanels.containsKey(channel))
|
||||||
|
{
|
||||||
|
ChannelPanel channelPanel = new ChannelPanel(mChannelModel,
|
||||||
|
mChannelProcessingManager, mIconManager, mSettingsManager, channel);
|
||||||
|
|
||||||
Channel channel = panel.getChannel();
|
add(channelPanel);
|
||||||
|
|
||||||
if( e.getButton() == MouseEvent.BUTTON1 )
|
mDisplayedPanels.put(channel, channelPanel);
|
||||||
{
|
|
||||||
if( channel.isSelected() )
|
|
||||||
{
|
|
||||||
mChannelModel.broadcast( new ChannelEvent( channel, Event.REQUEST_DESELECT ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mChannelModel.broadcast( new ChannelEvent( channel, Event.REQUEST_SELECT ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( e.getButton() == MouseEvent.BUTTON3 )
|
|
||||||
{
|
|
||||||
JPopupMenu popupMenu = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenu menu = panel.getContextMenu();
|
|
||||||
|
|
||||||
if( menu != null )
|
|
||||||
{
|
|
||||||
popupMenu.add( menu );
|
|
||||||
}
|
|
||||||
|
|
||||||
JMenu colorMenu = new JMenu( "Color" );
|
|
||||||
popupMenu.add( colorMenu );
|
|
||||||
|
|
||||||
JMenu backgroundMenu = new JMenu( "Background" );
|
revalidate();
|
||||||
colorMenu.add( backgroundMenu );
|
repaint();
|
||||||
|
}
|
||||||
backgroundMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
}
|
||||||
ColorSettingName.CHANNEL_STATE_BACKGROUND ) );
|
|
||||||
backgroundMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_BACKGROUND ) );
|
|
||||||
|
|
||||||
JMenu channelsMenu = new JMenu( "Channel State" );
|
|
||||||
colorMenu.add( channelsMenu );
|
|
||||||
|
|
||||||
JMenu callMenu = new JMenu( "Call" );
|
|
||||||
channelsMenu.add( callMenu );
|
|
||||||
|
|
||||||
callMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL ) );
|
|
||||||
callMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL ) );
|
|
||||||
callMenu.add( new JSeparator() );
|
|
||||||
|
|
||||||
callMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
public void removeChannelPanel(Channel channel)
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL ) );
|
{
|
||||||
callMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
if(mDisplayedPanels.containsKey(channel))
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL ) );
|
{
|
||||||
|
ChannelPanel panel = mDisplayedPanels.remove(channel);
|
||||||
JMenu controlMenu = new JMenu( "Control" );
|
|
||||||
channelsMenu.add( controlMenu );
|
if(panel != null)
|
||||||
|
{
|
||||||
controlMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
remove(panel);
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL ) );
|
|
||||||
controlMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
panel.dispose();
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL ) );
|
}
|
||||||
controlMenu.add( new JSeparator() );
|
|
||||||
|
revalidate();
|
||||||
controlMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
repaint();
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL ) );
|
}
|
||||||
controlMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
}
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL ) );
|
|
||||||
|
public class ListSelectionListener implements MouseListener
|
||||||
JMenu dataMenu = new JMenu( "Data" );
|
{
|
||||||
channelsMenu.add( dataMenu );
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e)
|
||||||
dataMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
{
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA ) );
|
Component component = getComponentAt(e.getPoint());
|
||||||
dataMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA ) );
|
if(component instanceof ChannelPanel)
|
||||||
dataMenu.add( new JSeparator() );
|
{
|
||||||
|
ChannelPanel panel = (ChannelPanel) component;
|
||||||
dataMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA ) );
|
Channel channel = panel.getChannel();
|
||||||
dataMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA ) );
|
if(e.getButton() == MouseEvent.BUTTON1)
|
||||||
|
{
|
||||||
JMenu fadeMenu = new JMenu( "Fade" );
|
if(channel.isSelected())
|
||||||
channelsMenu.add( fadeMenu );
|
{
|
||||||
|
mChannelModel.broadcast(new ChannelEvent(channel, Event.REQUEST_DESELECT));
|
||||||
fadeMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
}
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE ) );
|
else
|
||||||
fadeMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
{
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE ) );
|
mChannelModel.broadcast(new ChannelEvent(channel, Event.REQUEST_SELECT));
|
||||||
fadeMenu.add( new JSeparator() );
|
}
|
||||||
|
}
|
||||||
fadeMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
else if(e.getButton() == MouseEvent.BUTTON3)
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE ) );
|
{
|
||||||
fadeMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
JPopupMenu popupMenu = new JPopupMenu();
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE ) );
|
|
||||||
|
JMenu menu = panel.getContextMenu();
|
||||||
JMenu idleMenu = new JMenu( "Idle" );
|
|
||||||
channelsMenu.add( idleMenu );
|
if(menu != null)
|
||||||
|
{
|
||||||
idleMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
popupMenu.add(menu);
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE ) );
|
}
|
||||||
idleMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE ) );
|
JMenu colorMenu = new JMenu("Color");
|
||||||
idleMenu.add( new JSeparator() );
|
popupMenu.add(colorMenu);
|
||||||
|
|
||||||
idleMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
JMenu backgroundMenu = new JMenu("Background");
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE ) );
|
colorMenu.add(backgroundMenu);
|
||||||
idleMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE ) );
|
backgroundMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_BACKGROUND));
|
||||||
JMenu noTunerMenu = new JMenu( "No Tuner" );
|
backgroundMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
channelsMenu.add( noTunerMenu );
|
ColorSettingName.CHANNEL_STATE_BACKGROUND));
|
||||||
|
|
||||||
noTunerMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
JMenu channelsMenu = new JMenu("Channel State");
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER ) );
|
colorMenu.add(channelsMenu);
|
||||||
noTunerMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER ) );
|
JMenu callMenu = new JMenu("Call");
|
||||||
noTunerMenu.add( new JSeparator() );
|
channelsMenu.add(callMenu);
|
||||||
|
|
||||||
noTunerMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
callMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL));
|
||||||
noTunerMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
callMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL));
|
||||||
|
callMenu.add(new JSeparator());
|
||||||
JMenu labelMenu = new JMenu( "Labels" );
|
|
||||||
colorMenu.add( labelMenu );
|
callMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL));
|
||||||
labelMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
callMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL));
|
||||||
labelMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER ) );
|
JMenu controlMenu = new JMenu("Control");
|
||||||
labelMenu.add( new JSeparator() );
|
channelsMenu.add(controlMenu);
|
||||||
|
|
||||||
labelMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
controlMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL));
|
||||||
labelMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
controlMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL));
|
||||||
labelMenu.add( new JSeparator() );
|
controlMenu.add(new JSeparator());
|
||||||
|
|
||||||
labelMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
controlMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL));
|
||||||
labelMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
controlMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL));
|
||||||
|
|
||||||
JMenu selectedMenu = new JMenu( "Selected" );
|
JMenu dataMenu = new JMenu("Data");
|
||||||
colorMenu.add( selectedMenu );
|
channelsMenu.add(dataMenu);
|
||||||
|
|
||||||
selectedMenu.add( new ColorSettingMenuItem( mSettingsManager,
|
dataMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA));
|
||||||
selectedMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
|
dataMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL ) );
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA));
|
||||||
|
dataMenu.add(new JSeparator());
|
||||||
popupMenu.show( ChannelList.this, e.getX(), e.getY() );
|
|
||||||
}
|
dataMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
}
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA));
|
||||||
|
dataMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA));
|
||||||
|
|
||||||
|
JMenu fadeMenu = new JMenu("Fade");
|
||||||
|
channelsMenu.add(fadeMenu);
|
||||||
|
|
||||||
|
fadeMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE));
|
||||||
|
fadeMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE));
|
||||||
|
fadeMenu.add(new JSeparator());
|
||||||
|
|
||||||
|
fadeMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE));
|
||||||
|
fadeMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE));
|
||||||
|
|
||||||
|
JMenu idleMenu = new JMenu("Idle");
|
||||||
|
channelsMenu.add(idleMenu);
|
||||||
|
|
||||||
|
idleMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE));
|
||||||
|
idleMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE));
|
||||||
|
idleMenu.add(new JSeparator());
|
||||||
|
|
||||||
|
idleMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE));
|
||||||
|
idleMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE));
|
||||||
|
|
||||||
|
JMenu noTunerMenu = new JMenu("No Tuner");
|
||||||
|
channelsMenu.add(noTunerMenu);
|
||||||
|
|
||||||
|
noTunerMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER));
|
||||||
|
noTunerMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER));
|
||||||
|
noTunerMenu.add(new JSeparator());
|
||||||
|
|
||||||
|
noTunerMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER));
|
||||||
|
noTunerMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER));
|
||||||
|
|
||||||
|
JMenu labelMenu = new JMenu("Labels");
|
||||||
|
colorMenu.add(labelMenu);
|
||||||
|
|
||||||
|
labelMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER));
|
||||||
|
labelMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER));
|
||||||
|
labelMenu.add(new JSeparator());
|
||||||
|
|
||||||
|
labelMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_DECODER));
|
||||||
|
labelMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_DECODER));
|
||||||
|
labelMenu.add(new JSeparator());
|
||||||
|
|
||||||
|
labelMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS));
|
||||||
|
labelMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS));
|
||||||
|
|
||||||
|
JMenu selectedMenu = new JMenu("Selected");
|
||||||
|
colorMenu.add(selectedMenu);
|
||||||
|
|
||||||
|
selectedMenu.add(new ColorSettingMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL));
|
||||||
|
selectedMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
|
||||||
|
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL));
|
||||||
|
|
||||||
|
popupMenu.show(ChannelList.this, e.getX(), e.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mousePressed( MouseEvent e ) {}
|
public void mousePressed(MouseEvent e)
|
||||||
public void mouseReleased( MouseEvent e ) {}
|
{
|
||||||
public void mouseEntered( MouseEvent e ) {}
|
}
|
||||||
public void mouseExited( MouseEvent e ) {}
|
|
||||||
}
|
public void mouseReleased(MouseEvent e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseEntered(MouseEvent e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseExited(MouseEvent e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,36 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* sdrtrunk
|
||||||
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
package module.decode.state;
|
package module.decode.state;
|
||||||
|
|
||||||
import java.awt.Color;
|
import controller.channel.Channel;
|
||||||
import java.awt.EventQueue;
|
import controller.channel.ChannelEvent;
|
||||||
import java.awt.Font;
|
import controller.channel.ChannelEvent.Event;
|
||||||
import java.awt.GradientPaint;
|
import controller.channel.ChannelEventListener;
|
||||||
import java.awt.Graphics;
|
import controller.channel.ChannelModel;
|
||||||
import java.awt.Graphics2D;
|
import controller.channel.ChannelProcessingManager;
|
||||||
import java.awt.Paint;
|
import controller.channel.ChannelUtils;
|
||||||
import java.util.ArrayList;
|
import icon.IconManager;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
import module.ProcessingChain;
|
import module.ProcessingChain;
|
||||||
import module.decode.DecoderFactory;
|
import module.decode.DecoderFactory;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import record.RecorderType;
|
import record.RecorderType;
|
||||||
import record.config.RecordConfiguration;
|
import record.config.RecordConfiguration;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
@@ -29,25 +39,23 @@ import settings.ColorSetting.ColorSettingName;
|
|||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingChangeListener;
|
import settings.SettingChangeListener;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import controller.channel.Channel;
|
|
||||||
import controller.channel.ChannelEvent;
|
|
||||||
import controller.channel.ChannelEvent.Event;
|
|
||||||
import controller.channel.ChannelEventListener;
|
|
||||||
import controller.channel.ChannelModel;
|
|
||||||
import controller.channel.ChannelProcessingManager;
|
|
||||||
import controller.channel.ChannelUtils;
|
|
||||||
|
|
||||||
public class ChannelPanel extends JPanel
|
import javax.swing.*;
|
||||||
implements Listener<ChangedAttribute>,
|
import java.awt.*;
|
||||||
SettingChangeListener,
|
import java.util.ArrayList;
|
||||||
ChannelEventListener
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ChannelPanel extends JPanel
|
||||||
|
implements Listener<ChangedAttribute>,
|
||||||
|
SettingChangeListener,
|
||||||
|
ChannelEventListener
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( ChannelPanel.class );
|
private final static Logger mLog = LoggerFactory.getLogger(ChannelPanel.class);
|
||||||
|
|
||||||
private Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
private Font mFontDetails = new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
||||||
private Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
private Font mFontDecoder = new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
||||||
|
|
||||||
protected Color mColorChannelBackground;
|
protected Color mColorChannelBackground;
|
||||||
protected Color mColorChannelSelected;
|
protected Color mColorChannelSelected;
|
||||||
@@ -70,383 +78,388 @@ public class ChannelPanel extends JPanel
|
|||||||
private JLabel mStateLabel;
|
private JLabel mStateLabel;
|
||||||
private JLabel mSourceLabel;
|
private JLabel mSourceLabel;
|
||||||
private JLabel mOptionsLabel;
|
private JLabel mOptionsLabel;
|
||||||
|
|
||||||
private JLabel mSystemLabel;
|
private JLabel mSystemLabel;
|
||||||
private JLabel mSiteLabel;
|
private JLabel mSiteLabel;
|
||||||
private JLabel mChannelLabel;
|
private JLabel mChannelLabel;
|
||||||
|
|
||||||
protected SettingsManager mSettingsManager;
|
protected SettingsManager mSettingsManager;
|
||||||
|
protected IconManager mIconManager;
|
||||||
|
|
||||||
private Channel mChannel;
|
private Channel mChannel;
|
||||||
private ChannelState mChannelState;
|
private ChannelState mChannelState;
|
||||||
private List<DecoderPanel> mDecoderPanels = new ArrayList<>();
|
private List<DecoderPanel> mDecoderPanels = new ArrayList<>();
|
||||||
private ChannelModel mChannelModel;
|
private ChannelModel mChannelModel;
|
||||||
private ChannelProcessingManager mChannelProcessingManager;
|
private ChannelProcessingManager mChannelProcessingManager;
|
||||||
|
|
||||||
/**
|
|
||||||
* Gui component to a channel state. Provides System, Site and channel
|
|
||||||
* name, source and channel state visualization.
|
|
||||||
*
|
|
||||||
* Updates color background according to current channel state.
|
|
||||||
*/
|
|
||||||
public ChannelPanel( ChannelModel channelModel,
|
|
||||||
ChannelProcessingManager channelProcessingManager,
|
|
||||||
SettingsManager settingsManager,
|
|
||||||
Channel channel )
|
|
||||||
{
|
|
||||||
mChannelModel = channelModel;
|
|
||||||
mChannelProcessingManager = channelProcessingManager;
|
|
||||||
mSettingsManager = settingsManager;
|
|
||||||
mChannel = channel;
|
|
||||||
|
|
||||||
ProcessingChain processingChain =
|
|
||||||
channelProcessingManager.getProcessingChain( mChannel );
|
|
||||||
|
|
||||||
if( processingChain != null )
|
/**
|
||||||
{
|
* Gui component to a channel state. Provides System, Site and channel
|
||||||
mChannelState = processingChain.getChannelState();
|
* name, source and channel state visualization.
|
||||||
|
*
|
||||||
|
* Updates color background according to current channel state.
|
||||||
|
*/
|
||||||
|
public ChannelPanel(ChannelModel channelModel,
|
||||||
|
ChannelProcessingManager channelProcessingManager,
|
||||||
|
IconManager iconManager,
|
||||||
|
SettingsManager settingsManager,
|
||||||
|
Channel channel)
|
||||||
|
{
|
||||||
|
mChannelModel = channelModel;
|
||||||
|
mChannelProcessingManager = channelProcessingManager;
|
||||||
|
mIconManager = iconManager;
|
||||||
|
mSettingsManager = settingsManager;
|
||||||
|
mChannel = channel;
|
||||||
|
|
||||||
init();
|
ProcessingChain processingChain =
|
||||||
|
channelProcessingManager.getProcessingChain(mChannel);
|
||||||
|
|
||||||
for( DecoderState decoderState: processingChain.getDecoderStates() )
|
if(processingChain != null)
|
||||||
{
|
{
|
||||||
DecoderPanel panel = DecoderFactory.getDecoderPanel( mSettingsManager, decoderState );
|
mChannelState = processingChain.getChannelState();
|
||||||
mDecoderPanels.add( panel );
|
|
||||||
add( panel, "grow,span" );
|
|
||||||
}
|
|
||||||
|
|
||||||
mChannelState.setChangedAttributeListener( this );
|
init();
|
||||||
mChannelModel.addListener( this );
|
|
||||||
mSettingsManager.addListener( this );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mLog.error( "Processing Chain was null!" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init()
|
|
||||||
{
|
|
||||||
getColors();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 1 1 1 1", "[grow,fill]", "[]0[]0[]") );
|
for(DecoderState decoderState : processingChain.getDecoderStates())
|
||||||
|
{
|
||||||
mSystemLabel = new JLabel( mChannel.getSystem() );
|
DecoderPanel panel = DecoderFactory.getDecoderPanel(mIconManager, mSettingsManager, decoderState);
|
||||||
mSystemLabel.setFont( mFontDetails );
|
mDecoderPanels.add(panel);
|
||||||
mSystemLabel.setForeground( mColorLabelDetails );
|
add(panel, "grow,span");
|
||||||
add( mSystemLabel );
|
}
|
||||||
|
|
||||||
mSiteLabel = new JLabel( mChannel.getSite() );
|
|
||||||
mSiteLabel.setFont( mFontDetails );
|
|
||||||
mSiteLabel.setForeground( mColorLabelDetails );
|
|
||||||
add( mSiteLabel );
|
|
||||||
|
|
||||||
mChannelLabel = new JLabel( mChannel.getName() );
|
mChannelState.setChangedAttributeListener(this);
|
||||||
mChannelLabel.setFont( mFontDetails );
|
mChannelModel.addListener(this);
|
||||||
mChannelLabel.setForeground( mColorLabelDetails );
|
mSettingsManager.addListener(this);
|
||||||
add( mChannelLabel, "wrap" );
|
}
|
||||||
|
else
|
||||||
mStateLabel = new JLabel( mChannelState.getState().getDisplayValue() );
|
{
|
||||||
mStateLabel.setFont( mFontDecoder );
|
mLog.error("Processing Chain was null!");
|
||||||
mStateLabel.setForeground( mColorLabelDecoder );
|
}
|
||||||
add( mStateLabel );
|
}
|
||||||
|
|
||||||
mSourceLabel = new JLabel( mChannel.getSourceConfiguration().getDescription() );
|
|
||||||
mSourceLabel.setFont( mFontDetails );
|
|
||||||
mSourceLabel.setForeground( mColorLabelDetails );
|
|
||||||
add( mSourceLabel );
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
if( !mChannel.getEventLogConfiguration().getLoggers().isEmpty() )
|
private void init()
|
||||||
{
|
{
|
||||||
sb.append( "LOG " );
|
getColors();
|
||||||
}
|
|
||||||
|
|
||||||
RecordConfiguration recordConfig = mChannel.getRecordConfiguration();
|
|
||||||
|
|
||||||
if( recordConfig.getRecorders().contains( RecorderType.AUDIO ) )
|
|
||||||
{
|
|
||||||
sb.append( "AUDIO " );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( recordConfig.getRecorders().contains( RecorderType.BASEBAND ) ||
|
|
||||||
recordConfig.getRecorders().contains( RecorderType.TRAFFIC_BASEBAND ) )
|
|
||||||
{
|
|
||||||
sb.append( "BASEBAND" );
|
|
||||||
}
|
|
||||||
|
|
||||||
mOptionsLabel = new JLabel( sb.toString() );
|
|
||||||
mOptionsLabel.setFont( mFontDetails );
|
|
||||||
mOptionsLabel.setForeground( mColorLabelAuxDecoder );
|
|
||||||
add( mOptionsLabel, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Channel getChannel()
|
|
||||||
{
|
|
||||||
return mChannel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
mChannelModel.removeListener( this );
|
|
||||||
mChannelModel = null;
|
|
||||||
|
|
||||||
mChannelProcessingManager = null;
|
|
||||||
|
|
||||||
mSettingsManager.removeListener( this );
|
setLayout(new MigLayout("insets 1 1 1 1", "[grow,fill]", "[]0[]0[]"));
|
||||||
mSettingsManager = null;
|
|
||||||
|
mSystemLabel = new JLabel(mChannel.getSystem());
|
||||||
mChannelState.removeChangedAttributeListener();
|
mSystemLabel.setFont(mFontDetails);
|
||||||
mChannelState = null;
|
mSystemLabel.setForeground(mColorLabelDetails);
|
||||||
mChannel = null;
|
add(mSystemLabel);
|
||||||
|
|
||||||
for( DecoderPanel panel: mDecoderPanels )
|
mSiteLabel = new JLabel(mChannel.getSite());
|
||||||
{
|
mSiteLabel.setFont(mFontDetails);
|
||||||
panel.dispose();
|
mSiteLabel.setForeground(mColorLabelDetails);
|
||||||
remove( panel );
|
add(mSiteLabel);
|
||||||
}
|
|
||||||
|
mChannelLabel = new JLabel(mChannel.getName());
|
||||||
mDecoderPanels.clear();
|
mChannelLabel.setFont(mFontDetails);
|
||||||
}
|
mChannelLabel.setForeground(mColorLabelDetails);
|
||||||
|
add(mChannelLabel, "wrap");
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
mStateLabel = new JLabel(mChannelState.getState().getDisplayValue());
|
||||||
{
|
mStateLabel.setFont(mFontDecoder);
|
||||||
EventQueue.invokeLater( new Runnable()
|
mStateLabel.setForeground(mColorLabelDecoder);
|
||||||
{
|
add(mStateLabel);
|
||||||
@Override
|
|
||||||
|
mSourceLabel = new JLabel(mChannel.getSourceConfiguration().getDescription());
|
||||||
|
mSourceLabel.setFont(mFontDetails);
|
||||||
|
mSourceLabel.setForeground(mColorLabelDetails);
|
||||||
|
add(mSourceLabel);
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if(!mChannel.getEventLogConfiguration().getLoggers().isEmpty())
|
||||||
|
{
|
||||||
|
sb.append("LOG ");
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordConfiguration recordConfig = mChannel.getRecordConfiguration();
|
||||||
|
|
||||||
|
if(recordConfig.getRecorders().contains(RecorderType.AUDIO))
|
||||||
|
{
|
||||||
|
sb.append("AUDIO ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(recordConfig.getRecorders().contains(RecorderType.BASEBAND) ||
|
||||||
|
recordConfig.getRecorders().contains(RecorderType.TRAFFIC_BASEBAND))
|
||||||
|
{
|
||||||
|
sb.append("BASEBAND");
|
||||||
|
}
|
||||||
|
|
||||||
|
mOptionsLabel = new JLabel(sb.toString());
|
||||||
|
mOptionsLabel.setFont(mFontDetails);
|
||||||
|
mOptionsLabel.setForeground(mColorLabelAuxDecoder);
|
||||||
|
add(mOptionsLabel, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Channel getChannel()
|
||||||
|
{
|
||||||
|
return mChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
mChannelModel.removeListener(this);
|
||||||
|
mChannelModel = null;
|
||||||
|
|
||||||
|
mChannelProcessingManager = null;
|
||||||
|
|
||||||
|
mSettingsManager.removeListener(this);
|
||||||
|
mSettingsManager = null;
|
||||||
|
|
||||||
|
mChannelState.removeChangedAttributeListener();
|
||||||
|
mChannelState = null;
|
||||||
|
mChannel = null;
|
||||||
|
|
||||||
|
for(DecoderPanel panel : mDecoderPanels)
|
||||||
|
{
|
||||||
|
panel.dispose();
|
||||||
|
remove(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
mDecoderPanels.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
switch( changedAttribute )
|
switch(changedAttribute)
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE:
|
case CHANNEL_STATE:
|
||||||
if( mChannelState != null && mChannelState.getState() != null )
|
if(mChannelState != null && mChannelState.getState() != null)
|
||||||
{
|
{
|
||||||
mStateLabel.setText( mChannelState.getState().getDisplayValue() );
|
mStateLabel.setText(mChannelState.getState().getDisplayValue());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SOURCE:
|
case SOURCE:
|
||||||
mSourceLabel.setText( mChannel.getSourceConfiguration()
|
mSourceLabel.setText(mChannel.getSourceConfiguration()
|
||||||
.getDescription() );
|
.getDescription());
|
||||||
break;
|
break;
|
||||||
case CHANNEL_NAME:
|
case CHANNEL_NAME:
|
||||||
case SITE_NAME:
|
case SITE_NAME:
|
||||||
case SYSTEM_NAME:
|
case SYSTEM_NAME:
|
||||||
mChannelLabel.setText( mChannel.toString() );
|
mChannelLabel.setText(mChannel.toString());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void paintComponent(Graphics g)
|
protected void paintComponent(Graphics g)
|
||||||
{
|
{
|
||||||
super.paintComponent( g );
|
super.paintComponent(g);
|
||||||
|
|
||||||
setBackground( mColorChannelBackground );
|
setBackground(mColorChannelBackground);
|
||||||
|
|
||||||
Graphics2D g2 = (Graphics2D)g.create();
|
Graphics2D g2 = (Graphics2D) g.create();
|
||||||
|
|
||||||
Paint p = null;
|
Paint p = null;
|
||||||
|
|
||||||
final Channel channel = mChannel;
|
final Channel channel = mChannel;
|
||||||
|
|
||||||
if( mChannelState != null )
|
if(mChannelState != null)
|
||||||
{
|
{
|
||||||
switch( mChannelState.getState() )
|
switch(mChannelState.getState())
|
||||||
{
|
{
|
||||||
case CALL:
|
case CALL:
|
||||||
p = getGradient( mColorTopCall, mColorMiddleCall );
|
p = getGradient(mColorTopCall, mColorMiddleCall);
|
||||||
break;
|
break;
|
||||||
case CONTROL:
|
case CONTROL:
|
||||||
p = getGradient( mColorTopControl, mColorMiddleControl );
|
p = getGradient(mColorTopControl, mColorMiddleControl);
|
||||||
break;
|
break;
|
||||||
case DATA:
|
case DATA:
|
||||||
p = getGradient( mColorTopData, mColorMiddleData );
|
p = getGradient(mColorTopData, mColorMiddleData);
|
||||||
break;
|
break;
|
||||||
case FADE:
|
case FADE:
|
||||||
p = getGradient( mColorTopFade, mColorMiddleFade );
|
p = getGradient(mColorTopFade, mColorMiddleFade);
|
||||||
break;
|
break;
|
||||||
case IDLE:
|
case IDLE:
|
||||||
default:
|
default:
|
||||||
p = getGradient( mColorTopIdle, mColorMiddleIdle );
|
p = getGradient(mColorTopIdle, mColorMiddleIdle);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( p == null )
|
if(p == null)
|
||||||
{
|
{
|
||||||
p = getGradient( mColorTopIdle, mColorMiddleIdle );
|
p = getGradient(mColorTopIdle, mColorMiddleIdle);
|
||||||
}
|
}
|
||||||
|
|
||||||
g2.setPaint( p );
|
g2.setPaint(p);
|
||||||
g2.fillRect( 0, 0, getWidth(), getHeight() );
|
g2.fillRect(0, 0, getWidth(), getHeight());
|
||||||
|
|
||||||
/* Draw bottom separator line */
|
/* Draw bottom separator line */
|
||||||
g2.setColor( Color.LIGHT_GRAY );
|
g2.setColor(Color.LIGHT_GRAY);
|
||||||
g2.drawLine( 0, getHeight() - 1, getWidth(), getHeight() - 1 );
|
g2.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
|
||||||
|
|
||||||
/* Draw channel selected box */
|
/* Draw channel selected box */
|
||||||
if( getChannel() != null && getChannel().isSelected() )
|
if(getChannel() != null && getChannel().isSelected())
|
||||||
{
|
{
|
||||||
g2.setColor( mColorChannelSelected );
|
g2.setColor(mColorChannelSelected);
|
||||||
g2.drawRect( 1, 1, getWidth() - 2, getHeight() - 2 );
|
g2.drawRect(1, 1, getWidth() - 2, getHeight() - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
g2.dispose();
|
g2.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void getColors()
|
private void getColors()
|
||||||
{
|
{
|
||||||
mColorChannelBackground = mSettingsManager.getColorSetting(
|
mColorChannelBackground = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_BACKGROUND ).getColor();
|
ColorSettingName.CHANNEL_STATE_BACKGROUND).getColor();
|
||||||
mColorChannelSelected = mSettingsManager.getColorSetting(
|
mColorChannelSelected = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL ).getColor();
|
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL).getColor();
|
||||||
mColorTopCall = mSettingsManager.getColorSetting(
|
mColorTopCall = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL).getColor();
|
||||||
mColorMiddleCall = mSettingsManager.getColorSetting(
|
mColorMiddleCall = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL).getColor();
|
||||||
mColorTopControl = mSettingsManager.getColorSetting(
|
mColorTopControl = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL).getColor();
|
||||||
mColorMiddleControl = mSettingsManager.getColorSetting(
|
mColorMiddleControl = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL).getColor();
|
||||||
mColorTopData = mSettingsManager.getColorSetting(
|
mColorTopData = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA).getColor();
|
||||||
mColorMiddleData = mSettingsManager.getColorSetting(
|
mColorMiddleData = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA).getColor();
|
||||||
mColorTopFade = mSettingsManager.getColorSetting(
|
mColorTopFade = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE).getColor();
|
||||||
mColorMiddleFade = mSettingsManager.getColorSetting(
|
mColorMiddleFade = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE).getColor();
|
||||||
mColorTopIdle = mSettingsManager.getColorSetting(
|
mColorTopIdle = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE).getColor();
|
||||||
mColorMiddleIdle = mSettingsManager.getColorSetting(
|
mColorMiddleIdle = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE).getColor();
|
||||||
mColorTopNoTuner = mSettingsManager.getColorSetting(
|
mColorTopNoTuner = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER).getColor();
|
||||||
mColorMiddleNoTuner = mSettingsManager.getColorSetting(
|
mColorMiddleNoTuner = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER ).getColor();
|
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER).getColor();
|
||||||
|
|
||||||
mColorLabelDetails = mSettingsManager.getColorSetting(
|
mColorLabelDetails = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS ).getColor();
|
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS).getColor();
|
||||||
mColorLabelDecoder = mSettingsManager.getColorSetting(
|
mColorLabelDecoder = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER ).getColor();
|
ColorSettingName.CHANNEL_STATE_LABEL_DECODER).getColor();
|
||||||
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
|
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER ).getColor();
|
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GradientPaint getGradient( Color top, Color middle )
|
private GradientPaint getGradient(Color top, Color middle)
|
||||||
{
|
{
|
||||||
return new GradientPaint( 0f, -50.0f, top,
|
return new GradientPaint(0f, -50.0f, top,
|
||||||
0f, (float)getHeight() / 2.2f, middle, true );
|
0f, (float) getHeight() / 2.2f, middle, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
if( setting instanceof ColorSetting )
|
if(setting instanceof ColorSetting)
|
||||||
{
|
{
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
switch(colorSetting.getColorSettingName())
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE_BACKGROUND:
|
case CHANNEL_STATE_BACKGROUND:
|
||||||
mColorChannelBackground = colorSetting.getColor();
|
mColorChannelBackground = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_CALL:
|
case CHANNEL_STATE_GRADIENT_MIDDLE_CALL:
|
||||||
mColorMiddleCall = colorSetting.getColor();
|
mColorMiddleCall = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_CALL:
|
case CHANNEL_STATE_GRADIENT_TOP_CALL:
|
||||||
mColorTopCall = colorSetting.getColor();
|
mColorTopCall = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL:
|
case CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL:
|
||||||
mColorMiddleControl = colorSetting.getColor();
|
mColorMiddleControl = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_CONTROL:
|
case CHANNEL_STATE_GRADIENT_TOP_CONTROL:
|
||||||
mColorTopControl = colorSetting.getColor();
|
mColorTopControl = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_DATA:
|
case CHANNEL_STATE_GRADIENT_MIDDLE_DATA:
|
||||||
mColorMiddleData = colorSetting.getColor();
|
mColorMiddleData = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_DATA:
|
case CHANNEL_STATE_GRADIENT_TOP_DATA:
|
||||||
mColorTopData = colorSetting.getColor();
|
mColorTopData = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_FADE:
|
case CHANNEL_STATE_GRADIENT_MIDDLE_FADE:
|
||||||
mColorMiddleFade = colorSetting.getColor();
|
mColorMiddleFade = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_FADE:
|
case CHANNEL_STATE_GRADIENT_TOP_FADE:
|
||||||
mColorTopFade = colorSetting.getColor();
|
mColorTopFade = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_IDLE:
|
case CHANNEL_STATE_GRADIENT_MIDDLE_IDLE:
|
||||||
mColorMiddleIdle = colorSetting.getColor();
|
mColorMiddleIdle = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_IDLE:
|
case CHANNEL_STATE_GRADIENT_TOP_IDLE:
|
||||||
mColorTopIdle = colorSetting.getColor();
|
mColorTopIdle = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER:
|
case CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER:
|
||||||
mColorMiddleNoTuner = colorSetting.getColor();
|
mColorMiddleNoTuner = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_GRADIENT_TOP_NO_TUNER:
|
case CHANNEL_STATE_GRADIENT_TOP_NO_TUNER:
|
||||||
mColorTopNoTuner = colorSetting.getColor();
|
mColorTopNoTuner = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_LABEL_AUX_DECODER:
|
case CHANNEL_STATE_LABEL_AUX_DECODER:
|
||||||
mColorLabelAuxDecoder = colorSetting.getColor();
|
mColorLabelAuxDecoder = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
mColorLabelDecoder = colorSetting.getColor();
|
mColorLabelDecoder = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_LABEL_DETAILS:
|
case CHANNEL_STATE_LABEL_DETAILS:
|
||||||
mColorLabelDetails = colorSetting.getColor();
|
mColorLabelDetails = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_SELECTED_CHANNEL:
|
case CHANNEL_STATE_SELECTED_CHANNEL:
|
||||||
mColorChannelSelected = colorSetting.getColor();
|
mColorChannelSelected = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingDeleted( Setting setting ) {}
|
public void settingDeleted(Setting setting)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public JMenu getContextMenu()
|
public JMenu getContextMenu()
|
||||||
{
|
{
|
||||||
return ChannelUtils.getContextMenu( mChannelModel, mChannelProcessingManager,
|
return ChannelUtils.getContextMenu(mChannelModel, mChannelProcessingManager,
|
||||||
mChannel, ChannelPanel.this );
|
mChannel, ChannelPanel.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelChanged( ChannelEvent event )
|
public void channelChanged(ChannelEvent event)
|
||||||
{
|
{
|
||||||
if( event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
|
if(event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
|
||||||
event.getChannel() == mChannel )
|
event.getChannel() == mChannel)
|
||||||
{
|
{
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,160 +1,162 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.state;
|
package module.decode.state;
|
||||||
|
|
||||||
import java.awt.Color;
|
import alias.Alias;
|
||||||
import java.awt.Font;
|
import icon.IconManager;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.ColorSetting.ColorSettingName;
|
import settings.ColorSetting.ColorSettingName;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingChangeListener;
|
import settings.SettingChangeListener;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import alias.Alias;
|
|
||||||
|
|
||||||
public abstract class DecoderPanel extends JPanel
|
import javax.swing.*;
|
||||||
implements Listener<ChangedAttribute>, SettingChangeListener
|
import java.awt.*;
|
||||||
|
|
||||||
|
public abstract class DecoderPanel extends JPanel
|
||||||
|
implements Listener<ChangedAttribute>, SettingChangeListener
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
protected Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
protected Font mFontDetails = new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
||||||
protected Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
protected Font mFontDecoder = new Font(Font.MONOSPACED, Font.PLAIN, 12);
|
||||||
protected Font mFontAuxDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 10 );
|
protected Font mFontAuxDecoder = new Font(Font.MONOSPACED, Font.PLAIN, 10);
|
||||||
public static final int ICON_SIZE = 12;
|
public static final int ICON_SIZE = 12;
|
||||||
|
|
||||||
protected Color mColorLabelDetails;
|
protected Color mColorLabelDetails;
|
||||||
protected Color mColorLabelDecoder;
|
protected Color mColorLabelDecoder;
|
||||||
protected Color mColorLabelAuxDecoder;
|
protected Color mColorLabelAuxDecoder;
|
||||||
|
|
||||||
protected SettingsManager mSettingsManager;
|
protected IconManager mIconManager;
|
||||||
|
protected SettingsManager mSettingsManager;
|
||||||
protected DecoderState mDecoderState;
|
protected DecoderState mDecoderState;
|
||||||
|
|
||||||
public DecoderPanel( SettingsManager settingsManager, DecoderState decoderState )
|
public DecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
|
||||||
{
|
{
|
||||||
mSettingsManager = settingsManager;
|
mIconManager = iconManager;
|
||||||
mSettingsManager.addListener( this );
|
mSettingsManager = settingsManager;
|
||||||
|
mSettingsManager.addListener(this);
|
||||||
mDecoderState = decoderState;
|
|
||||||
|
mDecoderState = decoderState;
|
||||||
mDecoderState.setChangedAttributeListener( this );
|
|
||||||
}
|
mDecoderState.setChangedAttributeListener(this);
|
||||||
|
}
|
||||||
public void dispose()
|
|
||||||
{
|
public void dispose()
|
||||||
mSettingsManager.removeListener( this );
|
{
|
||||||
mSettingsManager = null;
|
mSettingsManager.removeListener(this);
|
||||||
|
mSettingsManager = null;
|
||||||
mDecoderState.removeChangedAttributeListener();
|
|
||||||
mDecoderState = null;
|
mDecoderState.removeChangedAttributeListener();
|
||||||
}
|
mDecoderState = null;
|
||||||
|
}
|
||||||
public DecoderState getDecoderState()
|
|
||||||
{
|
public DecoderState getDecoderState()
|
||||||
return mDecoderState;
|
{
|
||||||
}
|
return mDecoderState;
|
||||||
|
}
|
||||||
protected void init()
|
|
||||||
{
|
protected void init()
|
||||||
getColors();
|
{
|
||||||
|
getColors();
|
||||||
setOpaque( false ); //Use the parent panel's background color
|
|
||||||
}
|
setOpaque(false); //Use the parent panel's background color
|
||||||
|
}
|
||||||
|
|
||||||
private void getColors()
|
private void getColors()
|
||||||
{
|
{
|
||||||
mColorLabelDetails = mSettingsManager.getColorSetting(
|
mColorLabelDetails = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS ).getColor();
|
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS).getColor();
|
||||||
mColorLabelDecoder = mSettingsManager.getColorSetting(
|
mColorLabelDecoder = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER ).getColor();
|
ColorSettingName.CHANNEL_STATE_LABEL_DECODER).getColor();
|
||||||
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
|
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER ).getColor();
|
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingChanged( Setting setting )
|
public void settingChanged(Setting setting)
|
||||||
{
|
{
|
||||||
if( setting instanceof ColorSetting )
|
if(setting instanceof ColorSetting)
|
||||||
{
|
{
|
||||||
ColorSetting colorSetting = (ColorSetting)setting;
|
ColorSetting colorSetting = (ColorSetting) setting;
|
||||||
|
|
||||||
switch( colorSetting.getColorSettingName() )
|
switch(colorSetting.getColorSettingName())
|
||||||
{
|
{
|
||||||
case CHANNEL_STATE_LABEL_AUX_DECODER:
|
case CHANNEL_STATE_LABEL_AUX_DECODER:
|
||||||
mColorLabelAuxDecoder = colorSetting.getColor();
|
mColorLabelAuxDecoder = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_LABEL_DECODER:
|
case CHANNEL_STATE_LABEL_DECODER:
|
||||||
mColorLabelDecoder = colorSetting.getColor();
|
mColorLabelDecoder = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
case CHANNEL_STATE_LABEL_DETAILS:
|
case CHANNEL_STATE_LABEL_DETAILS:
|
||||||
mColorLabelDetails = colorSetting.getColor();
|
mColorLabelDetails = colorSetting.getColor();
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingDeleted( Setting setting ) {}
|
public void settingDeleted(Setting setting)
|
||||||
|
{
|
||||||
protected void setAliasLabel( final JLabel label, final Alias alias )
|
}
|
||||||
{
|
|
||||||
setAliasLabel( label, alias, true );
|
protected void setAliasLabel(final JLabel label, final Alias alias)
|
||||||
}
|
{
|
||||||
|
setAliasLabel(label, alias, true);
|
||||||
protected void setAliasLabel( final JLabel label, final Alias alias, boolean includeIcon )
|
}
|
||||||
{
|
|
||||||
if( alias != null )
|
protected void setAliasLabel(final JLabel label, final Alias alias, boolean includeIcon)
|
||||||
{
|
{
|
||||||
label.setText( alias.getName() );
|
if(alias != null)
|
||||||
|
{
|
||||||
|
label.setText(alias.getName());
|
||||||
|
|
||||||
|
if(includeIcon)
|
||||||
|
{
|
||||||
|
String iconName = alias.getIconName();
|
||||||
|
|
||||||
|
if(iconName != null)
|
||||||
|
{
|
||||||
|
label.setIcon(mIconManager.getIcon(iconName, IconManager.DEFAULT_ICON_SIZE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label.setIcon(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label.setIcon(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label.setText("");
|
||||||
|
label.setIcon(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( includeIcon )
|
|
||||||
{
|
|
||||||
String iconName = alias.getIconName();
|
|
||||||
|
|
||||||
if( iconName != null )
|
|
||||||
{
|
|
||||||
label.setIcon( mSettingsManager
|
|
||||||
.getImageIcon( iconName, SettingsManager.DEFAULT_ICON_SIZE ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setIcon( null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setIcon( null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setText( "" );
|
|
||||||
label.setIcon( null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,25 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package module.decode.tait;
|
package module.decode.tait;
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
|
import icon.IconManager;
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@@ -30,151 +28,153 @@ import settings.ColorSetting.ColorSettingName;
|
|||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
public class Tait1200DecoderPanel extends DecoderPanel
|
public class Tait1200DecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String PROTOCOL = "TAIT-1200";
|
private static final String PROTOCOL = "TAIT-1200";
|
||||||
|
|
||||||
private JLabel mFromLabel = new JLabel( " " );
|
private JLabel mFromLabel = new JLabel(" ");
|
||||||
private JLabel mFrom = new JLabel();
|
private JLabel mFrom = new JLabel();
|
||||||
private JLabel mFromAlias = new JLabel();
|
private JLabel mFromAlias = new JLabel();
|
||||||
|
|
||||||
private JLabel mToLabel = new JLabel();
|
private JLabel mToLabel = new JLabel();
|
||||||
private JLabel mTo = new JLabel( " " );
|
private JLabel mTo = new JLabel(" ");
|
||||||
private JLabel mToAlias = new JLabel();
|
private JLabel mToAlias = new JLabel();
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( PROTOCOL );
|
private JLabel mProtocol = new JLabel(PROTOCOL);
|
||||||
private JLabel mMessage = new JLabel();
|
private JLabel mMessage = new JLabel();
|
||||||
private JLabel mMessageType = new JLabel();
|
private JLabel mMessageType = new JLabel();
|
||||||
|
|
||||||
public Tait1200DecoderPanel( SettingsManager settingsManager,
|
|
||||||
Tait1200DecoderState decoderState )
|
|
||||||
{
|
|
||||||
super( settingsManager, decoderState );
|
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Tait1200DecoderState getDecoderState()
|
|
||||||
{
|
|
||||||
return (Tait1200DecoderState)super.getDecoderState();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void init()
|
|
||||||
{
|
|
||||||
/* Calling super init will get and broadcast color settings to properly
|
|
||||||
* setup the jlabel colors */
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
|
||||||
|
|
||||||
add( mFromLabel );
|
public Tait1200DecoderPanel(IconManager iconManager, SettingsManager settingsManager, Tait1200DecoderState decoderState)
|
||||||
add( mFrom );
|
|
||||||
add( mFromAlias, "wrap" );
|
|
||||||
|
|
||||||
add( mToLabel );
|
|
||||||
add( mTo );
|
|
||||||
add( mToAlias, "wrap" );
|
|
||||||
|
|
||||||
add( mProtocol );
|
|
||||||
add( mMessageType );
|
|
||||||
add( mMessage, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater( new Runnable()
|
super(iconManager, settingsManager, decoderState);
|
||||||
{
|
|
||||||
@Override
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose()
|
||||||
|
{
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tait1200DecoderState getDecoderState()
|
||||||
|
{
|
||||||
|
return (Tait1200DecoderState) super.getDecoderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init()
|
||||||
|
{
|
||||||
|
/* Calling super init will get and broadcast color settings to properly
|
||||||
|
* setup the jlabel colors */
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||||
|
|
||||||
|
add(mFromLabel);
|
||||||
|
add(mFrom);
|
||||||
|
add(mFromAlias, "wrap");
|
||||||
|
|
||||||
|
add(mToLabel);
|
||||||
|
add(mTo);
|
||||||
|
add(mToAlias, "wrap");
|
||||||
|
|
||||||
|
add(mProtocol);
|
||||||
|
add(mMessageType);
|
||||||
|
add(mMessage, "wrap");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receive(final ChangedAttribute changedAttribute)
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
switch( changedAttribute )
|
switch(changedAttribute)
|
||||||
{
|
{
|
||||||
case FROM_TALKGROUP:
|
case FROM_TALKGROUP:
|
||||||
String from = getDecoderState().getFromID();
|
String from = getDecoderState().getFromID();
|
||||||
|
|
||||||
if( from != null )
|
|
||||||
{
|
|
||||||
mFromLabel.setText( "FM:" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFromLabel.setText( " " );
|
|
||||||
}
|
|
||||||
mFrom.setText( from );
|
|
||||||
break;
|
|
||||||
case FROM_TALKGROUP_ALIAS:
|
|
||||||
Alias fromAlias = getDecoderState().getFromIDAlias();
|
|
||||||
|
|
||||||
if( fromAlias != null )
|
|
||||||
{
|
|
||||||
mFromAlias.setText( fromAlias.getName() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP:
|
|
||||||
String to = getDecoderState().getToID();
|
|
||||||
|
|
||||||
if( to != null )
|
|
||||||
{
|
|
||||||
mToLabel.setText( "TO:" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mToLabel.setText( " " );
|
|
||||||
}
|
|
||||||
mTo.setText( to );
|
|
||||||
break;
|
|
||||||
case TO_TALKGROUP_ALIAS:
|
|
||||||
Alias toAlias = getDecoderState().getToIDAlias();
|
|
||||||
|
|
||||||
if( toAlias != null )
|
|
||||||
{
|
|
||||||
mToAlias.setText( toAlias.getName() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MESSAGE:
|
|
||||||
mMessage.setText( getDecoderState().getMessage() );
|
|
||||||
break;
|
|
||||||
case MESSAGE_TYPE:
|
|
||||||
mMessageType.setText( getDecoderState().getMessageType() );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
repaint();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void settingChanged( Setting setting )
|
|
||||||
{
|
|
||||||
super.settingChanged( setting );
|
|
||||||
|
|
||||||
if( setting instanceof ColorSetting )
|
|
||||||
{
|
|
||||||
ColorSetting color = (ColorSetting)setting;
|
|
||||||
|
|
||||||
if( color.getColorSettingName() ==
|
if(from != null)
|
||||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER )
|
{
|
||||||
{
|
mFromLabel.setText("FM:");
|
||||||
mFromLabel.setForeground( color.getColor() );
|
}
|
||||||
mFrom.setForeground( color.getColor() );
|
else
|
||||||
mFromAlias.setForeground( color.getColor() );
|
{
|
||||||
mToLabel.setForeground( color.getColor() );
|
mFromLabel.setText(" ");
|
||||||
mTo.setForeground( color.getColor() );
|
}
|
||||||
mToAlias.setForeground( color.getColor() );
|
mFrom.setText(from);
|
||||||
mProtocol.setForeground( color.getColor() );
|
break;
|
||||||
mMessageType.setForeground( color.getColor() );
|
case FROM_TALKGROUP_ALIAS:
|
||||||
mMessage.setForeground( color.getColor() );
|
Alias fromAlias = getDecoderState().getFromIDAlias();
|
||||||
}
|
|
||||||
}
|
if(fromAlias != null)
|
||||||
|
{
|
||||||
|
mFromAlias.setText(fromAlias.getName());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TO_TALKGROUP:
|
||||||
|
String to = getDecoderState().getToID();
|
||||||
|
|
||||||
|
if(to != null)
|
||||||
|
{
|
||||||
|
mToLabel.setText("TO:");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mToLabel.setText(" ");
|
||||||
|
}
|
||||||
|
mTo.setText(to);
|
||||||
|
break;
|
||||||
|
case TO_TALKGROUP_ALIAS:
|
||||||
|
Alias toAlias = getDecoderState().getToIDAlias();
|
||||||
|
|
||||||
|
if(toAlias != null)
|
||||||
|
{
|
||||||
|
mToAlias.setText(toAlias.getName());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MESSAGE:
|
||||||
|
mMessage.setText(getDecoderState().getMessage());
|
||||||
|
break;
|
||||||
|
case MESSAGE_TYPE:
|
||||||
|
mMessageType.setText(getDecoderState().getMessageType());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void settingChanged(Setting setting)
|
||||||
|
{
|
||||||
|
super.settingChanged(setting);
|
||||||
|
|
||||||
|
if(setting instanceof ColorSetting)
|
||||||
|
{
|
||||||
|
ColorSetting color = (ColorSetting) setting;
|
||||||
|
|
||||||
|
if(color.getColorSettingName() ==
|
||||||
|
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
||||||
|
{
|
||||||
|
mFromLabel.setForeground(color.getColor());
|
||||||
|
mFrom.setForeground(color.getColor());
|
||||||
|
mFromAlias.setForeground(color.getColor());
|
||||||
|
mToLabel.setForeground(color.getColor());
|
||||||
|
mTo.setForeground(color.getColor());
|
||||||
|
mToAlias.setForeground(color.getColor());
|
||||||
|
mProtocol.setForeground(color.getColor());
|
||||||
|
mMessageType.setForeground(color.getColor());
|
||||||
|
mMessage.setForeground(color.getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user