mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 00:57:31 -05:00
Updates alias list to provide a list of aliases for an identifier so that (#474)
we can account for multi-alias identifiers like patch groups and ensure that patch group alias intentions are carried throughout the system for recording, streaming, etc. Updates all consumers of alias list data to ensure it can operate with a list of aliases versus an assumed single alias. Refactors APCO25 unit/user status identifiers from a base status class so that alias list can support status identifiers.
This commit is contained in:
@@ -39,6 +39,9 @@ import io.github.dsheirer.sample.Listener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Channel metadata containing details about the channel configuration, decoder state and current
|
||||
* set of decoded user identifiers (ie TO and FROM).
|
||||
@@ -55,9 +58,9 @@ public class ChannelMetadata implements Listener<IdentifierUpdateNotification>,
|
||||
private DecoderLogicalChannelNameIdentifier mDecoderLogicalChannelNameIdentifier;
|
||||
private DecoderTypeConfigurationIdentifier mDecoderTypeConfigurationIdentifier;
|
||||
private Identifier mFromIdentifier;
|
||||
private Alias mFromIdentifierAlias;
|
||||
private List<Alias> mFromIdentifierAliases;
|
||||
private Identifier mToIdentifier;
|
||||
private Alias mToIdentifierAlias;
|
||||
private List<Alias> mToIdentifierAliases;
|
||||
|
||||
private IChannelMetadataUpdateListener mIChannelMetadataUpdateListener;
|
||||
private AliasModel mAliasModel;
|
||||
@@ -181,9 +184,9 @@ public class ChannelMetadata implements Listener<IdentifierUpdateNotification>,
|
||||
/**
|
||||
* Optional alias associated with the FROM identifier
|
||||
*/
|
||||
public Alias getFromIdentifierAlias()
|
||||
public List<Alias> getFromIdentifierAliases()
|
||||
{
|
||||
return mFromIdentifierAlias;
|
||||
return mFromIdentifierAliases;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,9 +205,9 @@ public class ChannelMetadata implements Listener<IdentifierUpdateNotification>,
|
||||
/**
|
||||
* Optional alias associated with the TO identifier
|
||||
*/
|
||||
public Alias getToIdentifierAlias()
|
||||
public List<Alias> getToIdentifierAliases()
|
||||
{
|
||||
return mToIdentifierAlias;
|
||||
return mToIdentifierAliases;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -255,11 +258,11 @@ public class ChannelMetadata implements Listener<IdentifierUpdateNotification>,
|
||||
{
|
||||
if(mToIdentifier != null)
|
||||
{
|
||||
mToIdentifierAlias = mAliasList.getAlias(mToIdentifier);
|
||||
mToIdentifierAliases = mAliasList.getAliases(mToIdentifier);
|
||||
}
|
||||
if(mFromIdentifier != null)
|
||||
{
|
||||
mFromIdentifierAlias = mAliasList.getAlias(mFromIdentifier);
|
||||
mFromIdentifierAliases = mAliasList.getAliases(mFromIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,11 +309,11 @@ public class ChannelMetadata implements Listener<IdentifierUpdateNotification>,
|
||||
|
||||
if(mAliasList != null && mFromIdentifier != null)
|
||||
{
|
||||
mFromIdentifierAlias = mAliasList.getAlias(mFromIdentifier);
|
||||
mFromIdentifierAliases = mAliasList.getAliases(mFromIdentifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
mFromIdentifierAlias = null;
|
||||
mFromIdentifierAliases = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
broadcastUpdate(ChannelMetadataField.USER_FROM);
|
||||
@@ -321,11 +324,11 @@ public class ChannelMetadata implements Listener<IdentifierUpdateNotification>,
|
||||
|
||||
if(mAliasList != null && mToIdentifier != null)
|
||||
{
|
||||
mToIdentifierAlias = mAliasList.getAlias(mToIdentifier);
|
||||
mToIdentifierAliases = mAliasList.getAliases(mToIdentifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
mToIdentifierAlias = null;
|
||||
mToIdentifierAliases = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
broadcastUpdate(ChannelMetadataField.USER_TO);
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
/*******************************************************************************
|
||||
* sdr-trunk
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 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 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.
|
||||
* 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/>
|
||||
*
|
||||
******************************************************************************/
|
||||
* 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 io.github.dsheirer.channel.metadata;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
@@ -186,9 +190,9 @@ public class ChannelMetadataModel extends AbstractTableModel implements IChannel
|
||||
case COLUMN_USER_FROM:
|
||||
return channelMetadata;
|
||||
case COLUMN_USER_FROM_ALIAS:
|
||||
return channelMetadata.getFromIdentifierAlias();
|
||||
return channelMetadata.getFromIdentifierAliases();
|
||||
case COLUMN_USER_TO_ALIAS:
|
||||
return channelMetadata.getToIdentifierAlias();
|
||||
return channelMetadata.getToIdentifierAliases();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
package io.github.dsheirer.channel.metadata;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import io.github.dsheirer.alias.Alias;
|
||||
import io.github.dsheirer.channel.state.State;
|
||||
import io.github.dsheirer.controller.channel.Channel;
|
||||
@@ -52,6 +53,7 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChannelMetadataPanel extends JPanel implements ListSelectionListener
|
||||
@@ -225,14 +227,22 @@ public class ChannelMetadataPanel extends JPanel implements ListSelectionListene
|
||||
{
|
||||
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
|
||||
if(value instanceof Alias)
|
||||
if(value instanceof List<?>)
|
||||
{
|
||||
Alias alias = (Alias)value;
|
||||
|
||||
label.setText(alias.getName());
|
||||
label.setIcon(mIconManager.getIcon(alias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
|
||||
label.setForeground(alias.getDisplayColor());
|
||||
List<Alias> aliases = (List<Alias>)value;
|
||||
|
||||
if(!aliases.isEmpty())
|
||||
{
|
||||
label.setText(Joiner.on(", ").skipNulls().join(aliases));
|
||||
label.setIcon(mIconManager.getIcon(aliases.get(0).getIconName(), IconManager.DEFAULT_ICON_SIZE));
|
||||
label.setForeground(aliases.get(0).getDisplayColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
label.setText(null);
|
||||
label.setIcon(null);
|
||||
label.setForeground(table.getForeground());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user