mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
WIP #34: added channel map manager and new editor window. Removed a
number of unused classes. Removed playlist manager from a number of classes and replaced with the alias, channel and channel map models. Updated playlist manager to no longer retain a playlist except for when loading to models or when storing from models. Extracted version 1 to version 2 playlist conversion and changed playlist manager to keep the original version 1 playlist and create a new version 2 (playlist_v2.xml) file. On startup, try to load a v2, and if not, look for a v1 to convert. Otherwise, don't create a playlist and one will be created once the user adds items to the models.
This commit is contained in:
@@ -1,103 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import settings.SettingsManager;
|
||||
import controller.ConfigurableNode;
|
||||
|
||||
public class AliasDirectoryNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PlaylistManager mPlaylistManager;
|
||||
|
||||
private SettingsManager mSettingsManager;
|
||||
|
||||
public AliasDirectoryNode( PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
AliasDirectory directory )
|
||||
{
|
||||
super( playlistManager, directory );
|
||||
|
||||
mPlaylistManager = playlistManager;
|
||||
|
||||
mSettingsManager = settingsManager;
|
||||
}
|
||||
|
||||
public AliasDirectory getAliasDirectory()
|
||||
{
|
||||
return (AliasDirectory)getUserObject();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
for( AliasList list: getAliasDirectory().getAliasList() )
|
||||
{
|
||||
AliasListNode node = new AliasListNode( mPlaylistManager, mSettingsManager, list );
|
||||
|
||||
getModel().addNode( node, AliasDirectoryNode.this, getChildCount() );
|
||||
|
||||
node.init();
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Alias Lists [" + this.getChildCount() + "]";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addItem = new JMenuItem( "Add Alias List" );
|
||||
addItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
AliasList list = new AliasList();
|
||||
|
||||
getAliasDirectory().addAliasList( list );
|
||||
|
||||
AliasListNode node = new AliasListNode( mPlaylistManager, mSettingsManager, list );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasDirectoryNode.this,
|
||||
AliasDirectoryNode.this.getChildCount() );
|
||||
|
||||
sort();
|
||||
|
||||
getModel().showNode( node );
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
@@ -19,21 +19,17 @@ package alias;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import module.decode.lj1200.LJ1200Message.Function;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.action.AliasAction;
|
||||
import alias.action.beep.BeepAction;
|
||||
import alias.action.clip.ClipAction;
|
||||
import alias.action.script.ScriptAction;
|
||||
import sample.Listener;
|
||||
import alias.id.AliasID;
|
||||
import alias.id.esn.Esn;
|
||||
import alias.id.fleetsync.FleetsyncID;
|
||||
@@ -41,48 +37,17 @@ import alias.id.lojack.LoJackFunctionAndID;
|
||||
import alias.id.mdc.MDC1200ID;
|
||||
import alias.id.mobileID.Min;
|
||||
import alias.id.mpt1327.MPT1327ID;
|
||||
import alias.id.nonrecordable.NonRecordable;
|
||||
import alias.id.priority.Priority;
|
||||
import alias.id.siteID.SiteID;
|
||||
import alias.id.status.StatusID;
|
||||
import alias.id.talkgroup.TalkgroupID;
|
||||
import alias.id.uniqueID.UniqueID;
|
||||
import audio.metadata.MetadataType;
|
||||
|
||||
@XmlSeeAlso( { Alias.class,
|
||||
|
||||
/* Alias ID's */
|
||||
AliasID.class,
|
||||
FleetsyncID.class,
|
||||
Esn.class,
|
||||
Group.class,
|
||||
LoJackFunctionAndID.class,
|
||||
MDC1200ID.class,
|
||||
Min.class,
|
||||
MPT1327ID.class,
|
||||
UniqueID.class,
|
||||
SiteID.class,
|
||||
StatusID.class,
|
||||
TalkgroupID.class,
|
||||
|
||||
/* Alias Attributes */
|
||||
NonRecordable.class,
|
||||
Priority.class,
|
||||
|
||||
/* Alias Actions */
|
||||
AliasAction.class,
|
||||
BeepAction.class,
|
||||
ClipAction.class,
|
||||
ScriptAction.class } )
|
||||
|
||||
@XmlRootElement( name = "alias_list" )
|
||||
public class AliasList implements Comparable<AliasList>
|
||||
public class AliasList implements Listener<AliasEvent>
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( AliasList.class );
|
||||
|
||||
private String mName;
|
||||
private ArrayList<Group> mGroups = new ArrayList<Group>();
|
||||
|
||||
private List<Alias> mAliases = new ArrayList<>();
|
||||
private Map<String,Alias> mESN = new HashMap<>();
|
||||
private Map<String,Alias> mFleetsync = new HashMap<>();
|
||||
private Map<LoJackFunctionAndID,Alias> mLoJack = new HashMap<>();
|
||||
@@ -102,167 +67,326 @@ public class AliasList implements Comparable<AliasList>
|
||||
private boolean mSiteWildcard = false;
|
||||
private boolean mTalkgroupWildcard = false;
|
||||
|
||||
public AliasList()
|
||||
{
|
||||
this( null );
|
||||
}
|
||||
private String mName;
|
||||
|
||||
/**
|
||||
* List of aliases where all aliases share the same list name. Contains
|
||||
* several methods for alias lookup from identifier values, like talkgroups.
|
||||
*
|
||||
* Responds to alias change events to keep the internal alias list updated.
|
||||
*/
|
||||
public AliasList( String name )
|
||||
{
|
||||
mName = name;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load/Reload all lookup hashmaps
|
||||
* Adds the alias to this list
|
||||
*/
|
||||
public void update()
|
||||
public void addAlias( Alias alias )
|
||||
{
|
||||
//Clear hashmaps
|
||||
mESN.clear();
|
||||
mFleetsync.clear();
|
||||
mLoJack.clear();
|
||||
mMDC1200.clear();
|
||||
mMobileID.clear();
|
||||
mMPT1327.clear();
|
||||
mSiteID.clear();
|
||||
mStatus.clear();
|
||||
mTalkgroup.clear();
|
||||
mUniqueID.clear();
|
||||
|
||||
for( Group group: mGroups )
|
||||
if( alias != null )
|
||||
{
|
||||
for( Alias alias: group.getAlias() )
|
||||
mAliases.add( alias );
|
||||
|
||||
for( AliasID aliasID: alias.getId() )
|
||||
{
|
||||
for( AliasID id: alias.getId() )
|
||||
addAliasID( aliasID, alias );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the alias and alias identifier to the internal type mapping.
|
||||
*/
|
||||
private void addAliasID( AliasID id, Alias alias )
|
||||
{
|
||||
switch( id.getType() )
|
||||
{
|
||||
case ESN:
|
||||
Esn esn = (Esn)id;
|
||||
if( esn.getEsn().contains( "*" ) )
|
||||
{
|
||||
switch( id.getType() )
|
||||
mESNWildcard = true;
|
||||
|
||||
mESN.put( fixWildcard( esn.getEsn() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mESN.put( esn.getEsn(), alias );
|
||||
}
|
||||
break;
|
||||
case Fleetsync:
|
||||
FleetsyncID fs = (FleetsyncID)id;
|
||||
|
||||
if( fs.getIdent().contains( "*" ) )
|
||||
{
|
||||
mFleetsyncWildcard = true;
|
||||
|
||||
mFleetsync.put( fixWildcard( fs.getIdent() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mFleetsync.put( fs.getIdent(), alias );
|
||||
}
|
||||
break;
|
||||
case LoJack:
|
||||
mLoJack.put( (LoJackFunctionAndID)id, alias );
|
||||
break;
|
||||
case MDC1200:
|
||||
MDC1200ID mdc = (MDC1200ID)id;
|
||||
|
||||
if( mdc.getIdent().contains( "*" ) )
|
||||
{
|
||||
mMDC1200Wildcard = true;
|
||||
|
||||
//Replace (*) wildcard with regex wildcard (.)
|
||||
mMDC1200.put( fixWildcard( mdc.getIdent() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMDC1200.put( mdc.getIdent(), alias );
|
||||
}
|
||||
break;
|
||||
case MPT1327:
|
||||
MPT1327ID mpt = (MPT1327ID)id;
|
||||
|
||||
String ident = mpt.getIdent();
|
||||
|
||||
if( ident != null )
|
||||
{
|
||||
if( ident.contains( "*" ) )
|
||||
{
|
||||
case ESN:
|
||||
Esn esn = (Esn)id;
|
||||
if( esn.getEsn().contains( "*" ) )
|
||||
{
|
||||
mESNWildcard = true;
|
||||
|
||||
mESN.put( fixWildcard( esn.getEsn() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mESN.put( esn.getEsn(), alias );
|
||||
}
|
||||
break;
|
||||
case Fleetsync:
|
||||
FleetsyncID fs = (FleetsyncID)id;
|
||||
|
||||
if( fs.getIdent().contains( "*" ) )
|
||||
{
|
||||
mFleetsyncWildcard = true;
|
||||
|
||||
mFleetsync.put( fixWildcard( fs.getIdent() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mFleetsync.put( fs.getIdent(), alias );
|
||||
}
|
||||
break;
|
||||
case LoJack:
|
||||
mLoJack.put( (LoJackFunctionAndID)id, alias );
|
||||
break;
|
||||
case MDC1200:
|
||||
MDC1200ID mdc = (MDC1200ID)id;
|
||||
|
||||
if( mdc.getIdent().contains( "*" ) )
|
||||
{
|
||||
mMDC1200Wildcard = true;
|
||||
|
||||
//Replace (*) wildcard with regex wildcard (.)
|
||||
mMDC1200.put( fixWildcard( mdc.getIdent() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMDC1200.put( mdc.getIdent(), alias );
|
||||
}
|
||||
break;
|
||||
case MPT1327:
|
||||
MPT1327ID mpt = (MPT1327ID)id;
|
||||
|
||||
String ident = mpt.getIdent();
|
||||
|
||||
if( ident != null )
|
||||
{
|
||||
if( ident.contains( "*" ) )
|
||||
{
|
||||
mMPT1327Wildcard = true;
|
||||
|
||||
//Replace (*) wildcard with regex wildcard (.)
|
||||
mMPT1327.put( fixWildcard( ident ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMPT1327.put( ident, alias );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MIN:
|
||||
Min min = (Min)id;
|
||||
|
||||
if( min.getMin().contains( "*" ) )
|
||||
{
|
||||
mMobileIDWildcard = true;
|
||||
mMobileID.put( fixWildcard( min.getMin() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMobileID.put( min.getMin(), alias );
|
||||
}
|
||||
break;
|
||||
case LTRNetUID:
|
||||
UniqueID uid = (UniqueID)id;
|
||||
|
||||
mUniqueID.put( uid.getUid(), alias );
|
||||
break;
|
||||
case Site:
|
||||
SiteID siteID = (SiteID)id;
|
||||
|
||||
if( siteID.getSite().contains( "*" ) )
|
||||
{
|
||||
mSiteWildcard = true;
|
||||
mSiteID.put( fixWildcard( siteID.getSite() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mSiteID.put( siteID.getSite(), alias );
|
||||
}
|
||||
|
||||
break;
|
||||
case Status:
|
||||
mStatus.put( ((StatusID)id).getStatus(), alias );
|
||||
break;
|
||||
case Talkgroup:
|
||||
TalkgroupID tgid = (TalkgroupID)id;
|
||||
|
||||
if( tgid.getTalkgroup().contains( "*" ) )
|
||||
{
|
||||
mTalkgroupWildcard = true;
|
||||
|
||||
//Replace (*) wildcard with regex wildcard (.)
|
||||
mTalkgroup.put( fixWildcard( tgid.getTalkgroup() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mTalkgroup.put( tgid.getTalkgroup(), alias );
|
||||
}
|
||||
break;
|
||||
case NonRecordable:
|
||||
case Priority:
|
||||
//We don't maintain lookups for these items
|
||||
break;
|
||||
default:
|
||||
mLog.warn( "Unrecognized Alias ID Type:" + id.getType().name() );
|
||||
break;
|
||||
mMPT1327Wildcard = true;
|
||||
|
||||
//Replace (*) wildcard with regex wildcard (.)
|
||||
mMPT1327.put( fixWildcard( ident ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMPT1327.put( ident, alias );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MIN:
|
||||
Min min = (Min)id;
|
||||
|
||||
if( min.getMin().contains( "*" ) )
|
||||
{
|
||||
mMobileIDWildcard = true;
|
||||
mMobileID.put( fixWildcard( min.getMin() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMobileID.put( min.getMin(), alias );
|
||||
}
|
||||
break;
|
||||
case LTRNetUID:
|
||||
UniqueID uid = (UniqueID)id;
|
||||
|
||||
mUniqueID.put( uid.getUid(), alias );
|
||||
break;
|
||||
case Site:
|
||||
SiteID siteID = (SiteID)id;
|
||||
|
||||
if( siteID.getSite().contains( "*" ) )
|
||||
{
|
||||
mSiteWildcard = true;
|
||||
mSiteID.put( fixWildcard( siteID.getSite() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mSiteID.put( siteID.getSite(), alias );
|
||||
}
|
||||
|
||||
break;
|
||||
case Status:
|
||||
mStatus.put( ((StatusID)id).getStatus(), alias );
|
||||
break;
|
||||
case Talkgroup:
|
||||
TalkgroupID tgid = (TalkgroupID)id;
|
||||
|
||||
if( tgid.getTalkgroup().contains( "*" ) )
|
||||
{
|
||||
mTalkgroupWildcard = true;
|
||||
|
||||
//Replace (*) wildcard with regex wildcard (.)
|
||||
mTalkgroup.put( fixWildcard( tgid.getTalkgroup() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mTalkgroup.put( tgid.getTalkgroup(), alias );
|
||||
}
|
||||
break;
|
||||
case NonRecordable:
|
||||
case Priority:
|
||||
//We don't maintain lookups for these items
|
||||
break;
|
||||
default:
|
||||
mLog.warn( "Unrecognized Alias ID Type:" + id.getType().name() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the alias from this list
|
||||
*/
|
||||
public void removeAlias( Alias alias )
|
||||
{
|
||||
if( alias != null )
|
||||
{
|
||||
for( AliasID aliasID: alias.getId() )
|
||||
{
|
||||
removeAliasID( aliasID, alias );
|
||||
}
|
||||
|
||||
mAliases.remove( alias );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the alias and alias identifier from internal mappings.
|
||||
*/
|
||||
private void removeAliasID( AliasID id, Alias alias )
|
||||
{
|
||||
switch( id.getType() )
|
||||
{
|
||||
case ESN:
|
||||
Esn esn = (Esn)id;
|
||||
if( mESN.containsKey( esn.getEsn() ) )
|
||||
{
|
||||
Alias esnAlias = mESN.get( esn.getEsn() );
|
||||
|
||||
if( esnAlias != null && esnAlias == alias )
|
||||
{
|
||||
mESN.remove( esn.getEsn() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Fleetsync:
|
||||
FleetsyncID fs = (FleetsyncID)id;
|
||||
|
||||
if( mFleetsync.containsKey( fs.getIdent() ) )
|
||||
{
|
||||
Alias fsAlias = mFleetsync.get( fs.getIdent() );
|
||||
|
||||
if( fsAlias != null && fsAlias == alias )
|
||||
{
|
||||
mFleetsync.remove( fs.getIdent() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LoJack:
|
||||
LoJackFunctionAndID lj = (LoJackFunctionAndID)id;
|
||||
|
||||
if( mLoJack.containsKey( lj ) )
|
||||
{
|
||||
Alias ljAlias = mLoJack.get( lj );
|
||||
|
||||
if( ljAlias != null && ljAlias == alias )
|
||||
{
|
||||
mLoJack.remove( lj );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MDC1200:
|
||||
MDC1200ID mdc = (MDC1200ID)id;
|
||||
|
||||
if( mMDC1200.containsKey( mdc.getIdent() ) )
|
||||
{
|
||||
Alias mdcAlias = mMDC1200.get( mdc.getIdent() );
|
||||
|
||||
if( mdcAlias != null && mdcAlias == alias )
|
||||
{
|
||||
mMDC1200.remove( mdc.getIdent() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MPT1327:
|
||||
MPT1327ID mpt = (MPT1327ID)id;
|
||||
|
||||
if( mMPT1327.containsKey( mpt.getIdent() ) )
|
||||
{
|
||||
Alias mptAlias = mMDC1200.get( mpt.getIdent() );
|
||||
|
||||
if( mptAlias != null && mptAlias == alias )
|
||||
{
|
||||
mMPT1327.remove( mpt.getIdent() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MIN:
|
||||
Min min = (Min)id;
|
||||
|
||||
if( mMobileID.containsKey( min.getMin() ) )
|
||||
{
|
||||
Alias minAlias = mMobileID.get( min.getMin() );
|
||||
|
||||
if( minAlias != null && minAlias == alias )
|
||||
{
|
||||
mMobileID.remove( min.getMin() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LTRNetUID:
|
||||
UniqueID uid = (UniqueID)id;
|
||||
|
||||
if( mUniqueID.containsKey( uid.getUid() ) )
|
||||
{
|
||||
Alias uidAlias = mUniqueID.get( uid.getUid() );
|
||||
|
||||
if( uidAlias != null && uidAlias == alias )
|
||||
{
|
||||
mUniqueID.remove( uid.getUid() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Site:
|
||||
SiteID sid = (SiteID)id;
|
||||
|
||||
if( mSiteID.containsKey( sid.getSite() ) )
|
||||
{
|
||||
Alias sidAlias = mSiteID.get( sid.getSite() );
|
||||
|
||||
if( sidAlias != null && sidAlias == alias )
|
||||
{
|
||||
mSiteID.remove( sid.getSite() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Status:
|
||||
StatusID stat = (StatusID)id;
|
||||
|
||||
if( mStatus.containsKey( stat.getStatus() ) )
|
||||
{
|
||||
Alias statAlias = mStatus.get( stat.getStatus() );
|
||||
|
||||
if( statAlias != null && statAlias == alias )
|
||||
{
|
||||
mStatus.remove( stat.getStatus() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Talkgroup:
|
||||
TalkgroupID tg = (TalkgroupID)id;
|
||||
|
||||
if( mTalkgroup.containsKey( tg.getTalkgroup() ) )
|
||||
{
|
||||
Alias tgAlias = mTalkgroup.get( tg.getTalkgroup() );
|
||||
|
||||
if( tgAlias != null && tgAlias == alias )
|
||||
{
|
||||
mTalkgroup.remove( tg.getTalkgroup() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NonRecordable:
|
||||
case Priority:
|
||||
//We don't maintain lookups for these items
|
||||
break;
|
||||
default:
|
||||
mLog.warn( "Unrecognized Alias ID Type:" + id.getType().name() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +403,10 @@ public class AliasList implements Comparable<AliasList>
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lookup alias by site ID
|
||||
*/
|
||||
public Alias getSiteID( String siteID )
|
||||
{
|
||||
if( siteID != null )
|
||||
@@ -302,17 +429,26 @@ public class AliasList implements Comparable<AliasList>
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lookup alias by status ID
|
||||
*/
|
||||
public Alias getStatus( int status )
|
||||
{
|
||||
return mStatus.get( status );
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup alias by Unique ID (UID)
|
||||
*/
|
||||
public Alias getUniqueID( int uniqueID )
|
||||
{
|
||||
return mUniqueID.get( uniqueID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup alias by ESN
|
||||
*/
|
||||
public Alias getESNAlias( String esn )
|
||||
{
|
||||
if( esn != null )
|
||||
@@ -336,7 +472,9 @@ public class AliasList implements Comparable<AliasList>
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lookup alias by fleetsync ID
|
||||
*/
|
||||
public Alias getFleetsyncAlias( String ident )
|
||||
{
|
||||
if( ident != null )
|
||||
@@ -360,6 +498,9 @@ public class AliasList implements Comparable<AliasList>
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup alias by lojack function and ID
|
||||
*/
|
||||
public Alias getLoJackAlias( Function function, String id )
|
||||
{
|
||||
if( id != null )
|
||||
@@ -376,6 +517,9 @@ public class AliasList implements Comparable<AliasList>
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup alias by MDC1200 ID
|
||||
*/
|
||||
public Alias getMDC1200Alias( String ident )
|
||||
{
|
||||
if( ident != null )
|
||||
@@ -399,6 +543,9 @@ public class AliasList implements Comparable<AliasList>
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup alias by MPT1327 Ident
|
||||
*/
|
||||
public Alias getMPT1327Alias( String ident )
|
||||
{
|
||||
if( ident != null )
|
||||
@@ -422,22 +569,9 @@ public class AliasList implements Comparable<AliasList>
|
||||
return null;
|
||||
}
|
||||
|
||||
public Group getGroup( Alias alias )
|
||||
{
|
||||
if( alias != null )
|
||||
{
|
||||
for( Group group: mGroups )
|
||||
{
|
||||
if( group.contains( alias ) )
|
||||
{
|
||||
return group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup alias by Mobile ID Number (MIN)
|
||||
*/
|
||||
public Alias getMobileIDNumberAlias( String ident )
|
||||
{
|
||||
if( ident != null )
|
||||
@@ -461,6 +595,9 @@ public class AliasList implements Comparable<AliasList>
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup alias by talkgroup
|
||||
*/
|
||||
public Alias getTalkgroupAlias( String tgid )
|
||||
{
|
||||
if( tgid != null )
|
||||
@@ -483,49 +620,27 @@ public class AliasList implements Comparable<AliasList>
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Alias list name
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias list name
|
||||
*/
|
||||
@XmlAttribute
|
||||
public String getName()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
public void setName( String name )
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
|
||||
public ArrayList<Group> getGroup()
|
||||
{
|
||||
return mGroups;
|
||||
}
|
||||
|
||||
public void setGroup( ArrayList<Group> groups )
|
||||
{
|
||||
mGroups = groups;
|
||||
}
|
||||
|
||||
public void addGroup( Group group )
|
||||
{
|
||||
mGroups.add( group );
|
||||
}
|
||||
|
||||
public void removeGroup( Group group )
|
||||
{
|
||||
mGroups.remove( group );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( AliasList otherAliasList )
|
||||
{
|
||||
return getName().compareTo( otherAliasList.getName() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup an alias by metadata type and string value
|
||||
*/
|
||||
public Alias getAlias( String value, MetadataType type )
|
||||
{
|
||||
switch( type )
|
||||
@@ -577,5 +692,48 @@ public class AliasList implements Comparable<AliasList>
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Receive alias change event notifications and modify this list accordingly
|
||||
*/
|
||||
@Override
|
||||
public void receive( AliasEvent event )
|
||||
{
|
||||
Alias alias = event.getAlias();
|
||||
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case ADD:
|
||||
if( alias.getList() != null &&
|
||||
getName().equalsIgnoreCase( alias.getList() ) )
|
||||
{
|
||||
addAlias( alias );
|
||||
}
|
||||
break;
|
||||
case CHANGE:
|
||||
if( alias.getList() != null &&
|
||||
getName().equalsIgnoreCase( alias.getList() ) )
|
||||
{
|
||||
if( !mAliases.contains( alias ) )
|
||||
{
|
||||
//Alias was moved to this list - add it
|
||||
addAlias( alias );
|
||||
}
|
||||
}
|
||||
else if( mAliases.contains( alias ) )
|
||||
{
|
||||
//An alias in this list was moved to another list
|
||||
removeAlias( alias );
|
||||
}
|
||||
break;
|
||||
case DELETE:
|
||||
if( mAliases.contains( alias ) )
|
||||
{
|
||||
removeAlias( alias );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JSeparator;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import settings.SettingsManager;
|
||||
import controller.ConfigurableNode;
|
||||
|
||||
public class AliasListNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private SettingsManager mSettingsManager;
|
||||
|
||||
public AliasListNode( PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
AliasList list )
|
||||
{
|
||||
super( playlistManager, list );
|
||||
|
||||
mPlaylistManager = playlistManager;
|
||||
mSettingsManager = settingsManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return new ListEditor( this );
|
||||
}
|
||||
|
||||
public AliasList getList()
|
||||
{
|
||||
return (AliasList)getUserObject();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
for( Group group: getList().getGroup() )
|
||||
{
|
||||
GroupNode node = new GroupNode( mPlaylistManager, mSettingsManager, group );
|
||||
|
||||
getModel().addNode( node, AliasListNode.this, getChildCount() );
|
||||
|
||||
node.init();
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getList().getName() + " [" + this.getChildCount() + "]";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addItem = new JMenuItem( "Add Group" );
|
||||
addItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Group group = new Group();
|
||||
|
||||
getList().addGroup( group );
|
||||
|
||||
GroupNode node = new GroupNode( mPlaylistManager, mSettingsManager, group );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasListNode.this,
|
||||
AliasListNode.this.getChildCount() );
|
||||
|
||||
sort();
|
||||
|
||||
getModel().showNode( node );
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addItem );
|
||||
|
||||
retVal.add( new JSeparator() );
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasDirectoryNode parent = (AliasDirectoryNode)getParent();
|
||||
|
||||
parent.getAliasDirectory().removeAliasList( getList() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( AliasListNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,9 @@ package alias;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
@@ -48,6 +50,7 @@ public class AliasModel extends AbstractTableModel
|
||||
|
||||
private List<Alias> mAliases = new CopyOnWriteArrayList<>();
|
||||
private Broadcaster<AliasEvent> mAliasEventBroadcaster = new Broadcaster<>();
|
||||
private Map<String,AliasList> mAliasListMap = new HashMap<>();
|
||||
|
||||
public AliasModel()
|
||||
{
|
||||
@@ -71,6 +74,31 @@ public class AliasModel extends AbstractTableModel
|
||||
return null;
|
||||
}
|
||||
|
||||
public AliasList getAliasList( String name )
|
||||
{
|
||||
if( mAliasListMap.containsKey( name ) )
|
||||
{
|
||||
return mAliasListMap.get( name );
|
||||
}
|
||||
|
||||
AliasList aliasList = new AliasList( name );
|
||||
|
||||
for( Alias alias: mAliases )
|
||||
{
|
||||
if( alias.getList().equalsIgnoreCase( name ) )
|
||||
{
|
||||
aliasList.addAlias( alias );
|
||||
}
|
||||
}
|
||||
|
||||
mAliasListMap.put( name, aliasList );
|
||||
|
||||
//Register the new alias list to receive updates from this model
|
||||
addListener( aliasList );
|
||||
|
||||
return aliasList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of unique alias list names from across the alias set
|
||||
*/
|
||||
|
||||
@@ -1,572 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import map.MapIcon;
|
||||
import playlist.PlaylistManager;
|
||||
import settings.SettingsManager;
|
||||
import alias.action.AliasAction;
|
||||
import alias.action.beep.BeepAction;
|
||||
import alias.action.beep.BeepActionNode;
|
||||
import alias.action.clip.ClipAction;
|
||||
import alias.action.clip.ClipActionNode;
|
||||
import alias.action.script.ScriptAction;
|
||||
import alias.action.script.ScriptActionNode;
|
||||
import alias.id.AliasID;
|
||||
import alias.id.esn.ESNNode;
|
||||
import alias.id.esn.Esn;
|
||||
import alias.id.fleetsync.FleetsyncID;
|
||||
import alias.id.fleetsync.FleetsyncIDNode;
|
||||
import alias.id.lojack.LoJackFunctionAndID;
|
||||
import alias.id.lojack.LoJackIDNode;
|
||||
import alias.id.mdc.MDC1200ID;
|
||||
import alias.id.mdc.MDC1200IDNode;
|
||||
import alias.id.mobileID.MINNode;
|
||||
import alias.id.mobileID.Min;
|
||||
import alias.id.mpt1327.MPT1327ID;
|
||||
import alias.id.mpt1327.MPT1327IDNode;
|
||||
import alias.id.nonrecordable.NonRecordable;
|
||||
import alias.id.nonrecordable.NonRecordableNode;
|
||||
import alias.id.priority.Priority;
|
||||
import alias.id.priority.PriorityNode;
|
||||
import alias.id.siteID.SiteID;
|
||||
import alias.id.siteID.SiteIDNode;
|
||||
import alias.id.status.StatusID;
|
||||
import alias.id.status.StatusIDNode;
|
||||
import alias.id.talkgroup.TalkgroupID;
|
||||
import alias.id.talkgroup.TalkgroupIDNode;
|
||||
import alias.id.uniqueID.UniqueID;
|
||||
import alias.id.uniqueID.UniqueIDNode;
|
||||
import controller.ConfigurableNode;
|
||||
|
||||
public class AliasNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SettingsManager mSettingsManager;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
|
||||
public AliasNode( PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
Alias alias )
|
||||
{
|
||||
super( playlistManager, alias );
|
||||
|
||||
mSettingsManager = settingsManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
// return new AliasEditor( this, mSettingsManager );
|
||||
}
|
||||
|
||||
public Alias getAlias()
|
||||
{
|
||||
return (Alias)getUserObject();
|
||||
}
|
||||
|
||||
public String getIconPath()
|
||||
{
|
||||
String icon = getAlias().getIconName();
|
||||
|
||||
MapIcon mapIcon = mSettingsManager.getMapIcon( icon );
|
||||
|
||||
if( mapIcon != null )
|
||||
{
|
||||
return mapIcon.getPath();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
for( AliasID aliasID: getAlias().getId() )
|
||||
{
|
||||
switch( aliasID.getType() )
|
||||
{
|
||||
case ESN:
|
||||
getModel().addNode( new ESNNode( mPlaylistManager, (Esn)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case Fleetsync:
|
||||
getModel().addNode( new FleetsyncIDNode( mPlaylistManager, (FleetsyncID)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case LoJack:
|
||||
getModel().addNode( new LoJackIDNode( mPlaylistManager, (LoJackFunctionAndID)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case LTRNetUID:
|
||||
getModel().addNode( new UniqueIDNode( mPlaylistManager, (UniqueID)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case MDC1200:
|
||||
getModel().addNode( new MDC1200IDNode( mPlaylistManager, (MDC1200ID)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case MIN:
|
||||
getModel().addNode( new MINNode( mPlaylistManager, (Min)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case MPT1327:
|
||||
getModel().addNode( new MPT1327IDNode( mPlaylistManager, (MPT1327ID)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case NonRecordable:
|
||||
getModel().addNode( new NonRecordableNode( mPlaylistManager, (NonRecordable)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case Priority:
|
||||
getModel().addNode( new PriorityNode( mPlaylistManager, (Priority)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case Site:
|
||||
getModel().addNode( new SiteIDNode( mPlaylistManager, (SiteID)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case Status:
|
||||
getModel().addNode( new StatusIDNode( mPlaylistManager, (StatusID)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
case Talkgroup:
|
||||
getModel().addNode( new TalkgroupIDNode( mPlaylistManager, (TalkgroupID)aliasID ),
|
||||
AliasNode.this, getChildCount() );
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException( "Unrecognized alias ID [" +
|
||||
aliasID.getType() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
for( AliasAction action: getAlias().getAction() )
|
||||
{
|
||||
if( action instanceof BeepAction )
|
||||
{
|
||||
getModel().addNode( new BeepActionNode( mPlaylistManager, (BeepAction)action ),
|
||||
AliasNode.this, getChildCount() );
|
||||
}
|
||||
else if( action instanceof ClipAction )
|
||||
{
|
||||
getModel().addNode( new ClipActionNode( mPlaylistManager, (ClipAction)action ),
|
||||
AliasNode.this, getChildCount() );
|
||||
}
|
||||
else if( action instanceof ScriptAction )
|
||||
{
|
||||
getModel().addNode( new ScriptActionNode( mPlaylistManager, (ScriptAction)action ),
|
||||
AliasNode.this, getChildCount() );
|
||||
}
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getAlias().getName() + " [" + this.getChildCount() + "]";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenu addIDMenu = new JMenu( "Add ID" );
|
||||
|
||||
JMenuItem addESNItem = new JMenuItem( "ESN" );
|
||||
addESNItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Esn esn = new Esn();
|
||||
|
||||
getAlias().addAliasID( esn );
|
||||
|
||||
ESNNode node = new ESNNode( mPlaylistManager, esn );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
addIDMenu.add( addESNItem );
|
||||
|
||||
JMenuItem addFleetsyncItem = new JMenuItem( "Fleetsync" );
|
||||
addFleetsyncItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
FleetsyncID fs = new FleetsyncID();
|
||||
|
||||
getAlias().addAliasID( fs );
|
||||
|
||||
FleetsyncIDNode node = new FleetsyncIDNode( mPlaylistManager, fs );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
addIDMenu.add( addFleetsyncItem );
|
||||
|
||||
JMenuItem addLoJackItem = new JMenuItem( "LoJack" );
|
||||
addLoJackItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
LoJackFunctionAndID lj = new LoJackFunctionAndID();
|
||||
|
||||
getAlias().addAliasID( lj );
|
||||
|
||||
LoJackIDNode node = new LoJackIDNode( mPlaylistManager, lj );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
addIDMenu.add( addLoJackItem );
|
||||
|
||||
JMenuItem addMDCItem = new JMenuItem( "MDC-1200" );
|
||||
addMDCItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
MDC1200ID mdc = new MDC1200ID();
|
||||
|
||||
getAlias().addAliasID( mdc );
|
||||
|
||||
MDC1200IDNode node = new MDC1200IDNode( mPlaylistManager, mdc );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
addIDMenu.add( addMDCItem );
|
||||
|
||||
JMenuItem addMINItem = new JMenuItem( "MIN" );
|
||||
addMINItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Min min = new Min();
|
||||
|
||||
getAlias().addAliasID( min );
|
||||
|
||||
MINNode node = new MINNode( mPlaylistManager, min );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
addIDMenu.add( addMINItem );
|
||||
|
||||
JMenuItem addMPTItem = new JMenuItem( "MPT-1327" );
|
||||
addMPTItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
MPT1327ID mpt = new MPT1327ID();
|
||||
|
||||
getAlias().addAliasID( mpt );
|
||||
|
||||
MPT1327IDNode node = new MPT1327IDNode( mPlaylistManager, mpt );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
addIDMenu.add( addMPTItem );
|
||||
|
||||
JMenuItem addSiteItem = new JMenuItem( "Site" );
|
||||
addSiteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
SiteID siteID = new SiteID();
|
||||
|
||||
getAlias().addAliasID( siteID );
|
||||
|
||||
SiteIDNode node = new SiteIDNode( mPlaylistManager, siteID );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
addIDMenu.add( addSiteItem );
|
||||
|
||||
JMenuItem addStatusItem = new JMenuItem( "Status" );
|
||||
addStatusItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
StatusID statusID = new StatusID();
|
||||
|
||||
getAlias().addAliasID( statusID );
|
||||
|
||||
StatusIDNode node = new StatusIDNode( mPlaylistManager, statusID );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
|
||||
addIDMenu.add( addStatusItem );
|
||||
|
||||
JMenuItem addTalkgroupItem = new JMenuItem( "Talkgroup" );
|
||||
addTalkgroupItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
TalkgroupID tg = new TalkgroupID();
|
||||
|
||||
getAlias().addAliasID( tg );
|
||||
|
||||
TalkgroupIDNode node = new TalkgroupIDNode( mPlaylistManager, tg );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
addIDMenu.add( addTalkgroupItem );
|
||||
|
||||
JMenuItem addUniqueIDItem = new JMenuItem( "Unique ID" );
|
||||
addUniqueIDItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
UniqueID uid = new UniqueID();
|
||||
|
||||
getAlias().addAliasID( uid );
|
||||
|
||||
UniqueIDNode node = new UniqueIDNode( mPlaylistManager, uid );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
addIDMenu.add( addUniqueIDItem );
|
||||
|
||||
retVal.add( addIDMenu );
|
||||
|
||||
JMenu addActionMenu = new JMenu( "Add Action" );
|
||||
|
||||
JMenuItem addClipItem = new JMenuItem( "Audio Clip" );
|
||||
|
||||
addClipItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
ClipAction clipAction = new ClipAction();
|
||||
|
||||
getAlias().addAliasAction( clipAction );
|
||||
|
||||
ClipActionNode node = new ClipActionNode( mPlaylistManager, clipAction );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
|
||||
addActionMenu.add( addClipItem );
|
||||
|
||||
JMenuItem addBeepItem = new JMenuItem( "Beep" );
|
||||
|
||||
addBeepItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
BeepAction beepAction = new BeepAction();
|
||||
|
||||
getAlias().addAliasAction( beepAction );
|
||||
|
||||
BeepActionNode node = new BeepActionNode( mPlaylistManager, beepAction );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
|
||||
addActionMenu.add( addBeepItem );
|
||||
|
||||
JMenuItem addScriptItem = new JMenuItem( "Script" );
|
||||
|
||||
addScriptItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
ScriptAction scriptAction = new ScriptAction();
|
||||
|
||||
getAlias().addAliasAction( scriptAction );
|
||||
|
||||
ScriptActionNode node = new ScriptActionNode( mPlaylistManager, scriptAction );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
|
||||
addActionMenu.add( addScriptItem );
|
||||
|
||||
retVal.add( addActionMenu );
|
||||
|
||||
retVal.addSeparator();
|
||||
|
||||
if( getAlias().isRecordable() )
|
||||
{
|
||||
JMenuItem nonRecordableItem = new JMenuItem( "Set Non-Recordable" );
|
||||
|
||||
nonRecordableItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
NonRecordable non = new NonRecordable();
|
||||
|
||||
getAlias().addAliasID( non );
|
||||
|
||||
NonRecordableNode node = new NonRecordableNode( mPlaylistManager, non );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( nonRecordableItem );
|
||||
retVal.addSeparator();
|
||||
}
|
||||
|
||||
if( !getAlias().hasCallPriority() )
|
||||
{
|
||||
JMenuItem priorityItem = new JMenuItem( "Set Call Priority" );
|
||||
|
||||
priorityItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Priority priority = new Priority();
|
||||
|
||||
getAlias().addAliasID( priority );
|
||||
|
||||
PriorityNode node = new PriorityNode( mPlaylistManager, priority );
|
||||
|
||||
getModel().addNode( node,
|
||||
AliasNode.this,
|
||||
AliasNode.this.getChildCount() );
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( priorityItem );
|
||||
retVal.addSeparator();
|
||||
}
|
||||
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
GroupNode parent = (GroupNode)getParent();
|
||||
|
||||
parent.getGroup().removeAlias( getAlias() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( AliasNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import controller.ConfigurableNode;
|
||||
|
||||
public class GroupEditor extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private GroupNode mGroupNode;
|
||||
|
||||
private JLabel mLabelName;
|
||||
private JTextField mTextGroup;
|
||||
|
||||
public GroupEditor( GroupNode groupNode )
|
||||
{
|
||||
mGroupNode = groupNode;
|
||||
|
||||
initGUI();
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
{
|
||||
setLayout( new MigLayout( "", "[right][grow,fill]", "[][][grow]" ) );
|
||||
|
||||
setBorder( BorderFactory.createTitledBorder( "Group" ) );
|
||||
|
||||
mLabelName = new JLabel( "Name:" );
|
||||
add( mLabelName, "align right" );
|
||||
|
||||
mTextGroup = new JTextField( mGroupNode.getGroup().getName() );
|
||||
add( mTextGroup, "wrap" );
|
||||
|
||||
JButton btnSave = new JButton( "Save" );
|
||||
btnSave.addActionListener( GroupEditor.this );
|
||||
add( btnSave );
|
||||
|
||||
JButton btnReset = new JButton( "Reset" );
|
||||
btnReset.addActionListener( GroupEditor.this );
|
||||
add( btnReset, "wrap" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
String command = e.getActionCommand();
|
||||
|
||||
if( command.contentEquals( "Save" ) )
|
||||
{
|
||||
String group = mTextGroup.getText();
|
||||
|
||||
if( group != null )
|
||||
{
|
||||
boolean expanded = mGroupNode.getModel().getTree()
|
||||
.isExpanded( new TreePath( mGroupNode ) );
|
||||
|
||||
mGroupNode.getGroup().setName( group );
|
||||
|
||||
((ConfigurableNode)mGroupNode.getParent()).sort();
|
||||
|
||||
mGroupNode.save();
|
||||
|
||||
mGroupNode.show();
|
||||
|
||||
if( expanded )
|
||||
{
|
||||
mGroupNode.getModel().getTree()
|
||||
.expandPath( new TreePath( mGroupNode ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JOptionPane.showMessageDialog( GroupEditor.this, "Please enter a group name" );
|
||||
}
|
||||
}
|
||||
else if( command.contentEquals( "Reset" ) )
|
||||
{
|
||||
mTextGroup.setText( mGroupNode.getGroup().getName() );
|
||||
}
|
||||
|
||||
mGroupNode.refresh();
|
||||
}
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JSeparator;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import settings.SettingsManager;
|
||||
import controller.ConfigurableNode;
|
||||
|
||||
public class GroupNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private SettingsManager mSettingsManager;
|
||||
|
||||
public GroupNode( PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
Group group )
|
||||
{
|
||||
super( playlistManager, group );
|
||||
|
||||
mSettingsManager = settingsManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return new GroupEditor( this );
|
||||
}
|
||||
|
||||
public Group getGroup()
|
||||
{
|
||||
return (Group)getUserObject();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
for( Alias alias: getGroup().getAlias() )
|
||||
{
|
||||
AliasNode node = new AliasNode( mPlaylistManager, mSettingsManager, alias );
|
||||
|
||||
getModel().addNode( node, GroupNode.this, getChildCount() );
|
||||
|
||||
node.init();
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getGroup().getName() + " [" + this.getChildCount() + "]";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addItem = new JMenuItem( "Add Alias" );
|
||||
addItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Alias alias = new Alias();
|
||||
|
||||
getGroup().addAlias( alias );
|
||||
|
||||
AliasNode node = new AliasNode( mPlaylistManager, mSettingsManager, alias );
|
||||
|
||||
getModel().addNode( node,
|
||||
GroupNode.this,
|
||||
GroupNode.this.getChildCount() );
|
||||
|
||||
sort();
|
||||
|
||||
getModel().showNode( node );
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addItem );
|
||||
|
||||
retVal.add( new JSeparator() );
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasListNode parent = (AliasListNode)getParent();
|
||||
|
||||
parent.getList().removeGroup( getGroup() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( GroupNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import controller.ConfigurableNode;
|
||||
|
||||
public class ListEditor extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private AliasListNode mListNode;
|
||||
|
||||
private JLabel mLabelName;
|
||||
private JTextField mTextGroup;
|
||||
|
||||
public ListEditor( AliasListNode listNode )
|
||||
{
|
||||
mListNode = listNode;
|
||||
|
||||
initGUI();
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
{
|
||||
setLayout( new MigLayout( "", "[right][grow,fill]", "[][][grow]" ) );
|
||||
|
||||
setBorder( BorderFactory.createTitledBorder( "List" ) );
|
||||
|
||||
mLabelName = new JLabel( "Name:" );
|
||||
add( mLabelName, "align right" );
|
||||
|
||||
mTextGroup = new JTextField( mListNode.getList().getName() );
|
||||
add( mTextGroup, "grow, wrap" );
|
||||
|
||||
JButton btnSave = new JButton( "Save" );
|
||||
btnSave.addActionListener( ListEditor.this );
|
||||
add( btnSave );
|
||||
|
||||
JButton btnReset = new JButton( "Reset" );
|
||||
btnReset.addActionListener( ListEditor.this );
|
||||
add( btnReset, "wrap" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
String command = e.getActionCommand();
|
||||
|
||||
if( command.contentEquals( "Save" ) )
|
||||
{
|
||||
String group = mTextGroup.getText();
|
||||
|
||||
if( group != null )
|
||||
{
|
||||
boolean expanded = mListNode.getModel().getTree()
|
||||
.isExpanded( new TreePath( mListNode ) );
|
||||
|
||||
mListNode.getList().setName( group );
|
||||
((ConfigurableNode)mListNode.getParent()).sort();
|
||||
mListNode.save();
|
||||
|
||||
mListNode.show();
|
||||
|
||||
if( expanded )
|
||||
{
|
||||
mListNode.getModel().getTree().expandPath( new TreePath( mListNode ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JOptionPane.showMessageDialog( ListEditor.this, "Please enter a list name" );
|
||||
}
|
||||
}
|
||||
else if( command.contentEquals( "Reset" ) )
|
||||
{
|
||||
mTextGroup.setText( mListNode.getList().getName() );
|
||||
}
|
||||
|
||||
mListNode.refresh();
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.action;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import controller.ConfigurableNode;
|
||||
|
||||
public class AliasActionNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PlaylistManager mPlaylistManager;
|
||||
|
||||
public AliasActionNode( PlaylistManager playlistManager, AliasAction action )
|
||||
{
|
||||
super( playlistManager, action );
|
||||
|
||||
mPlaylistManager = playlistManager;
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
mPlaylistManager.save();
|
||||
}
|
||||
|
||||
public String getIconPath()
|
||||
{
|
||||
return "images/action.png";
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.action.beep;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.action.AliasActionNode;
|
||||
|
||||
public class BeepActionNode extends AliasActionNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public BeepActionNode( PlaylistManager playlistManager, BeepAction beepAction )
|
||||
{
|
||||
super( playlistManager, beepAction );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public BeepAction getBeepAction()
|
||||
{
|
||||
return (BeepAction)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Action: Beep";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasAction( getBeepAction() );
|
||||
|
||||
/* Save before removing the node ... so that we still have
|
||||
* a reference to the parent's resources */
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( BeepActionNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.action.clip;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.action.AliasActionNode;
|
||||
|
||||
public class ClipActionNode extends AliasActionNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ClipActionNode( PlaylistManager playlistManager, ClipAction clipAction )
|
||||
{
|
||||
super( playlistManager, clipAction );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public ClipAction getClipAction()
|
||||
{
|
||||
return (ClipAction)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Action: Audio Clip";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasAction( getClipAction() );
|
||||
|
||||
/* Save before removing the node ... so that we still have
|
||||
* a reference to the parent's resources */
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( ClipActionNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.action.script;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.action.AliasActionNode;
|
||||
|
||||
public class ScriptActionNode extends AliasActionNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ScriptActionNode( PlaylistManager playlistManager, ScriptAction scriptAction )
|
||||
{
|
||||
super( playlistManager, scriptAction );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public ScriptAction getScriptAction()
|
||||
{
|
||||
return (ScriptAction)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Action: Script";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasAction( getScriptAction() );
|
||||
|
||||
/* Save before removing the node ... so that we still have
|
||||
* a reference to the parent's resources */
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( ScriptActionNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ package alias.id;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import alias.Group;
|
||||
import playlist.version1.Group;
|
||||
import alias.id.esn.Esn;
|
||||
import alias.id.fleetsync.FleetsyncID;
|
||||
import alias.id.lojack.LoJackFunctionAndID;
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.esn;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class ESNNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ESNNode( PlaylistManager playlistManager, Esn esn )
|
||||
{
|
||||
super( playlistManager, esn );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Esn getESN()
|
||||
{
|
||||
return (Esn)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "ESN " + getESN().getEsn();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getESN() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( ESNNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.fleetsync;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class FleetsyncIDNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FleetsyncIDNode( PlaylistManager playlistManager, FleetsyncID id )
|
||||
{
|
||||
super( playlistManager, id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public FleetsyncID getFleetsyncID()
|
||||
{
|
||||
return (FleetsyncID)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "Fleetsync " );
|
||||
|
||||
String ident = getFleetsyncID().getIdent();
|
||||
|
||||
if( ident != null )
|
||||
{
|
||||
sb.append( ident );
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getFleetsyncID() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( FleetsyncIDNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.lojack;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class LoJackIDNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public LoJackIDNode( PlaylistManager playlistManager, LoJackFunctionAndID id )
|
||||
{
|
||||
super( playlistManager,id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public LoJackFunctionAndID getLoJackID()
|
||||
{
|
||||
return (LoJackFunctionAndID)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getLoJackID().toString();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getLoJackID() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( LoJackIDNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.mdc;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class MDC1200IDNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MDC1200IDNode( PlaylistManager playlistManager, MDC1200ID id )
|
||||
{
|
||||
super( playlistManager, id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public MDC1200ID getMDC1200ID()
|
||||
{
|
||||
return (MDC1200ID)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "MDC-1200 " );
|
||||
sb.append( getMDC1200ID().getIdent() );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getMDC1200ID() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( MDC1200IDNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.mobileID;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class MINNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MINNode( PlaylistManager playlistManager, Min min )
|
||||
{
|
||||
super( playlistManager, min );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Min getMIN()
|
||||
{
|
||||
return (Min)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "MIN " + getMIN().getMin();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getMIN() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( MINNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.mpt1327;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class MPT1327IDNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MPT1327IDNode( PlaylistManager playlistManager, MPT1327ID id )
|
||||
{
|
||||
super( playlistManager, id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public MPT1327ID getMPT1327ID()
|
||||
{
|
||||
return (MPT1327ID)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "MPT-1327 " );
|
||||
sb.append( getMPT1327ID().getIdent() );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getMPT1327ID() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( MPT1327IDNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.nonrecordable;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasID;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class NonRecordableNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public NonRecordableNode( PlaylistManager playlistManager, NonRecordable id )
|
||||
{
|
||||
super( playlistManager, id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconPath()
|
||||
{
|
||||
return "images/no_record.png";
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Non-Recordable";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( (AliasID)getUserObject() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( NonRecordableNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2015 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.id.priority;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class PriorityNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public PriorityNode( PlaylistManager playlistManager, Priority priority )
|
||||
{
|
||||
super( playlistManager, priority );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Priority getPriority()
|
||||
{
|
||||
return (Priority)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getPriority().toString();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getPriority() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( PriorityNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.siteID;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class SiteIDNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SiteIDNode( PlaylistManager playlistManager, SiteID id )
|
||||
{
|
||||
super( playlistManager, id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public SiteID getSiteID()
|
||||
{
|
||||
return (SiteID)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Site " + getSiteID().getSite();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getSiteID() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( SiteIDNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.status;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class StatusIDNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public StatusIDNode( PlaylistManager playlistManager, StatusID id )
|
||||
{
|
||||
super( playlistManager, id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public StatusID getStatusID()
|
||||
{
|
||||
return (StatusID)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Status Code " + getStatusID().getStatus();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getStatusID() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( StatusIDNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.talkgroup;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class TalkgroupIDNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public TalkgroupIDNode( PlaylistManager playlistManager, TalkgroupID id )
|
||||
{
|
||||
super( playlistManager,id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public TalkgroupID getTalkgroupID()
|
||||
{
|
||||
return (TalkgroupID)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Talkgroup " + getTalkgroupID().getTalkgroup();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getTalkgroupID() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( TalkgroupIDNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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.id.uniqueID;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasNode;
|
||||
import alias.id.AliasIDNode;
|
||||
|
||||
public class UniqueIDNode extends AliasIDNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UniqueIDNode( PlaylistManager playlistManager, UniqueID id )
|
||||
{
|
||||
super( playlistManager, id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public UniqueID getUniqueID()
|
||||
{
|
||||
return (UniqueID)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Unique ID " + getUniqueID().getUid();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
||||
"Are you sure you want to permanently delete this node?" );
|
||||
|
||||
if( n == JOptionPane.YES_OPTION )
|
||||
{
|
||||
AliasNode parent = (AliasNode)getParent();
|
||||
|
||||
parent.getAlias().removeAliasID( getUniqueID() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( UniqueIDNode.this );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@
|
||||
package controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,21 +28,14 @@ import javax.swing.tree.MutableTreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import module.decode.DecoderType;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import playlist.PlaylistNode;
|
||||
|
||||
import settings.SettingsManager;
|
||||
import source.SourceManager;
|
||||
import source.recording.RecordingGroupNode;
|
||||
import source.tuner.Tuner;
|
||||
import source.tuner.TunerGroupNode;
|
||||
import source.tuner.TunerNode;
|
||||
import source.tuner.TunerSelectionListener;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelNode;
|
||||
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
|
||||
public class ConfigurationControllerModel extends DefaultTreeModel
|
||||
@@ -55,13 +47,10 @@ public class ConfigurationControllerModel extends DefaultTreeModel
|
||||
private ArrayList<TunerSelectionListener> mTunerSelectionListeners =
|
||||
new ArrayList<TunerSelectionListener>();
|
||||
|
||||
private PlaylistNode mPlaylistNode;
|
||||
private TunerGroupNode mTunerGroupNode;
|
||||
// private RecordingGroupNode mRecordingGroupNode;
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private SettingsManager mSettingsManager;
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
@@ -73,7 +62,6 @@ public class ConfigurationControllerModel extends DefaultTreeModel
|
||||
*/
|
||||
public ConfigurationControllerModel( ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
SourceManager sourceManager )
|
||||
{
|
||||
@@ -81,7 +69,6 @@ public class ConfigurationControllerModel extends DefaultTreeModel
|
||||
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mPlaylistManager = playlistManager;
|
||||
mSettingsManager = settingsManager;
|
||||
mSourceManager = sourceManager;
|
||||
|
||||
@@ -117,13 +104,13 @@ public class ConfigurationControllerModel extends DefaultTreeModel
|
||||
// insertNodeInto( mRecordingGroupNode, (MutableTreeNode)root, 1 );
|
||||
// mRecordingGroupNode.loadRecordings();
|
||||
|
||||
/**
|
||||
* Add the playlist node
|
||||
*/
|
||||
mPlaylistNode = new PlaylistNode( mChannelModel, mChannelProcessingManager,
|
||||
mPlaylistManager, mSettingsManager, mSourceManager );
|
||||
insertNodeInto( mPlaylistNode, (MutableTreeNode)root, 1 );
|
||||
mPlaylistNode.loadPlaylist();
|
||||
// /**
|
||||
// * Add the playlist node
|
||||
// */
|
||||
// mPlaylistNode = new PlaylistNode( mChannelModel, mChannelProcessingManager,
|
||||
// mPlaylistManager, mSettingsManager, mSourceManager );
|
||||
// insertNodeInto( mPlaylistNode, (MutableTreeNode)root, 1 );
|
||||
// mPlaylistNode.loadPlaylist();
|
||||
}
|
||||
|
||||
public void showNode( DefaultMutableTreeNode node )
|
||||
@@ -146,8 +133,7 @@ public class ConfigurationControllerModel extends DefaultTreeModel
|
||||
for( Tuner tuner: tuners )
|
||||
{
|
||||
TunerNode child = new TunerNode( mChannelModel,
|
||||
mChannelProcessingManager, mPlaylistManager, mSettingsManager,
|
||||
tuner );
|
||||
mChannelProcessingManager, mSettingsManager, tuner );
|
||||
|
||||
insertNodeInto( child, parent, parent.getChildCount() );
|
||||
|
||||
@@ -250,28 +236,11 @@ public class ConfigurationControllerModel extends DefaultTreeModel
|
||||
|
||||
public ArrayList<Channel> getCurrentChannelConfigs()
|
||||
{
|
||||
return getChannelConfigs( mPlaylistNode );
|
||||
return null;
|
||||
}
|
||||
|
||||
private ArrayList<Channel> getChannelConfigs( DefaultMutableTreeNode parent )
|
||||
{
|
||||
ArrayList<Channel> configs = new ArrayList<Channel>();
|
||||
|
||||
Enumeration<DefaultMutableTreeNode> nodes = parent.children();
|
||||
|
||||
while( nodes.hasMoreElements() )
|
||||
{
|
||||
DefaultMutableTreeNode node = nodes.nextElement();
|
||||
|
||||
if( node instanceof ChannelNode )
|
||||
{
|
||||
configs.add( ((ChannelNode)node).getChannel() );
|
||||
}
|
||||
|
||||
//Recursive call
|
||||
configs.addAll( getChannelConfigs( node ) );
|
||||
}
|
||||
|
||||
return configs;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import module.decode.event.CallEventPanel;
|
||||
import module.decode.event.MessageActivityPanel;
|
||||
import module.decode.state.ChannelList;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import playlist.PlaylistManager;
|
||||
import settings.SettingsManager;
|
||||
import source.SourceManager;
|
||||
import spectrum.ChannelSpectrumPanel;
|
||||
@@ -48,6 +47,7 @@ import com.jidesoft.swing.JideTabbedPane;
|
||||
import controller.channel.ChannelController;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class ControllerPanel extends JPanel
|
||||
{
|
||||
@@ -83,9 +83,9 @@ public class ControllerPanel extends JPanel
|
||||
ConfigurationControllerModel controller,
|
||||
AliasModel aliasModel,
|
||||
ChannelModel channelModel,
|
||||
ChannelMapModel channelMapModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
MapService mapService,
|
||||
PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
SourceManager sourceManager )
|
||||
{
|
||||
@@ -105,9 +105,10 @@ public class ControllerPanel extends JPanel
|
||||
channelProcessingManager );
|
||||
|
||||
mChannelStateList = new ChannelList( channelModel, channelProcessingManager,
|
||||
playlistManager, mSettingsManager );
|
||||
mSettingsManager );
|
||||
|
||||
mChannelController = new ChannelController( channelModel, playlistManager, sourceManager );
|
||||
mChannelController = new ChannelController( channelModel, channelMapModel,
|
||||
sourceManager, aliasModel );
|
||||
|
||||
mAliasController = new AliasController( aliasModel, mSettingsManager );
|
||||
|
||||
|
||||
@@ -25,9 +25,12 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import source.SourceManager;
|
||||
import alias.AliasModel;
|
||||
|
||||
import com.jidesoft.swing.JideSplitPane;
|
||||
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class ChannelController extends JPanel
|
||||
implements ActionListener, ListSelectionListener
|
||||
{
|
||||
@@ -47,13 +50,15 @@ public class ChannelController extends JPanel
|
||||
private JButton mCopyChannelButton = new JButton( COPY_CHANNEL );
|
||||
private JButton mDeleteChannelButton = new JButton( DELETE_CHANNEL );
|
||||
|
||||
public ChannelController( ChannelModel channelModel,
|
||||
PlaylistManager playlistManager,
|
||||
SourceManager sourceManager )
|
||||
public ChannelController( ChannelModel channelModel,
|
||||
ChannelMapModel channelMapModel,
|
||||
SourceManager sourceManager,
|
||||
AliasModel aliasModel )
|
||||
{
|
||||
mChannelModel = channelModel;
|
||||
|
||||
mEditor = new ChannelEditor( channelModel, playlistManager, sourceManager );
|
||||
mEditor = new ChannelEditor( channelModel, channelMapModel,
|
||||
sourceManager, aliasModel );
|
||||
mChannelModel.addListener( mEditor );
|
||||
|
||||
init();
|
||||
|
||||
@@ -40,10 +40,12 @@ import playlist.PlaylistManager;
|
||||
import record.RecordComponentEditor;
|
||||
import source.SourceComponentEditor;
|
||||
import source.SourceManager;
|
||||
import alias.AliasModel;
|
||||
|
||||
import com.jidesoft.swing.JideTabbedPane;
|
||||
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class ChannelEditor extends JPanel
|
||||
implements ActionListener, ChannelEventListener
|
||||
@@ -65,23 +67,24 @@ public class ChannelEditor extends JPanel
|
||||
private JLabel mChannelName = new JLabel( "Channel:" );
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private ChannelMapModel mChannelMapModel;
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
private boolean mChannelEnableRequested = false;
|
||||
|
||||
public ChannelEditor( ChannelModel channelModel,
|
||||
PlaylistManager playlistManager,
|
||||
SourceManager sourceManager )
|
||||
ChannelMapModel channelMapModel,
|
||||
SourceManager sourceManager,
|
||||
AliasModel aliasModel )
|
||||
{
|
||||
super();
|
||||
|
||||
mChannelModel = channelModel;
|
||||
mPlaylistManager = playlistManager;
|
||||
mChannelMapModel = channelMapModel;
|
||||
mSourceManager = sourceManager;
|
||||
|
||||
mNameConfigurationEditor = new NameConfigurationEditor(
|
||||
mChannelModel, mPlaylistManager );
|
||||
mNameConfigurationEditor = new NameConfigurationEditor( aliasModel,
|
||||
mChannelModel );
|
||||
|
||||
initGUI();
|
||||
}
|
||||
@@ -137,7 +140,7 @@ public class ChannelEditor extends JPanel
|
||||
mSourceEditor = new SourceComponentEditor( mSourceManager );
|
||||
tabs.addTab( "Source", mSourceEditor );
|
||||
|
||||
mDecodeEditor = new DecodeComponentEditor( mPlaylistManager );
|
||||
mDecodeEditor = new DecodeComponentEditor( mChannelMapModel );
|
||||
tabs.addTab( "Decoder", mDecodeEditor );
|
||||
|
||||
mAuxDecodeEditor = new AuxDecodeComponentEditor();
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.channel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import source.SourceManager;
|
||||
import source.tuner.TunerChannel;
|
||||
import controller.ConfigurableNode;
|
||||
import controller.site.SiteNode;
|
||||
import controller.system.SystemNode;
|
||||
|
||||
/**
|
||||
* A channel has all of the pieces needed to wire together a source, decoder,
|
||||
* event logger and recorder and be started and stopped.
|
||||
*/
|
||||
public class ChannelNode extends ConfigurableNode implements ChannelEventListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger mLog = LoggerFactory.getLogger( ChannelNode.class );
|
||||
|
||||
private static DecimalFormat sFORMAT = new DecimalFormat( "0.0000" );
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
public ChannelNode( Channel channel,
|
||||
ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SourceManager sourceManager )
|
||||
{
|
||||
super( playlistManager, channel );
|
||||
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mSourceManager = sourceManager;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
/* Set the owning system and site names for the channel */
|
||||
SiteNode siteNode = (SiteNode)getParent();
|
||||
|
||||
if( siteNode != null )
|
||||
{
|
||||
getChannel().setSite( siteNode.getSite().getName() );
|
||||
|
||||
SystemNode systemNode = (SystemNode)siteNode.getParent();
|
||||
|
||||
if( systemNode != null )
|
||||
{
|
||||
getChannel().setSystem( systemNode.getSystem().getName() );
|
||||
}
|
||||
}
|
||||
|
||||
/* Add this node as listener to receive changes from underlying channel */
|
||||
// getChannel().addListener( this );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener method to receive channel changes from the underlying chnannel
|
||||
*/
|
||||
@Override
|
||||
public void channelChanged( ChannelEvent event )
|
||||
{
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
/* Refresh the node for each of these events */
|
||||
case NOTIFICATION_SELECTION_CHANGE:
|
||||
case NOTIFICATION_PROCESSING_START:
|
||||
case NOTIFICATION_PROCESSING_STOP:
|
||||
this.refresh();
|
||||
break;
|
||||
/* We're being deleted, so cleanup */
|
||||
case NOTIFICATION_DELETE:
|
||||
delete();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconPath()
|
||||
{
|
||||
return getChannel().getDecodeConfiguration().getDecoderType()
|
||||
.getIconFilename();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getBackgroundColor()
|
||||
{
|
||||
if( getChannel().getEnabled() )
|
||||
{
|
||||
if( getChannel().getEnabled() )
|
||||
{
|
||||
return Color.GREEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return new OldChannelEditor( getChannel(), mChannelModel, getPlaylistManager(), mSourceManager );
|
||||
}
|
||||
|
||||
public Channel getChannel()
|
||||
{
|
||||
return (Channel)this.getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( getChannel().getName() );
|
||||
|
||||
TunerChannel channel = getChannel().getTunerChannel();
|
||||
|
||||
if( channel != null )
|
||||
{
|
||||
sb.append( " (" );
|
||||
sb.append( sFORMAT.format( (double)channel.getFrequency() / 1000000.0d ) + " MHz" );
|
||||
sb.append( ")" );
|
||||
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu popupMenu = new JPopupMenu();
|
||||
|
||||
JMenu channelMenu = ChannelUtils.getContextMenu( mChannelModel,
|
||||
mChannelProcessingManager, getPlaylistManager(), getChannel(),
|
||||
getModel().getTree() );
|
||||
|
||||
if( channelMenu != null )
|
||||
{
|
||||
popupMenu.add( channelMenu );
|
||||
}
|
||||
|
||||
return popupMenu;
|
||||
}
|
||||
|
||||
public void delete()
|
||||
{
|
||||
((SiteNode)getParent()).getSite().removeChannel( getChannel() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( ChannelNode.this );
|
||||
}
|
||||
}
|
||||
@@ -40,12 +40,14 @@ import sample.Listener;
|
||||
import source.Source;
|
||||
import source.SourceException;
|
||||
import source.SourceManager;
|
||||
import alias.AliasModel;
|
||||
import audio.AudioPacket;
|
||||
import audio.metadata.Metadata;
|
||||
import audio.metadata.MetadataType;
|
||||
import controller.ThreadPoolManager;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
import filter.FilterSet;
|
||||
|
||||
public class ChannelProcessingManager implements ChannelEventListener
|
||||
@@ -58,22 +60,25 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
private List<Listener<Message>> mMessageListeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelMapModel mChannelMapModel;
|
||||
private AliasModel mAliasModel;
|
||||
private EventLogManager mEventLogManager;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private RecorderManager mRecorderManager;
|
||||
private SourceManager mSourceManager;
|
||||
private ThreadPoolManager mThreadPoolManager;
|
||||
|
||||
public ChannelProcessingManager( ChannelModel channelModel,
|
||||
ChannelMapModel channelMapModel,
|
||||
AliasModel aliasModel,
|
||||
EventLogManager eventLogManager,
|
||||
PlaylistManager playlistManager,
|
||||
RecorderManager recorderManager,
|
||||
SourceManager sourceManager,
|
||||
ThreadPoolManager threadPoolManager )
|
||||
{
|
||||
mChannelModel = channelModel;
|
||||
mChannelMapModel = channelMapModel;
|
||||
mAliasModel = aliasModel;
|
||||
mEventLogManager = eventLogManager;
|
||||
mPlaylistManager = playlistManager;
|
||||
mRecorderManager = recorderManager;
|
||||
mSourceManager = sourceManager;
|
||||
mThreadPoolManager = threadPoolManager;
|
||||
@@ -201,7 +206,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
|
||||
/* Processing Modules */
|
||||
List<Module> modules = DecoderFactory.getModules( mChannelModel,
|
||||
this, mPlaylistManager, channel );
|
||||
mChannelMapModel, this, mAliasModel, channel );
|
||||
processingChain.addModules( modules );
|
||||
|
||||
/* Setup message activity model with filtering */
|
||||
|
||||
@@ -9,26 +9,20 @@ import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JSeparator;
|
||||
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
import module.ProcessingChain;
|
||||
import module.decode.event.ActivitySummaryFrame;
|
||||
import module.decode.state.DecoderState;
|
||||
import playlist.PlaylistManager;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
|
||||
public class ChannelUtils
|
||||
{
|
||||
private static final boolean ENABLED = true;
|
||||
private static final boolean DISABLED = false;
|
||||
private static final boolean BROADCAST_CHANGE = true;
|
||||
|
||||
/**
|
||||
* Creates a context menu for the channel argument
|
||||
*/
|
||||
public static JMenu getContextMenu( final ChannelModel channelModel,
|
||||
final ChannelProcessingManager channelProcessingManager,
|
||||
final PlaylistManager playlistManager,
|
||||
final Channel channel,
|
||||
final Component anchor )
|
||||
final ChannelProcessingManager channelProcessingManager,
|
||||
final Channel channel,
|
||||
final Component anchor )
|
||||
{
|
||||
if( channel != null )
|
||||
{
|
||||
|
||||
@@ -27,12 +27,11 @@ import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import playlist.PlaylistManager;
|
||||
import alias.AliasList;
|
||||
import alias.AliasModel;
|
||||
|
||||
public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
@@ -42,21 +41,20 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
|
||||
private static ComboBoxModel<String> EMPTY_MODEL = new DefaultComboBoxModel<>();
|
||||
|
||||
private AliasModel mAliasModel;
|
||||
private ChannelModel mChannelModel;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
|
||||
private JTextField mChannelName = new JTextField( DEFAULT_NAME );
|
||||
private JComboBox<String> mSystemNameCombo = new JComboBox<>( EMPTY_MODEL );
|
||||
private JComboBox<String> mSiteNameCombo = new JComboBox<>( EMPTY_MODEL );
|
||||
private JComboBox<AliasList> mAliasListCombo;
|
||||
private JComboBox<String> mAliasListCombo;
|
||||
|
||||
private Channel mChannel;
|
||||
|
||||
public NameConfigurationEditor( ChannelModel model,
|
||||
PlaylistManager playlistManager )
|
||||
public NameConfigurationEditor( AliasModel aliasModel, ChannelModel model )
|
||||
{
|
||||
mAliasModel = aliasModel;
|
||||
mChannelModel = model;
|
||||
mPlaylistManager = playlistManager;
|
||||
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right][]", "[][][][][][grow]" ) );
|
||||
|
||||
@@ -110,15 +108,14 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
*/
|
||||
add( new JLabel( "Alias List:" ) );
|
||||
|
||||
mAliasListCombo = new JComboBox<AliasList>();
|
||||
mAliasListCombo = new JComboBox<String>();
|
||||
|
||||
List<AliasList> lists = mPlaylistManager.getPlayist()
|
||||
.getAliasDirectory().getAliasList();
|
||||
List<String> lists = mAliasModel.getListNames();
|
||||
|
||||
Collections.sort( lists );
|
||||
|
||||
mAliasListCombo.setModel( new DefaultComboBoxModel<AliasList>(
|
||||
lists.toArray( new AliasList[ lists.size() ] ) ) );
|
||||
mAliasListCombo.setModel( new DefaultComboBoxModel<String>(
|
||||
lists.toArray( new String[ lists.size() ] ) ) );
|
||||
|
||||
add( mAliasListCombo, "growx" );
|
||||
|
||||
@@ -126,35 +123,35 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
|
||||
final JButton aliasListButton = new JButton( "New Alias List ..." );
|
||||
|
||||
aliasListButton.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
String name = JOptionPane.showInputDialog( aliasListButton,
|
||||
"Please enter an Alias List name:" );
|
||||
|
||||
if( name != null && !name.isEmpty() )
|
||||
{
|
||||
AliasList aliasList = new AliasList( name );
|
||||
|
||||
mPlaylistManager.getPlayist().getAliasDirectory()
|
||||
.addAliasList( aliasList );
|
||||
|
||||
mPlaylistManager.save();
|
||||
|
||||
List<AliasList> lists = mPlaylistManager.getPlayist()
|
||||
.getAliasDirectory().getAliasList();
|
||||
|
||||
Collections.sort( lists );
|
||||
|
||||
mAliasListCombo.setModel( new DefaultComboBoxModel<AliasList>(
|
||||
lists.toArray( new AliasList[ lists.size() ] ) ) );
|
||||
|
||||
mAliasListCombo.setSelectedItem( aliasList );
|
||||
}
|
||||
}
|
||||
} );
|
||||
// aliasListButton.addActionListener( new ActionListener()
|
||||
// {
|
||||
// @Override
|
||||
// public void actionPerformed( ActionEvent e )
|
||||
// {
|
||||
// String name = JOptionPane.showInputDialog( aliasListButton,
|
||||
// "Please enter an Alias List name:" );
|
||||
//
|
||||
// if( name != null && !name.isEmpty() )
|
||||
// {
|
||||
// AliasListOld aliasList = new AliasListOld( name );
|
||||
//
|
||||
// mPlaylistManager.getPlayist().getAliasDirectory()
|
||||
// .addAliasList( aliasList );
|
||||
//
|
||||
// mPlaylistManager.save();
|
||||
//
|
||||
// List<AliasListOld> lists = mPlaylistManager.getPlayist()
|
||||
// .getAliasDirectory().getAliasList();
|
||||
//
|
||||
// Collections.sort( lists );
|
||||
//
|
||||
// mAliasListCombo.setModel( new DefaultComboBoxModel<AliasListOld>(
|
||||
// lists.toArray( new AliasListOld[ lists.size() ] ) ) );
|
||||
//
|
||||
// mAliasListCombo.setSelectedItem( aliasList );
|
||||
// }
|
||||
// }
|
||||
// } );
|
||||
|
||||
add( aliasListButton, "growx" );
|
||||
}
|
||||
@@ -173,8 +170,7 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
mChannel.setSite( ( site == null ? null : (String)site ) );
|
||||
|
||||
Object aliasList = mAliasListCombo.getSelectedItem();
|
||||
mChannel.setAliasListName( aliasList == null ? null :
|
||||
((AliasList)aliasList).getName() );
|
||||
mChannel.setAliasListName( aliasList == null ? null : (String)aliasList );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,10 +228,7 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
|
||||
|
||||
if( aliasListName != null )
|
||||
{
|
||||
AliasList selected = mPlaylistManager.getPlayist().getAliasDirectory()
|
||||
.getAliasList( aliasListName );
|
||||
|
||||
mAliasListCombo.setSelectedItem( selected );
|
||||
mAliasListCombo.setSelectedItem( aliasListName );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,260 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.channel;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.ComponentOrientation;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import module.decode.AuxDecodeComponentEditor;
|
||||
import module.decode.DecodeComponentEditor;
|
||||
import module.log.EventLogComponentEditor;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import record.RecordComponentEditor;
|
||||
import source.SourceComponentEditor;
|
||||
import source.SourceManager;
|
||||
import alias.AliasList;
|
||||
|
||||
import com.jidesoft.swing.JideTabbedPane;
|
||||
|
||||
public class OldChannelEditor extends ChannelConfigurationEditor implements ActionListener
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( OldChannelEditor.class );
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private DecodeComponentEditor mDecodeEditor;
|
||||
private AuxDecodeComponentEditor mAuxDecodeEditor;
|
||||
private EventLogComponentEditor mEventLogEditor;
|
||||
private RecordComponentEditor mRecordEditor;
|
||||
private SourceComponentEditor mSourceEditor;
|
||||
|
||||
private JTextField mChannelName;
|
||||
private JCheckBox mChannelEnabled = new JCheckBox();
|
||||
private JComboBox<AliasList> mComboAliasLists;
|
||||
|
||||
private Channel mChannel;
|
||||
private ChannelModel mChannelModel;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
public OldChannelEditor( Channel channel,
|
||||
ChannelModel channelModel,
|
||||
PlaylistManager playlistManager,
|
||||
SourceManager sourceManager )
|
||||
{
|
||||
super();
|
||||
|
||||
mChannel = channel;
|
||||
mChannelModel = channelModel;
|
||||
mPlaylistManager = playlistManager;
|
||||
mSourceManager = sourceManager;
|
||||
|
||||
initGUI();
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
{
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][][][grow][]" ) );
|
||||
|
||||
add( new JLabel( "Channel Configuration" ), "span, align center" );
|
||||
|
||||
add( new JLabel( "Enabled:" ) );
|
||||
|
||||
mChannelEnabled.setSelected( mChannel.getEnabled() );
|
||||
mChannelEnabled.setComponentOrientation( ComponentOrientation.RIGHT_TO_LEFT );
|
||||
add( mChannelEnabled );
|
||||
|
||||
add( new JLabel( "Name:" ) );
|
||||
|
||||
mChannelName = new JTextField( mChannel.getName() );
|
||||
add( mChannelName, "growx,push" );
|
||||
|
||||
/**
|
||||
* ComboBox: Alias Lists
|
||||
*/
|
||||
add( new JLabel( "Alias List:" ) );
|
||||
|
||||
mComboAliasLists = new JComboBox<AliasList>();
|
||||
|
||||
List<AliasList> lists = mPlaylistManager.getPlayist()
|
||||
.getAliasDirectory().getAliasList();
|
||||
|
||||
Collections.sort( lists );
|
||||
|
||||
mComboAliasLists.setModel( new DefaultComboBoxModel<AliasList>(
|
||||
lists.toArray( new AliasList[ lists.size() ] ) ) );
|
||||
|
||||
String aliasListName = mChannel.getAliasListName();
|
||||
|
||||
if( aliasListName != null )
|
||||
{
|
||||
AliasList selected = mPlaylistManager.getPlayist().getAliasDirectory()
|
||||
.getAliasList( aliasListName );
|
||||
|
||||
mComboAliasLists.setSelectedItem( selected );
|
||||
}
|
||||
|
||||
add( mComboAliasLists, "growx,push" );
|
||||
|
||||
JideTabbedPane tabs = new JideTabbedPane();
|
||||
tabs.setFont( this.getFont() );
|
||||
tabs.setForeground( Color.BLACK );
|
||||
|
||||
mSourceEditor = new SourceComponentEditor( mSourceManager );
|
||||
tabs.addTab( "Source", mSourceEditor );
|
||||
|
||||
mDecodeEditor = new DecodeComponentEditor( mPlaylistManager );
|
||||
tabs.addTab( "Decoder", mDecodeEditor );
|
||||
|
||||
mAuxDecodeEditor = new AuxDecodeComponentEditor();
|
||||
tabs.addTab( "Aux", mAuxDecodeEditor );
|
||||
|
||||
mEventLogEditor = new EventLogComponentEditor();
|
||||
tabs.addTab( "Event Log", mEventLogEditor );
|
||||
|
||||
mRecordEditor = new RecordComponentEditor();
|
||||
tabs.addTab( "Record", mRecordEditor );
|
||||
|
||||
add( tabs, "span,grow,push" );
|
||||
|
||||
JButton btnSave = new JButton( "Save" );
|
||||
btnSave.addActionListener( OldChannelEditor.this );
|
||||
add( btnSave, "growx,push" );
|
||||
|
||||
JButton btnReset = new JButton( "Reset" );
|
||||
btnReset.addActionListener( OldChannelEditor.this );
|
||||
add( btnReset, "growx,push" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
String command = e.getActionCommand();
|
||||
|
||||
if( command.contentEquals( "Save" ) )
|
||||
{
|
||||
save();
|
||||
}
|
||||
else if( command.contentEquals( "Reset" ) )
|
||||
{
|
||||
// reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
// try
|
||||
// {
|
||||
// /**
|
||||
// * Validate the source configuration against the other component
|
||||
// * configuration editors
|
||||
// */
|
||||
// validate( mSourceEditor.getSourceEditor() );
|
||||
//
|
||||
// mSourceEditor.save();
|
||||
// mDecodeEditor.save();
|
||||
// mAuxDecodeEditor.save();
|
||||
// mEventLogEditor.save();
|
||||
// mRecordEditor.save();
|
||||
//
|
||||
// mChannel.setName( mChannelName.getText() );
|
||||
// mChannel.setEnabled( mChannelEnabled.isSelected() );
|
||||
//
|
||||
// AliasList selected = mComboAliasLists.getItemAt(
|
||||
// mComboAliasLists.getSelectedIndex() );
|
||||
// if( selected != null )
|
||||
// {
|
||||
// mChannel.setAliasListName( selected.getName() );
|
||||
// }
|
||||
// }
|
||||
// catch ( ConfigurationValidationException validationException )
|
||||
// {
|
||||
// /* ChannelValidationException can be thrown by any of the component
|
||||
// * editors. Show the validation error text in a popup menu to the
|
||||
// * user */
|
||||
// JOptionPane.showMessageDialog( OldChannelEditor.this,
|
||||
// validationException.getMessage(),
|
||||
// "Channel Configuration Error",
|
||||
// JOptionPane.ERROR_MESSAGE );
|
||||
// }
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void reset()
|
||||
// {
|
||||
// mChannelName.setText( mChannel.getName() );
|
||||
// mChannelName.requestFocus();
|
||||
// mChannelName.requestFocusInWindow();
|
||||
//
|
||||
// mChannelEnabled.setSelected( mChannel.getEnabled() );
|
||||
// mChannelEnabled.requestFocus();
|
||||
// mChannelEnabled.requestFocusInWindow();
|
||||
//
|
||||
// String aliasListName = mChannel.getAliasListName();
|
||||
//
|
||||
// if( aliasListName != null )
|
||||
// {
|
||||
// AliasList selected = mPlaylistManager.getPlayist().getAliasDirectory()
|
||||
// .getAliasList( aliasListName );
|
||||
//
|
||||
// mComboAliasLists.setSelectedItem( selected );
|
||||
// }
|
||||
//
|
||||
//
|
||||
// mSourceEditor.reset();
|
||||
// mDecodeEditor.reset();
|
||||
// mAuxDecodeEditor.reset();
|
||||
// mEventLogEditor.reset();
|
||||
// mRecordEditor.reset();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
{
|
||||
mSourceEditor.validate();
|
||||
mDecodeEditor.validate();
|
||||
mAuxDecodeEditor.validate();
|
||||
mEventLogEditor.validate();
|
||||
mRecordEditor.validate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
@@ -17,22 +17,22 @@
|
||||
******************************************************************************/
|
||||
package controller.channel.map;
|
||||
|
||||
import gui.editor.DocumentListenerEditor;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
|
||||
import javax.swing.AbstractCellEditor;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFormattedTextField;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
import javax.swing.text.InternationalFormatter;
|
||||
|
||||
@@ -41,28 +41,45 @@ import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ChannelMapEditor extends JPanel implements ActionListener
|
||||
public class ChannelMapEditor extends DocumentListenerEditor<ChannelMap>
|
||||
implements ListSelectionListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( ChannelMapEditor.class );
|
||||
|
||||
private ChannelMapNode mChannelMapNode;
|
||||
|
||||
private JLabel mNameLabel;
|
||||
private JTextField mNameText;
|
||||
private ChannelMapModel mRangeModel;
|
||||
private ChannelRangeModel mRangeModel;
|
||||
private JTable mRangeTable;
|
||||
private JButton mDelete;
|
||||
private ChannelMap mChannelMapCopy;
|
||||
|
||||
public ChannelMapEditor( ChannelMapNode ChannelMap )
|
||||
public ChannelMapEditor()
|
||||
{
|
||||
mChannelMapNode = ChannelMap;
|
||||
mChannelMapCopy = mChannelMapNode.getChannelMap().copyOf();
|
||||
initGUI();
|
||||
}
|
||||
|
||||
private ChannelMap getChannelMap()
|
||||
{
|
||||
if( hasItem() )
|
||||
{
|
||||
return (ChannelMap)getItem();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem( ChannelMap item )
|
||||
{
|
||||
super.setItem( item );
|
||||
|
||||
if( hasItem() )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
{
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right][grow]", "[][][grow][][]" ) );
|
||||
@@ -72,20 +89,11 @@ public class ChannelMapEditor extends JPanel implements ActionListener
|
||||
mNameLabel = new JLabel( "Name:" );
|
||||
add( mNameLabel );
|
||||
|
||||
mNameText = new JTextField( mChannelMapCopy.getName() );
|
||||
mNameText.addFocusListener( new FocusListener()
|
||||
{
|
||||
@Override public void focusGained( FocusEvent arg0 ) {}
|
||||
|
||||
@Override
|
||||
public void focusLost( FocusEvent arg0 )
|
||||
{
|
||||
mChannelMapCopy.setName( mNameText.getText() );
|
||||
}
|
||||
} );
|
||||
mNameText = new JTextField();
|
||||
mNameText.getDocument().addDocumentListener( this );
|
||||
add( mNameText, "growx, push" );
|
||||
|
||||
mRangeModel = new ChannelMapModel( mChannelMapCopy );
|
||||
mRangeModel = new ChannelRangeModel();
|
||||
|
||||
mRangeTable = new JTable( mRangeModel );
|
||||
mRangeTable.setPreferredScrollableViewportSize( new Dimension( 300, 150 ) );
|
||||
@@ -101,88 +109,89 @@ public class ChannelMapEditor extends JPanel implements ActionListener
|
||||
add( scrollPane, "span,grow,push");
|
||||
|
||||
JButton btnNew = new JButton( "New Range" );
|
||||
btnNew.addActionListener( ChannelMapEditor.this );
|
||||
// btnNew.addActionListener( ChannelMapEditor.this );
|
||||
add( btnNew );
|
||||
|
||||
mDelete = new JButton( "Delete" );
|
||||
mDelete.addActionListener( ChannelMapEditor.this );
|
||||
// mDelete.addActionListener( ChannelMapEditor.this );
|
||||
add( mDelete, "wrap" );
|
||||
|
||||
JButton btnSave = new JButton( "Save" );
|
||||
btnSave.addActionListener( ChannelMapEditor.this );
|
||||
// btnSave.addActionListener( ChannelMapEditor.this );
|
||||
add( btnSave, "growx" );
|
||||
|
||||
JButton btnReset = new JButton( "Reset " );
|
||||
btnReset.addActionListener( ChannelMapEditor.this );
|
||||
// btnReset.addActionListener( ChannelMapEditor.this );
|
||||
add( btnReset, "wrap" );
|
||||
}
|
||||
|
||||
private boolean checkForValidRanges()
|
||||
{
|
||||
int invalidRow = mChannelMapCopy.getInvalidRange();
|
||||
|
||||
if( invalidRow != -1 && invalidRow <= mRangeTable.getRowCount() )
|
||||
{
|
||||
mRangeTable.setRowSelectionInterval( invalidRow, invalidRow );
|
||||
|
||||
JOptionPane.showMessageDialog( this,
|
||||
"Starting channel number must be less than ending channel number",
|
||||
"Channel number range error",
|
||||
JOptionPane.WARNING_MESSAGE );
|
||||
|
||||
return false;
|
||||
}
|
||||
mLog.error( "Fix Me!" );
|
||||
// int invalidRow = mChannelMapCopy.getInvalidRange();
|
||||
//
|
||||
// if( invalidRow != -1 && invalidRow <= mRangeTable.getRowCount() )
|
||||
// {
|
||||
// mRangeTable.setRowSelectionInterval( invalidRow, invalidRow );
|
||||
//
|
||||
// JOptionPane.showMessageDialog( this,
|
||||
// "Starting channel number must be less than ending channel number",
|
||||
// "Channel number range error",
|
||||
// JOptionPane.WARNING_MESSAGE );
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
String command = e.getActionCommand();
|
||||
|
||||
switch( command )
|
||||
{
|
||||
case "New Range":
|
||||
mRangeModel.addRange( new ChannelRange() );
|
||||
break;
|
||||
case "Save":
|
||||
if( checkForValidRanges() )
|
||||
{
|
||||
mChannelMapNode.getChannelMap()
|
||||
.setName( mChannelMapCopy.getName() );
|
||||
mChannelMapNode.getChannelMap()
|
||||
.setRanges( mChannelMapCopy.getRanges() );
|
||||
|
||||
mChannelMapNode.save();
|
||||
|
||||
mChannelMapNode.refresh();
|
||||
|
||||
mChannelMapNode.show();
|
||||
}
|
||||
case "Reset":
|
||||
mChannelMapCopy = mChannelMapNode.getChannelMap();
|
||||
mRangeModel.setChannelMap( mChannelMapCopy );
|
||||
mNameText.setText( mChannelMapCopy.getName() );
|
||||
break;
|
||||
case "Delete":
|
||||
int row = mRangeTable.getSelectedRow();
|
||||
|
||||
if( row < 0 )
|
||||
{
|
||||
JOptionPane.showMessageDialog( this,
|
||||
"Please select a channel range to delete",
|
||||
"Select a range",
|
||||
JOptionPane.WARNING_MESSAGE );
|
||||
}
|
||||
else
|
||||
{
|
||||
mRangeModel.removeRange(
|
||||
mRangeTable.convertRowIndexToModel( row ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// public void actionPerformed( ActionEvent e )
|
||||
// {
|
||||
// String command = e.getActionCommand();
|
||||
//
|
||||
// switch( command )
|
||||
// {
|
||||
// case "New Range":
|
||||
// mRangeModel.addRange( new ChannelRange() );
|
||||
// break;
|
||||
// case "Save":
|
||||
// if( checkForValidRanges() )
|
||||
// {
|
||||
// mChannelMapNode.getChannelMap()
|
||||
// .setName( mChannelMapCopy.getName() );
|
||||
// mChannelMapNode.getChannelMap()
|
||||
// .setRanges( mChannelMapCopy.getRanges() );
|
||||
//
|
||||
// mChannelMapNode.save();
|
||||
//
|
||||
// mChannelMapNode.refresh();
|
||||
//
|
||||
// mChannelMapNode.show();
|
||||
// }
|
||||
// case "Reset":
|
||||
// mChannelMapCopy = mChannelMapNode.getChannelMap();
|
||||
// mRangeModel.setChannelMap( mChannelMapCopy );
|
||||
// mNameText.setText( mChannelMapCopy.getName() );
|
||||
// break;
|
||||
// case "Delete":
|
||||
// int row = mRangeTable.getSelectedRow();
|
||||
//
|
||||
// if( row < 0 )
|
||||
// {
|
||||
// JOptionPane.showMessageDialog( this,
|
||||
// "Please select a channel range to delete",
|
||||
// "Select a range",
|
||||
// JOptionPane.WARNING_MESSAGE );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// mRangeModel.removeRange(
|
||||
// mRangeTable.convertRowIndexToModel( row ) );
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
public class RangeTableEditor extends AbstractCellEditor
|
||||
implements TableCellEditor, ActionListener
|
||||
@@ -221,4 +230,17 @@ public class ChannelMapEditor extends JPanel implements ActionListener
|
||||
return mEditor;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valueChanged( ListSelectionEvent e )
|
||||
{
|
||||
mLog.debug( "List Select Event from: " + e.getSource().getClass() );
|
||||
}
|
||||
}
|
||||
|
||||
76
src/controller/channel/map/ChannelMapEvent.java
Normal file
76
src/controller/channel/map/ChannelMapEvent.java
Normal file
@@ -0,0 +1,76 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2016 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 controller.channel.map;
|
||||
|
||||
public class ChannelMapEvent
|
||||
{
|
||||
private ChannelMap mChannelMap;
|
||||
private Event mEvent;
|
||||
private String mPreviousChannelMapName;
|
||||
|
||||
/**
|
||||
* ChannelMapEvent - event describing any changes to a channel map
|
||||
*
|
||||
* @param channelMap that changed
|
||||
* @param event describing the change
|
||||
*/
|
||||
public ChannelMapEvent( ChannelMap channelMap, Event event )
|
||||
{
|
||||
mChannelMap = channelMap;
|
||||
mEvent = event;
|
||||
}
|
||||
|
||||
/**
|
||||
* ChannelMapEvent - channel map renaming event.
|
||||
*
|
||||
* @param channelMap that changed
|
||||
* @param previousName of the channel map
|
||||
*/
|
||||
public ChannelMapEvent( ChannelMap channelMap, String previousName )
|
||||
{
|
||||
this( channelMap, Event.RENAME );
|
||||
|
||||
mPreviousChannelMapName = previousName;
|
||||
}
|
||||
|
||||
public ChannelMap getChannelMap()
|
||||
{
|
||||
return mChannelMap;
|
||||
}
|
||||
|
||||
public String getPreviousChannelMapName()
|
||||
{
|
||||
return mPreviousChannelMapName;
|
||||
}
|
||||
|
||||
public Event getEvent()
|
||||
{
|
||||
return mEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Events
|
||||
*/
|
||||
public enum Event
|
||||
{
|
||||
ADD,
|
||||
CHANGE,
|
||||
RENAME,
|
||||
DELETE;
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.channel.map;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import controller.ConfigurableNode;
|
||||
|
||||
public class ChannelMapListNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ChannelMapListNode( PlaylistManager playlistManager, ChannelMapList list )
|
||||
{
|
||||
super( playlistManager, list );
|
||||
}
|
||||
|
||||
public ChannelMapList getChannelMapList()
|
||||
{
|
||||
return (ChannelMapList)getUserObject();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
for( ChannelMap channelMap: getChannelMapList().getChannelMap() )
|
||||
{
|
||||
ChannelMapNode node = new ChannelMapNode( getPlaylistManager(), channelMap );
|
||||
|
||||
getModel().addNode( node, ChannelMapListNode.this, getChildCount() );
|
||||
|
||||
node.init();
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Channel Maps [" + this.getChildCount() + "]";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Add Channel Map" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
ChannelMap channelMap = new ChannelMap();
|
||||
|
||||
getChannelMapList().addChannelMap( channelMap );
|
||||
|
||||
getModel().addNode( new ChannelMapNode( getPlaylistManager(), channelMap ),
|
||||
ChannelMapListNode.this,
|
||||
ChannelMapListNode.this.getChildCount() );
|
||||
|
||||
save();
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
47
src/controller/channel/map/ChannelMapManager.java
Normal file
47
src/controller/channel/map/ChannelMapManager.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package controller.channel.map;
|
||||
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.ListSelectionModel;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import com.jidesoft.swing.JideSplitPane;
|
||||
|
||||
public class ChannelMapManager extends JPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ChannelMapModel mChannelMapModel;
|
||||
private JList<ChannelMap> mChannelMapList;
|
||||
private ChannelMapEditor mChannelMapEditor;
|
||||
|
||||
public ChannelMapManager( ChannelMapModel channelMapModel )
|
||||
{
|
||||
mChannelMapModel = channelMapModel;
|
||||
mChannelMapList = new JList( mChannelMapModel );
|
||||
mChannelMapEditor = new ChannelMapEditor();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "", "[fill,grow]", "[fill,grow]" ) );
|
||||
|
||||
mChannelMapList.addListSelectionListener( mChannelMapEditor );
|
||||
mChannelMapList.setLayoutOrientation( JList.VERTICAL );
|
||||
mChannelMapList.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
|
||||
JScrollPane listScroller = new JScrollPane( mChannelMapList );
|
||||
|
||||
JScrollPane editorScroller = new JScrollPane( mChannelMapEditor );
|
||||
|
||||
JideSplitPane splitPane = new JideSplitPane();
|
||||
splitPane.setOrientation( JideSplitPane.HORIZONTAL_SPLIT );
|
||||
splitPane.add( listScroller );
|
||||
splitPane.add( editorScroller );
|
||||
|
||||
add( splitPane );
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
@@ -15,22 +15,28 @@
|
||||
* 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.id;
|
||||
package controller.channel.map;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import controller.ConfigurableNode;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class AliasIDNode extends ConfigurableNode
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
public class ChannelMapManagerFrame extends JFrame
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AliasIDNode( PlaylistManager playlistManager, AliasID id )
|
||||
public ChannelMapManagerFrame( ChannelMapModel channelMapModel )
|
||||
{
|
||||
super( playlistManager, id );
|
||||
init( new ChannelMapManager( channelMapModel ) );
|
||||
}
|
||||
|
||||
private void init( ChannelMapManager channelMapManager )
|
||||
{
|
||||
setTitle( "Channel Map Manager" );
|
||||
setSize( 800, 400 );
|
||||
setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
|
||||
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill]" ) );
|
||||
add( channelMapManager );
|
||||
setLocationRelativeTo( null );
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
getPlaylistManager().save();
|
||||
}
|
||||
}
|
||||
@@ -1,171 +1,155 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.channel.map;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import javax.swing.AbstractListModel;
|
||||
|
||||
public class ChannelMapModel extends AbstractTableModel
|
||||
import controller.channel.map.ChannelMapEvent.Event;
|
||||
import sample.Broadcaster;
|
||||
import sample.Listener;
|
||||
|
||||
public class ChannelMapModel extends AbstractListModel<ChannelMap>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( ChannelMapModel.class );
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<ChannelMap> mChannelMaps = new ArrayList<>();
|
||||
private Broadcaster<ChannelMapEvent> mEventBroadcaster = new Broadcaster<>();
|
||||
|
||||
private static final int sSTART = 0;
|
||||
private static final int sSTOP = 1;
|
||||
private static final int sBASE = 2;
|
||||
private static final int sSIZE = 3;
|
||||
public ChannelMapModel()
|
||||
{
|
||||
}
|
||||
|
||||
protected int[] mColumnWidths = { 110, 110, 110, -1 };
|
||||
/**
|
||||
* Returns an unmodifiable list of channel maps currently in the model
|
||||
*/
|
||||
public List<ChannelMap> getChannelMaps()
|
||||
{
|
||||
return Collections.unmodifiableList( mChannelMaps );
|
||||
}
|
||||
|
||||
protected String[] mHeaders = new String[] { "Begin",
|
||||
"End",
|
||||
"Base",
|
||||
"Size" };
|
||||
|
||||
private ChannelMap mChannelMap;
|
||||
|
||||
public ChannelMapModel( ChannelMap map )
|
||||
/**
|
||||
* Returns the channel map with a matching name or null
|
||||
*/
|
||||
public ChannelMap getChannelMap( String name )
|
||||
{
|
||||
mChannelMap = map;
|
||||
}
|
||||
|
||||
public ChannelMap getChannelMap()
|
||||
{
|
||||
return mChannelMap;
|
||||
}
|
||||
|
||||
public void setChannelMap( ChannelMap map )
|
||||
{
|
||||
mChannelMap = map;
|
||||
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
public void addRange( ChannelRange range )
|
||||
{
|
||||
mChannelMap.addRange( range );
|
||||
|
||||
int index = mChannelMap.getRanges().size() - 1;
|
||||
|
||||
fireTableRowsInserted( index, index );
|
||||
}
|
||||
|
||||
public void removeRange( int rangeIndex )
|
||||
{
|
||||
if( rangeIndex < mChannelMap.getRanges().size() )
|
||||
for( ChannelMap channelMap: mChannelMaps )
|
||||
{
|
||||
mChannelMap.getRanges().remove( rangeIndex );
|
||||
}
|
||||
|
||||
fireTableRowsDeleted( rangeIndex, rangeIndex );
|
||||
}
|
||||
|
||||
public int[] getColumnWidths()
|
||||
{
|
||||
return mColumnWidths;
|
||||
}
|
||||
|
||||
public void setColumnWidths( int[] widths )
|
||||
{
|
||||
if( widths.length != 4 )
|
||||
{
|
||||
throw new IllegalArgumentException( "ChannelMapRangeModel - "
|
||||
+ "column widths array should have 5 elements" );
|
||||
}
|
||||
else
|
||||
{
|
||||
mColumnWidths = widths;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount()
|
||||
{
|
||||
return mChannelMap.getRanges().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount()
|
||||
{
|
||||
return mHeaders.length;
|
||||
}
|
||||
|
||||
public String getColumnName( int column )
|
||||
{
|
||||
return mHeaders[ column ];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt( int rowIndex, int columnIndex )
|
||||
{
|
||||
ChannelRange range = mChannelMap.getRanges().get( rowIndex );
|
||||
|
||||
switch( columnIndex )
|
||||
{
|
||||
case sSTART:
|
||||
return range.getFirstChannelNumber();
|
||||
case sSTOP:
|
||||
return range.getLastChannelNumber();
|
||||
case sBASE:
|
||||
return range.getBase();
|
||||
case sSIZE:
|
||||
return range.getSize();
|
||||
if( channelMap.getName().equalsIgnoreCase( name ) )
|
||||
{
|
||||
return channelMap;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCellEditable( int row, int column )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setValueAt( Object value, int row, int column )
|
||||
|
||||
/**
|
||||
* Adds a listener to receive notifications when channel map updates occur
|
||||
*/
|
||||
public void addListener( Listener<ChannelMapEvent> listener )
|
||||
{
|
||||
try
|
||||
mEventBroadcaster.addListener( listener );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the channel map update notification listener
|
||||
*/
|
||||
public void removeListener( Listener<ChannelMapEvent> listener )
|
||||
{
|
||||
mEventBroadcaster.removeListener( listener );
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a channel map change.
|
||||
*
|
||||
* Note: use the add/remove methods to add or remove channel maps from this
|
||||
* model. When using those methods, an add or delete event will automatically
|
||||
* be generated.
|
||||
*/
|
||||
public void broadcast( ChannelMapEvent event )
|
||||
{
|
||||
if( event.getEvent() == ChannelMapEvent.Event.CHANGE ||
|
||||
event.getEvent() == ChannelMapEvent.Event.RENAME )
|
||||
{
|
||||
int parsedValue = Integer.parseInt( (String)value );
|
||||
int index = mChannelMaps.indexOf( event.getChannelMap() );
|
||||
|
||||
ChannelRange range = mChannelMap.getRanges().get( row );
|
||||
|
||||
switch( column )
|
||||
if( index >= 0 )
|
||||
{
|
||||
case sSTART:
|
||||
range.setFirstChannelNumber( parsedValue );
|
||||
break;
|
||||
case sSTOP:
|
||||
range.setLastChannelNumber( parsedValue );
|
||||
break;
|
||||
case sBASE:
|
||||
range.setBase( parsedValue );
|
||||
break;
|
||||
case sSIZE:
|
||||
range.setSize( parsedValue );
|
||||
break;
|
||||
fireContentsChanged( this, index, index );
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
|
||||
mEventBroadcaster.broadcast( event );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a list of channel maps to this model
|
||||
*/
|
||||
public void addChannelMaps( List<ChannelMap> channelMaps )
|
||||
{
|
||||
for( ChannelMap channelMap: channelMaps )
|
||||
{
|
||||
mLog.error( "ChannelMapModel - couldn't parse integer value "
|
||||
+ "for [" + value + "]", e );
|
||||
addChannelMap( channelMap );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the channel map to this model
|
||||
*/
|
||||
public void addChannelMap( ChannelMap channelMap )
|
||||
{
|
||||
if( !mChannelMaps.contains( channelMap ) )
|
||||
{
|
||||
mChannelMaps.add( channelMap );
|
||||
|
||||
int index = mChannelMaps.indexOf( channelMap );
|
||||
|
||||
fireIntervalAdded( this, index, index );
|
||||
|
||||
broadcast( new ChannelMapEvent( channelMap, Event.ADD ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the channel map from this model
|
||||
*/
|
||||
public void removeChannelMap( ChannelMap channelMap )
|
||||
{
|
||||
if( mChannelMaps.contains( channelMap ) )
|
||||
{
|
||||
int index = mChannelMaps.indexOf( channelMap );
|
||||
|
||||
mChannelMaps.remove( channelMap );
|
||||
|
||||
fireIntervalRemoved( this, index, index );
|
||||
|
||||
broadcast( new ChannelMapEvent( channelMap, Event.DELETE ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Size/Number of channel maps in this model
|
||||
*/
|
||||
@Override
|
||||
public int getSize()
|
||||
{
|
||||
return mChannelMaps.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the channel map at the specified index
|
||||
*/
|
||||
@Override
|
||||
public ChannelMap getElementAt( int index )
|
||||
{
|
||||
if( index <= mChannelMaps.size() )
|
||||
{
|
||||
return mChannelMaps.get( index );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.channel.map;
|
||||
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import controller.ConfigurableNode;
|
||||
|
||||
public class ChannelMapNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ChannelMapNode( PlaylistManager playlistManager, ChannelMap ChannelMap )
|
||||
{
|
||||
super( playlistManager, ChannelMap );
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
//For consistency, but not used
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconPath()
|
||||
{
|
||||
return "images/ChannelMap.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return new ChannelMapEditor( this );
|
||||
}
|
||||
|
||||
public ChannelMap getChannelMap()
|
||||
{
|
||||
return (ChannelMap)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getChannelMap().getName();
|
||||
}
|
||||
|
||||
public void delete()
|
||||
{
|
||||
ChannelMapListNode parent = (ChannelMapListNode)getParent();
|
||||
|
||||
parent.getChannelMapList().removeChannelMap( getChannelMap() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( ChannelMapNode.this );
|
||||
|
||||
/* Show the first child, if one exists so that we don't have a
|
||||
* collapsed list */
|
||||
if( parent.getChildCount() > 0 )
|
||||
{
|
||||
((ConfigurableNode)parent.getFirstChild()).show();
|
||||
}
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
delete();
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
|
||||
181
src/controller/channel/map/ChannelRangeModel.java
Normal file
181
src/controller/channel/map/ChannelRangeModel.java
Normal file
@@ -0,0 +1,181 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2016 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 controller.channel.map;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ChannelRangeModel extends AbstractTableModel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( ChannelRangeModel.class );
|
||||
|
||||
private static final int START = 0;
|
||||
private static final int STOP = 1;
|
||||
private static final int BASE = 2;
|
||||
private static final int SIZE = 3;
|
||||
|
||||
protected int[] mColumnWidths = { 110, 110, 110, -1 };
|
||||
|
||||
protected String[] mHeaders = new String[] { "Begin",
|
||||
"End",
|
||||
"Base",
|
||||
"Size" };
|
||||
|
||||
private ChannelMap mChannelMap;
|
||||
|
||||
public ChannelRangeModel()
|
||||
{
|
||||
}
|
||||
|
||||
public void setChannelMap( ChannelMap channelMap )
|
||||
{
|
||||
mChannelMap = channelMap;
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
public void addRange( ChannelRange range )
|
||||
{
|
||||
if( mChannelMap != null )
|
||||
{
|
||||
mChannelMap.addRange( range );
|
||||
|
||||
int index = mChannelMap.getRanges().size() - 1;
|
||||
|
||||
fireTableRowsInserted( index, index );
|
||||
}
|
||||
}
|
||||
|
||||
public void removeRange( int rangeIndex )
|
||||
{
|
||||
if( mChannelMap != null )
|
||||
{
|
||||
if( rangeIndex < mChannelMap.getRanges().size() )
|
||||
{
|
||||
mChannelMap.getRanges().remove( rangeIndex );
|
||||
}
|
||||
|
||||
fireTableRowsDeleted( rangeIndex, rangeIndex );
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getColumnWidths()
|
||||
{
|
||||
return mColumnWidths;
|
||||
}
|
||||
|
||||
public void setColumnWidths( int[] widths )
|
||||
{
|
||||
if( widths.length != 4 )
|
||||
{
|
||||
throw new IllegalArgumentException( "ChannelMapRangeModel - "
|
||||
+ "column widths array should have 5 elements" );
|
||||
}
|
||||
else
|
||||
{
|
||||
mColumnWidths = widths;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount()
|
||||
{
|
||||
if( mChannelMap != null )
|
||||
{
|
||||
return mChannelMap.getRanges().size();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount()
|
||||
{
|
||||
return mHeaders.length;
|
||||
}
|
||||
|
||||
public String getColumnName( int column )
|
||||
{
|
||||
return mHeaders[ column ];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt( int rowIndex, int columnIndex )
|
||||
{
|
||||
if( mChannelMap != null )
|
||||
{
|
||||
ChannelRange range = mChannelMap.getRanges().get( rowIndex );
|
||||
|
||||
switch( columnIndex )
|
||||
{
|
||||
case START:
|
||||
return range.getFirstChannelNumber();
|
||||
case STOP:
|
||||
return range.getLastChannelNumber();
|
||||
case BASE:
|
||||
return range.getBase();
|
||||
case SIZE:
|
||||
return range.getSize();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCellEditable( int row, int column )
|
||||
{
|
||||
return mChannelMap != null;
|
||||
}
|
||||
|
||||
public void setValueAt( Object value, int row, int column )
|
||||
{
|
||||
if( mChannelMap != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
int parsedValue = Integer.parseInt( (String)value );
|
||||
|
||||
ChannelRange range = mChannelMap.getRanges().get( row );
|
||||
|
||||
switch( column )
|
||||
{
|
||||
case START:
|
||||
range.setFirstChannelNumber( parsedValue );
|
||||
break;
|
||||
case STOP:
|
||||
range.setLastChannelNumber( parsedValue );
|
||||
break;
|
||||
case BASE:
|
||||
range.setBase( parsedValue );
|
||||
break;
|
||||
case SIZE:
|
||||
range.setSize( parsedValue );
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
mLog.error( "ChannelMapModel - couldn't parse integer value "
|
||||
+ "for [" + value + "]", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.site;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
public class SiteEditor extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SiteNode mSiteNode;
|
||||
|
||||
private JLabel mLabelName;
|
||||
private JTextField mTextSite;
|
||||
|
||||
public SiteEditor( SiteNode site )
|
||||
{
|
||||
mSiteNode = site;
|
||||
initGUI();
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
{
|
||||
setLayout( new MigLayout() );
|
||||
|
||||
setBorder( BorderFactory.createTitledBorder( "Site" ) );
|
||||
|
||||
mLabelName = new JLabel( "Name:" );
|
||||
add( mLabelName, "align right" );
|
||||
|
||||
mTextSite = new JTextField( mSiteNode.getSite().getName() );
|
||||
add( mTextSite, "grow, wrap" );
|
||||
|
||||
JButton btnSave = new JButton( "Save" );
|
||||
btnSave.addActionListener( SiteEditor.this );
|
||||
add( btnSave );
|
||||
|
||||
JButton btnReset = new JButton( "Reset" );
|
||||
btnReset.addActionListener( SiteEditor.this );
|
||||
add( btnReset, "wrap" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
String command = e.getActionCommand();
|
||||
|
||||
if( command.contentEquals( "Save" ) )
|
||||
{
|
||||
boolean expanded = mSiteNode.getModel().getTree()
|
||||
.isExpanded( new TreePath( mSiteNode ) );
|
||||
|
||||
String name = mTextSite.getText();
|
||||
|
||||
if( name != null )
|
||||
{
|
||||
mSiteNode.getSite().setName( name );
|
||||
mSiteNode.save();
|
||||
mSiteNode.show();
|
||||
|
||||
if( expanded )
|
||||
{
|
||||
mSiteNode.getModel().getTree().expandPath( new TreePath( mSiteNode ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JOptionPane.showMessageDialog( SiteEditor.this, "Please enter a site name" );
|
||||
}
|
||||
}
|
||||
else if( command.contentEquals( "Reset" ) )
|
||||
{
|
||||
mTextSite.setText( mSiteNode.getSite().getName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.site;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import source.SourceManager;
|
||||
import controller.ConfigurableNode;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelNode;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
import controller.system.System;
|
||||
import controller.system.SystemNode;
|
||||
|
||||
public class SiteNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
public SiteNode( Site site,
|
||||
ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SourceManager sourceManager )
|
||||
{
|
||||
super( playlistManager, site );
|
||||
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mSourceManager = sourceManager;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
for( Channel channel: getSite().getChannel() )
|
||||
{
|
||||
ChannelNode node = new ChannelNode( channel, mChannelModel,
|
||||
mChannelProcessingManager, getPlaylistManager(), mSourceManager );
|
||||
|
||||
getModel().insertNodeInto( node, SiteNode.this, getChildCount() );
|
||||
|
||||
node.init();
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
public String getIconPath()
|
||||
{
|
||||
return "images/site.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getBackgroundColor()
|
||||
{
|
||||
@SuppressWarnings( "unchecked" )
|
||||
Enumeration<DefaultMutableTreeNode> nodes = children();
|
||||
|
||||
while( nodes.hasMoreElements() )
|
||||
{
|
||||
ChannelNode child = (ChannelNode)nodes.nextElement();
|
||||
|
||||
if( child.getBackgroundColor() != null )
|
||||
{
|
||||
return Color.CYAN;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return new SiteEditor( this );
|
||||
}
|
||||
|
||||
public Site getSite()
|
||||
{
|
||||
return (Site)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getSite().getName();
|
||||
}
|
||||
|
||||
public void delete()
|
||||
{
|
||||
for( int x = 0; x < getChildCount(); x++ )
|
||||
{
|
||||
((ChannelNode)getChildAt( x )).delete();
|
||||
}
|
||||
|
||||
((SystemNode)getParent()).getSystem().removeSite( getSite() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( SiteNode.this );
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addChannelItem = new JMenuItem( "Add Channel" );
|
||||
addChannelItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
System system = ((SystemNode)getParent()).getSystem();
|
||||
|
||||
Channel channel = new Channel();
|
||||
channel.setSystem( system.getName() );
|
||||
channel.setSite( getSite().getName() );
|
||||
|
||||
getSite().addChannel( channel );
|
||||
|
||||
ChannelNode node = new ChannelNode( channel, mChannelModel,
|
||||
mChannelProcessingManager, getPlaylistManager(), mSourceManager );
|
||||
|
||||
getModel().addNode( node,
|
||||
SiteNode.this,
|
||||
SiteNode.this.getChildCount() );
|
||||
|
||||
sort();
|
||||
save();
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addChannelItem );
|
||||
|
||||
retVal.add( new JSeparator() );
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
delete();
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.system;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
public class SystemEditor extends JPanel implements ActionListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private SystemNode mSystemNode;
|
||||
|
||||
private JLabel mLabelSystem;
|
||||
private JTextField mTextSystem;
|
||||
|
||||
public SystemEditor( SystemNode system )
|
||||
{
|
||||
mSystemNode = system;
|
||||
initGUI();
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
{
|
||||
setLayout( new MigLayout() );
|
||||
|
||||
setBorder( BorderFactory.createTitledBorder( "System" ) );
|
||||
|
||||
mLabelSystem = new JLabel( "Name:" );
|
||||
add( mLabelSystem, "align right" );
|
||||
|
||||
mTextSystem = new JTextField( mSystemNode.getSystem().getName() );
|
||||
add( mTextSystem, "grow, wrap" );
|
||||
|
||||
JButton btnSave = new JButton( "Save" );
|
||||
btnSave.addActionListener( SystemEditor.this );
|
||||
add( btnSave );
|
||||
|
||||
JButton btnReset = new JButton( "Reset" );
|
||||
btnReset.addActionListener( SystemEditor.this );
|
||||
add( btnReset, "wrap" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
String command = e.getActionCommand();
|
||||
|
||||
if( command.contentEquals( "Save" ) )
|
||||
{
|
||||
boolean expanded = mSystemNode.getModel().getTree()
|
||||
.isExpanded( new TreePath( mSystemNode ) );
|
||||
|
||||
String name = mTextSystem.getText();
|
||||
|
||||
if( name != null )
|
||||
{
|
||||
mSystemNode.getSystem().setName( name );
|
||||
mSystemNode.save();
|
||||
mSystemNode.show();
|
||||
|
||||
if( expanded )
|
||||
{
|
||||
mSystemNode.getModel().getTree().expandPath( new TreePath( mSystemNode ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JOptionPane.showMessageDialog( SystemEditor.this, "Please enter a system name" );
|
||||
}
|
||||
}
|
||||
else if( command.contentEquals( "Reset" ) )
|
||||
{
|
||||
mTextSystem.setText( mSystemNode.getSystem().getName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.system;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import source.SourceManager;
|
||||
import controller.ConfigurableNode;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
|
||||
public class SystemListNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
public SystemListNode( SystemList list,
|
||||
ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SourceManager sourceManager )
|
||||
{
|
||||
super( playlistManager, list );
|
||||
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mSourceManager = sourceManager;
|
||||
}
|
||||
|
||||
public SystemList getSystemList()
|
||||
{
|
||||
return (SystemList)getUserObject();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
for( System system: getSystemList().getSystem() )
|
||||
{
|
||||
SystemNode node = new SystemNode( system, mChannelModel,
|
||||
mChannelProcessingManager, getPlaylistManager(), mSourceManager );
|
||||
|
||||
getModel().addNode( node, SystemListNode.this, getChildCount() );
|
||||
|
||||
node.init();
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Systems [" + this.getChildCount() + "]";
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSystemItem = new JMenuItem( "Add System" );
|
||||
addSystemItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
System system = new System();
|
||||
|
||||
getSystemList().addSystem( system );
|
||||
|
||||
getModel().addNode( new SystemNode( system, mChannelModel,
|
||||
mChannelProcessingManager, getPlaylistManager(), mSourceManager ),
|
||||
SystemListNode.this, SystemListNode.this.getChildCount() );
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSystemItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 controller.system;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import source.SourceManager;
|
||||
import controller.ConfigurableNode;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
import controller.site.Site;
|
||||
import controller.site.SiteNode;
|
||||
|
||||
public class SystemNode extends ConfigurableNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
public SystemNode( System system,
|
||||
ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SourceManager sourceManager )
|
||||
{
|
||||
super( playlistManager, system );
|
||||
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mSourceManager = sourceManager;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
for( Site site: getSystem().getSite() )
|
||||
{
|
||||
SiteNode node = new SiteNode( site, mChannelModel,
|
||||
mChannelProcessingManager, getPlaylistManager(), mSourceManager );
|
||||
|
||||
getModel().insertNodeInto( node, SystemNode.this, getChildCount() );
|
||||
|
||||
node.init();
|
||||
}
|
||||
|
||||
sort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconPath()
|
||||
{
|
||||
return "images/system.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getBackgroundColor()
|
||||
{
|
||||
@SuppressWarnings( "unchecked" )
|
||||
Enumeration<DefaultMutableTreeNode> nodes = children();
|
||||
|
||||
while( nodes.hasMoreElements() )
|
||||
{
|
||||
SiteNode child = (SiteNode)nodes.nextElement();
|
||||
|
||||
if( child.getBackgroundColor() != null )
|
||||
{
|
||||
return Color.CYAN;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return new SystemEditor( this );
|
||||
}
|
||||
|
||||
public System getSystem()
|
||||
{
|
||||
return (System)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getSystem().getName();
|
||||
}
|
||||
|
||||
public void delete()
|
||||
{
|
||||
for( int x = 0; x < getChildCount(); x++ )
|
||||
{
|
||||
((SiteNode)getChildAt( x )).delete();
|
||||
}
|
||||
|
||||
SystemListNode parent = (SystemListNode)getParent();
|
||||
|
||||
parent.getSystemList().removeSystem( getSystem() );
|
||||
|
||||
save();
|
||||
|
||||
getModel().removeNodeFromParent( SystemNode.this );
|
||||
|
||||
/* Show the first child, if one exists so that we don't have a
|
||||
* collapsed list */
|
||||
if( parent.getChildCount() > 0 )
|
||||
{
|
||||
((ConfigurableNode)parent.getFirstChild()).show();
|
||||
}
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
{
|
||||
JPopupMenu retVal = new JPopupMenu();
|
||||
|
||||
JMenuItem addSiteItem = new JMenuItem( "Add Site" );
|
||||
addSiteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Site site = new Site();
|
||||
getSystem().addSite( site );
|
||||
|
||||
SiteNode node = new SiteNode( site, mChannelModel,
|
||||
mChannelProcessingManager, getPlaylistManager(), mSourceManager );
|
||||
|
||||
getModel().addNode( node,
|
||||
SystemNode.this,
|
||||
SystemNode.this.getChildCount() );
|
||||
|
||||
sort();
|
||||
|
||||
node.show();
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( addSiteItem );
|
||||
|
||||
retVal.add( new JSeparator() );
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
delete();
|
||||
}
|
||||
} );
|
||||
|
||||
retVal.add( deleteItem );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,7 @@ import controller.channel.ChannelEventListener;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
import controller.channel.ChannelSelectionManager;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class SDRTrunk
|
||||
{
|
||||
@@ -117,26 +118,27 @@ public class SDRTrunk
|
||||
|
||||
ThreadPoolManager threadPoolManager = new ThreadPoolManager();
|
||||
|
||||
SourceManager sourceManager = new SourceManager( mSettingsManager, threadPoolManager );
|
||||
|
||||
ChannelModel channelModel = new ChannelModel();
|
||||
|
||||
AliasModel aliasModel = new AliasModel();
|
||||
|
||||
PlaylistManager playlistManager = new PlaylistManager( threadPoolManager,
|
||||
aliasModel, channelModel );
|
||||
|
||||
RecorderManager recorderManager = new RecorderManager( threadPoolManager );
|
||||
ChannelModel channelModel = new ChannelModel();
|
||||
|
||||
ChannelMapModel channelMapModel = new ChannelMapModel();
|
||||
|
||||
EventLogManager eventLogManager = new EventLogManager();
|
||||
|
||||
RecorderManager recorderManager = new RecorderManager( threadPoolManager );
|
||||
|
||||
SourceManager sourceManager = new SourceManager( mSettingsManager,
|
||||
threadPoolManager );
|
||||
|
||||
ChannelProcessingManager channelProcessingManager =
|
||||
new ChannelProcessingManager( channelModel, eventLogManager,
|
||||
playlistManager, recorderManager, sourceManager, threadPoolManager );
|
||||
channelModel.addListener( channelProcessingManager );
|
||||
|
||||
new ChannelProcessingManager( channelModel, channelMapModel,
|
||||
aliasModel, eventLogManager, recorderManager,
|
||||
sourceManager, threadPoolManager );
|
||||
channelProcessingManager.addAudioPacketListener( recorderManager );
|
||||
|
||||
channelModel.addListener( channelProcessingManager );
|
||||
|
||||
ChannelSelectionManager channelSelectionManager =
|
||||
new ChannelSelectionManager( channelModel );
|
||||
channelModel.addListener( channelSelectionManager );
|
||||
@@ -152,27 +154,22 @@ public class SDRTrunk
|
||||
|
||||
ConfigurationControllerModel configurationControllerModel =
|
||||
new ConfigurationControllerModel( channelModel, channelProcessingManager,
|
||||
playlistManager, mSettingsManager, sourceManager );
|
||||
mSettingsManager, sourceManager );
|
||||
|
||||
mControllerPanel = new ControllerPanel( audioManager, configurationControllerModel,
|
||||
aliasModel, channelModel, channelProcessingManager, mapService, playlistManager,
|
||||
mSettingsManager, sourceManager );
|
||||
aliasModel, channelModel, channelMapModel, channelProcessingManager,
|
||||
mapService, mSettingsManager, sourceManager );
|
||||
|
||||
mSpectralPanel = new SpectralDisplayPanel( configurationControllerModel,
|
||||
channelModel, channelProcessingManager, playlistManager, mSettingsManager );
|
||||
channelModel, channelProcessingManager, mSettingsManager );
|
||||
|
||||
mTitle = getTitle();
|
||||
|
||||
//TODO: move this to the end once we add the alias model, otherwise the
|
||||
//configuration tree won't load correctly
|
||||
//Initialize the playlist manager to load the saved playlist
|
||||
PlaylistManager playlistManager = new PlaylistManager( threadPoolManager,
|
||||
aliasModel, channelModel, channelMapModel );
|
||||
|
||||
playlistManager.init();
|
||||
|
||||
mLog.info( "starting main application gui" );
|
||||
|
||||
//Initialize the GUI
|
||||
initGUI();
|
||||
|
||||
if( mLogChannelAndMemoryUsage )
|
||||
{
|
||||
Runnable cml = new ChannelMemoryLogger();
|
||||
@@ -181,6 +178,11 @@ public class SDRTrunk
|
||||
ThreadType.DECODER, cml, 5, TimeUnit.SECONDS );
|
||||
}
|
||||
|
||||
mLog.info( "starting main application gui" );
|
||||
|
||||
//Initialize the GUI
|
||||
initGUI();
|
||||
|
||||
//Start the gui
|
||||
EventQueue.invokeLater( new Runnable()
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ import source.IControllableFileSource;
|
||||
import alias.AliasModel;
|
||||
import controller.ThreadPoolManager;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class DecoderSelectionFrame extends JInternalFrame
|
||||
{
|
||||
@@ -32,10 +33,11 @@ public class DecoderSelectionFrame extends JInternalFrame
|
||||
{
|
||||
AliasModel aliasModel = new AliasModel();
|
||||
ChannelModel channelModel = new ChannelModel();
|
||||
ChannelMapModel channelMapModel = new ChannelMapModel();
|
||||
|
||||
ThreadPoolManager tpm = new ThreadPoolManager();
|
||||
|
||||
mPlaylistManager = new PlaylistManager( tpm, aliasModel, channelModel );
|
||||
mPlaylistManager = new PlaylistManager( tpm, aliasModel, channelModel, channelMapModel );
|
||||
|
||||
mDesktop = desktop;
|
||||
mSource = source;
|
||||
|
||||
@@ -58,6 +58,7 @@ import message.Message;
|
||||
import module.Module;
|
||||
import module.decode.DecoderFactory;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.log.EventLogManager;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -67,10 +68,12 @@ import playlist.PlaylistManager;
|
||||
import sample.Listener;
|
||||
import source.IControllableFileSource;
|
||||
import source.Source;
|
||||
import alias.AliasModel;
|
||||
import controller.ThreadPoolManager;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class DecoderViewFrame extends JInternalFrame
|
||||
implements Listener<Message>
|
||||
@@ -97,12 +100,14 @@ public class DecoderViewFrame extends JInternalFrame
|
||||
mProcessingChain = new InstrumentableProcessingChain();
|
||||
|
||||
ChannelModel channelModel = new ChannelModel();
|
||||
ChannelMapModel channelMapModel = new ChannelMapModel();
|
||||
|
||||
ChannelProcessingManager channelProcessingManager =
|
||||
new ChannelProcessingManager( channelModel, null,
|
||||
playlistManager, null, null, new ThreadPoolManager() );
|
||||
new ChannelProcessingManager( channelModel, channelMapModel,
|
||||
new AliasModel(), new EventLogManager(), null, null, new ThreadPoolManager() );
|
||||
|
||||
List<Module> modules = DecoderFactory.getModules( channelModel,
|
||||
channelProcessingManager, playlistManager, channel );
|
||||
channelMapModel, channelProcessingManager, new AliasModel(), channel );
|
||||
|
||||
mProcessingChain.addModules( modules );
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelConfigurationEditor;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class DecodeComponentEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
@@ -42,17 +42,14 @@ public class DecodeComponentEditor extends ChannelConfigurationEditor
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private JComboBox<DecoderType> mComboDecoders;
|
||||
|
||||
private DecodeEditor mEditor;
|
||||
|
||||
private Channel mChannel;
|
||||
|
||||
public DecodeComponentEditor( PlaylistManager playlistManager )
|
||||
public DecodeComponentEditor( final ChannelMapModel channelMapModel )
|
||||
{
|
||||
mPlaylistManager = playlistManager;
|
||||
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) );
|
||||
|
||||
mComboDecoders = new JComboBox<DecoderType>();
|
||||
@@ -96,8 +93,7 @@ public class DecodeComponentEditor extends ChannelConfigurationEditor
|
||||
}
|
||||
|
||||
//Change to the new one
|
||||
mEditor = DecoderFactory.getEditorPanel( config,
|
||||
mChannel, mPlaylistManager );
|
||||
mEditor = DecoderFactory.getEditorPanel( config, channelMapModel );
|
||||
|
||||
add( mEditor, "span 2,center" );
|
||||
|
||||
|
||||
@@ -97,12 +97,14 @@ import record.config.RecordConfiguration;
|
||||
import settings.SettingsManager;
|
||||
import util.TimeStamp;
|
||||
import alias.AliasList;
|
||||
import alias.AliasModel;
|
||||
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;
|
||||
@@ -123,17 +125,17 @@ public class DecoderFactory
|
||||
* @return list of configured decoders
|
||||
*/
|
||||
public static List<Module> getModules( ChannelModel channelModel,
|
||||
ChannelMapModel channelMapModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
AliasModel aliasModel,
|
||||
Channel channel )
|
||||
{
|
||||
|
||||
/* Get the optional alias list for the decode modules to use */
|
||||
AliasList aliasList = playlistManager.getPlayist()
|
||||
.getAliasDirectory().getAliasList( channel.getAliasListName() );
|
||||
AliasList aliasList = aliasModel.getAliasList( channel.getAliasListName() );
|
||||
|
||||
List<Module> modules = getPrimaryModules( channelModel, channelProcessingManager,
|
||||
playlistManager, aliasList, channel );
|
||||
List<Module> modules = getPrimaryModules( channelModel, channelMapModel,
|
||||
channelProcessingManager, aliasList, channel );
|
||||
|
||||
modules.addAll( getAuxiliaryDecoders( channel.getAuxDecodeConfiguration(), aliasList ) );
|
||||
|
||||
@@ -144,8 +146,8 @@ public class DecoderFactory
|
||||
* Constructs a primary decoder as specified in the decode configuration
|
||||
*/
|
||||
public static List<Module> getPrimaryModules( ChannelModel channelModel,
|
||||
ChannelMapModel channelMapModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
AliasList aliasList,
|
||||
Channel channel )
|
||||
{
|
||||
@@ -198,8 +200,8 @@ public class DecoderFactory
|
||||
case MPT1327:
|
||||
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327)decodeConfig;
|
||||
|
||||
ChannelMap channelMap = playlistManager.getPlayist()
|
||||
.getChannelMapList().getChannelMap( mptConfig.getChannelMapName() );
|
||||
ChannelMap channelMap = channelMapModel
|
||||
.getChannelMap( mptConfig.getChannelMapName() );
|
||||
|
||||
Sync sync = mptConfig.getSync();
|
||||
|
||||
@@ -432,7 +434,7 @@ public class DecoderFactory
|
||||
}
|
||||
|
||||
public static DecodeEditor getEditorPanel( DecodeConfiguration config,
|
||||
Channel channel, PlaylistManager playlistManager )
|
||||
ChannelMapModel channelMapModel )
|
||||
{
|
||||
DecodeEditor configuredPanel;
|
||||
|
||||
@@ -449,7 +451,7 @@ public class DecoderFactory
|
||||
break;
|
||||
case MPT1327:
|
||||
configuredPanel = new MPT1327ConfigEditor( config,
|
||||
channel, playlistManager );
|
||||
channelMapModel );
|
||||
break;
|
||||
case PASSPORT:
|
||||
configuredPanel = new PassportEditor( config );
|
||||
|
||||
@@ -17,10 +17,13 @@
|
||||
******************************************************************************/
|
||||
package module.decode.mpt1327;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JSlider;
|
||||
@@ -30,9 +33,9 @@ import javax.swing.event.ChangeListener;
|
||||
import module.decode.DecodeEditor;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.mpt1327.MPT1327Decoder.Sync;
|
||||
import playlist.PlaylistManager;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.map.ChannelMap;
|
||||
import controller.channel.map.ChannelMapManagerFrame;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class MPT1327ConfigEditor extends DecodeEditor
|
||||
{
|
||||
@@ -44,17 +47,14 @@ public class MPT1327ConfigEditor extends DecodeEditor
|
||||
private JSlider mCallTimeout;
|
||||
private JLabel mTrafficChannelPoolSizeLabel;
|
||||
private JSlider mTrafficChannelPoolSize;
|
||||
private Channel mChannel;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private ChannelMapModel mChannelMapModel;
|
||||
|
||||
public MPT1327ConfigEditor( DecodeConfiguration config,
|
||||
Channel channel,
|
||||
PlaylistManager playlistManager )
|
||||
ChannelMapModel channelMapModel )
|
||||
{
|
||||
super( config );
|
||||
|
||||
mChannel = channel;
|
||||
mPlaylistManager = playlistManager;
|
||||
mChannelMapModel = channelMapModel;
|
||||
|
||||
initGUI();
|
||||
}
|
||||
@@ -69,10 +69,7 @@ public class MPT1327ConfigEditor extends DecodeEditor
|
||||
/**
|
||||
* ComboBox: Alias Lists
|
||||
*/
|
||||
List<ChannelMap> maps = ( mPlaylistManager == null ?
|
||||
new ArrayList<ChannelMap>() : mPlaylistManager.getPlayist()
|
||||
.getChannelMapList().getChannelMap() );
|
||||
|
||||
List<ChannelMap> maps = mChannelMapModel.getChannelMaps();
|
||||
ChannelMap[] mapArray = maps.toArray( new ChannelMap[ maps.size() ] );
|
||||
|
||||
mComboChannelMaps = new JComboBox<ChannelMap>();
|
||||
@@ -82,6 +79,27 @@ public class MPT1327ConfigEditor extends DecodeEditor
|
||||
add( new JLabel( "Channel Map:" ) );
|
||||
add( mComboChannelMaps, "wrap" );
|
||||
|
||||
JButton channelMapManager = new JButton( "Channel Map Manager ..." );
|
||||
channelMapManager.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
final ChannelMapManagerFrame manager =
|
||||
new ChannelMapManagerFrame( mChannelMapModel );
|
||||
|
||||
EventQueue.invokeLater( new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
manager.setVisible( true );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
add( channelMapManager, "wrap" );
|
||||
|
||||
mComboSync = new JComboBox<Sync>();
|
||||
mComboSync.setModel( new DefaultComboBoxModel<Sync>( Sync.values() ) );
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package module.decode.p25;
|
||||
|
||||
import alias.AliasList;
|
||||
import instrument.Instrumentable;
|
||||
import module.decode.Decoder;
|
||||
import module.decode.DecoderType;
|
||||
import alias.AliasList;
|
||||
|
||||
public abstract class P25Decoder extends Decoder implements Instrumentable
|
||||
{
|
||||
|
||||
@@ -10,8 +10,8 @@ import module.decode.p25.message.ldu.LDUMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Listener;
|
||||
import alias.AliasList;
|
||||
import sample.Listener;
|
||||
|
||||
public class P25MessageProcessor implements Listener<Message>
|
||||
{
|
||||
|
||||
@@ -30,13 +30,13 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.AliasList;
|
||||
import sample.Listener;
|
||||
import sample.real.IFilteredRealBufferListener;
|
||||
import sample.real.RealBuffer;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.IFrequencyChangeListener;
|
||||
import source.tuner.frequency.IFrequencyChangeProvider;
|
||||
import alias.AliasList;
|
||||
import dsp.filter.FilterFactory;
|
||||
import dsp.filter.Window.WindowType;
|
||||
import dsp.filter.fir.real.RealFIRFilter_RB_RB;
|
||||
|
||||
@@ -31,11 +31,11 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.AliasList;
|
||||
import sample.Listener;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import sample.complex.ComplexBufferToStreamConverter;
|
||||
import sample.complex.IComplexBufferListener;
|
||||
import alias.AliasList;
|
||||
import dsp.filter.FilterFactory;
|
||||
import dsp.filter.Window.WindowType;
|
||||
import dsp.filter.fir.complex.ComplexFIRFilter_CB_CB;
|
||||
|
||||
@@ -34,7 +34,6 @@ import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
import settings.ColorSettingMenuItem;
|
||||
import settings.ColorSettingResetMenuItem;
|
||||
@@ -60,17 +59,14 @@ public class ChannelList extends JPanel implements ChannelEventListener
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private SettingsManager mSettingsManager;
|
||||
|
||||
public ChannelList( ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager )
|
||||
{
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mPlaylistManager = playlistManager;
|
||||
mSettingsManager = settingsManager;
|
||||
|
||||
init();
|
||||
@@ -105,7 +101,7 @@ public class ChannelList extends JPanel implements ChannelEventListener
|
||||
if( !mDisplayedPanels.containsKey( channel ) )
|
||||
{
|
||||
ChannelPanel channelPanel = new ChannelPanel( mChannelModel,
|
||||
mChannelProcessingManager, mPlaylistManager, mSettingsManager, channel );
|
||||
mChannelProcessingManager, mSettingsManager, channel );
|
||||
|
||||
add( channelPanel, "wrap" );
|
||||
|
||||
|
||||
@@ -76,7 +76,6 @@ public class ChannelPanel extends JPanel
|
||||
private JLabel mSiteLabel;
|
||||
private JLabel mChannelLabel;
|
||||
|
||||
private PlaylistManager mPlaylistManager;
|
||||
protected SettingsManager mSettingsManager;
|
||||
|
||||
private Channel mChannel;
|
||||
@@ -93,13 +92,11 @@ public class ChannelPanel extends JPanel
|
||||
*/
|
||||
public ChannelPanel( ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
Channel channel )
|
||||
{
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mPlaylistManager = playlistManager;
|
||||
mSettingsManager = settingsManager;
|
||||
mChannel = channel;
|
||||
|
||||
@@ -198,8 +195,6 @@ public class ChannelPanel extends JPanel
|
||||
|
||||
mChannelProcessingManager = null;
|
||||
|
||||
mPlaylistManager = null;
|
||||
|
||||
mSettingsManager.removeListener( this );
|
||||
mSettingsManager = null;
|
||||
|
||||
@@ -434,7 +429,7 @@ public class ChannelPanel extends JPanel
|
||||
public JMenu getContextMenu()
|
||||
{
|
||||
return ChannelUtils.getContextMenu( mChannelModel, mChannelProcessingManager,
|
||||
mPlaylistManager, mChannel, ChannelPanel.this );
|
||||
mChannel, ChannelPanel.this );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,34 +36,29 @@ import javax.xml.bind.Unmarshaller;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.version1.PlaylistConverterV1ToV2;
|
||||
import properties.SystemProperties;
|
||||
import sample.Listener;
|
||||
import alias.Alias;
|
||||
import alias.AliasDirectory;
|
||||
import alias.AliasEvent;
|
||||
import alias.AliasList;
|
||||
import alias.AliasModel;
|
||||
import alias.Group;
|
||||
import controller.ThreadPoolManager;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import controller.channel.ChannelEvent;
|
||||
import controller.channel.ChannelEventListener;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.site.Site;
|
||||
import controller.system.SystemList;
|
||||
import controller.channel.map.ChannelMapEvent;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class PlaylistManager implements ChannelEventListener, Listener<AliasEvent>
|
||||
public class PlaylistManager implements ChannelEventListener
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( PlaylistManager.class );
|
||||
|
||||
private Playlist mPlaylist = new Playlist();
|
||||
|
||||
private ThreadPoolManager mThreadPoolManager;
|
||||
private AliasModel mAliasModel;
|
||||
private ChannelModel mChannelModel;
|
||||
|
||||
private ChannelMapModel mChannelMapModel;
|
||||
private Path mCurrentPlaylistPath;
|
||||
private AtomicBoolean mPlaylistSavePending = new AtomicBoolean();
|
||||
private boolean mPlaylistLoading = false;
|
||||
|
||||
@@ -79,37 +74,35 @@ public class PlaylistManager implements ChannelEventListener, Listener<AliasEven
|
||||
*/
|
||||
public PlaylistManager( ThreadPoolManager threadPoolManager,
|
||||
AliasModel aliasModel,
|
||||
ChannelModel channelModel )
|
||||
ChannelModel channelModel,
|
||||
ChannelMapModel channelMapModel )
|
||||
{
|
||||
mThreadPoolManager = threadPoolManager;
|
||||
mAliasModel = aliasModel;
|
||||
mChannelModel = channelModel;
|
||||
mChannelMapModel = channelMapModel;
|
||||
|
||||
//Register for alias and channel events so that we can save the
|
||||
//playlist with changes
|
||||
mAliasModel.addListener( this );
|
||||
//Register for alias, channel and channel map events so that we can
|
||||
//save the playlist when there are any changes
|
||||
mChannelModel.addListener( this );
|
||||
}
|
||||
|
||||
public Playlist getPlayist()
|
||||
{
|
||||
return mPlaylist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfers data from persisted playlist into system models
|
||||
*/
|
||||
private void transferPlaylistToModels()
|
||||
{
|
||||
//TODO: delete the playlist after we've loaded it, since the models will have
|
||||
//all of the data
|
||||
|
||||
mPlaylistLoading = true;
|
||||
|
||||
mAliasModel.addAliases( mPlaylist.getAliases() );
|
||||
mChannelModel.addChannels( mPlaylist.getChannels() );
|
||||
|
||||
mPlaylistLoading = false;
|
||||
mAliasModel.addListener( new Listener<AliasEvent>()
|
||||
{
|
||||
@Override
|
||||
public void receive( AliasEvent t )
|
||||
{
|
||||
schedulePlaylistSave();
|
||||
}
|
||||
} );
|
||||
|
||||
mChannelMapModel.addListener( new Listener<ChannelMapEvent>()
|
||||
{
|
||||
@Override
|
||||
public void receive( ChannelMapEvent t )
|
||||
{
|
||||
schedulePlaylistSave();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,41 +116,64 @@ public class PlaylistManager implements ChannelEventListener, Listener<AliasEven
|
||||
Path playlistFolder = props.getApplicationFolder( "playlist" );
|
||||
|
||||
String defaultPlaylistFile =
|
||||
props.get( "playlist.defaultfilename", "playlist.xml" );
|
||||
props.get( "playlist.v2.defaultfilename", "playlist_v2.xml" );
|
||||
|
||||
String playlistFile =
|
||||
props.get( "playlist.currentfilename", defaultPlaylistFile );
|
||||
|
||||
load( playlistFolder.resolve( playlistFile ) );
|
||||
}
|
||||
props.get( "playlist.v2.currentfilename", defaultPlaylistFile );
|
||||
|
||||
/**
|
||||
* Alias event listener method. Monitors alias events for events that
|
||||
* indicate that the playlist has changed and queues automatic playlist
|
||||
* saving.
|
||||
*/
|
||||
@Override
|
||||
public void receive( AliasEvent event )
|
||||
{
|
||||
if( !mPlaylistLoading )
|
||||
mCurrentPlaylistPath = playlistFolder.resolve( playlistFile );
|
||||
|
||||
PlaylistV2 playlist = load( mCurrentPlaylistPath );
|
||||
|
||||
boolean saveRequired = false;
|
||||
|
||||
if( playlist == null )
|
||||
{
|
||||
switch( event.getEvent() )
|
||||
mLog.info( "Couldn't find version 2 playlist - looking for "
|
||||
+ "version 1 playlist to convert" );
|
||||
|
||||
Path playlistV1Path = playlistFolder.resolve( "playlist.xml" );
|
||||
|
||||
PlaylistConverterV1ToV2 converter =
|
||||
new PlaylistConverterV1ToV2( playlistV1Path );
|
||||
|
||||
if( converter.hasErrorMessages() )
|
||||
{
|
||||
case ADD:
|
||||
case DELETE:
|
||||
case CHANGE:
|
||||
schedulePlaylistSave();
|
||||
break;
|
||||
default:
|
||||
//When a new event enum entry is added and received, throw an
|
||||
//exception here to ensure developer adds support for the
|
||||
//use case
|
||||
throw new IllegalArgumentException( "Unrecognized Alias "
|
||||
+ "Event [" + event.getEvent().toString() + "]" );
|
||||
mLog.error( "Playlist version 1 conversion errors: " +
|
||||
converter.getErrorMessages() );
|
||||
}
|
||||
|
||||
playlist = converter.getConvertedPlaylist();
|
||||
|
||||
saveRequired = true;
|
||||
}
|
||||
|
||||
transferPlaylistToModels( playlist );
|
||||
|
||||
if( saveRequired )
|
||||
{
|
||||
schedulePlaylistSave();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfers data from persisted playlist into system models
|
||||
*/
|
||||
private void transferPlaylistToModels( PlaylistV2 playlist )
|
||||
{
|
||||
if( playlist != null )
|
||||
{
|
||||
mPlaylistLoading = true;
|
||||
|
||||
mAliasModel.addAliases( playlist.getAliases() );
|
||||
mChannelModel.addChannels( playlist.getChannels() );
|
||||
mChannelMapModel.addChannelMaps( playlist.getChannelMaps() );
|
||||
|
||||
mPlaylistLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Channel event listener method. Monitors channel events for events that
|
||||
* indicate that the playlist has changed and queues automatic playlist
|
||||
@@ -200,27 +216,30 @@ public class PlaylistManager implements ChannelEventListener, Listener<AliasEven
|
||||
|
||||
public void save()
|
||||
{
|
||||
//TODO: recreate the playlist and load values from each of the models
|
||||
PlaylistV2 playlist = new PlaylistV2();
|
||||
|
||||
mPlaylist.setAliases( mAliasModel.getAliases() );
|
||||
|
||||
mPlaylist.setChannels( mChannelModel.getChannels() );
|
||||
playlist.setAliases( mAliasModel.getAliases() );
|
||||
playlist.setChannels( mChannelModel.getChannels() );
|
||||
playlist.setChannelMaps( mChannelMapModel.getChannelMaps() );
|
||||
|
||||
JAXBContext context = null;
|
||||
|
||||
SystemProperties props = SystemProperties.getInstance();
|
||||
|
||||
Path playlistPath = props.getApplicationFolder( "playlist" );
|
||||
|
||||
String playlistDefault = props.get( "playlist.defaultfilename",
|
||||
"playlist.xml" );
|
||||
if( mCurrentPlaylistPath == null )
|
||||
{
|
||||
SystemProperties props = SystemProperties.getInstance();
|
||||
|
||||
String playlistCurrent = props.get( "playlist.currentfilename",
|
||||
playlistDefault );
|
||||
Path playlistPath = props.getApplicationFolder( "playlist" );
|
||||
|
||||
String playlistDefault = props.get( "playlist.defaultfilename",
|
||||
"playlist_v2.xml" );
|
||||
|
||||
String playlistCurrent = props.get( "playlist.currentfilename",
|
||||
playlistDefault );
|
||||
|
||||
mCurrentPlaylistPath = playlistPath.resolve( playlistCurrent );
|
||||
}
|
||||
|
||||
Path filePath = playlistPath.resolve( playlistCurrent );
|
||||
|
||||
File outputFile = new File( filePath.toString() );
|
||||
File outputFile = new File( mCurrentPlaylistPath.toString() );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -232,7 +251,7 @@ public class PlaylistManager implements ChannelEventListener, Listener<AliasEven
|
||||
catch( Exception e )
|
||||
{
|
||||
mLog.error( "couldn't create file to save "
|
||||
+ "playlist [" + filePath.toString() + "]" );
|
||||
+ "playlist [" + mCurrentPlaylistPath.toString() + "]" );
|
||||
}
|
||||
|
||||
OutputStream out = null;
|
||||
@@ -243,13 +262,13 @@ public class PlaylistManager implements ChannelEventListener, Listener<AliasEven
|
||||
|
||||
try
|
||||
{
|
||||
context = JAXBContext.newInstance( Playlist.class );
|
||||
context = JAXBContext.newInstance( PlaylistV2.class );
|
||||
|
||||
Marshaller m = context.createMarshaller();
|
||||
|
||||
m.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, true );
|
||||
|
||||
m.marshal( mPlaylist, out );
|
||||
m.marshal( playlist, out );
|
||||
}
|
||||
catch ( JAXBException e )
|
||||
{
|
||||
@@ -258,7 +277,8 @@ public class PlaylistManager implements ChannelEventListener, Listener<AliasEven
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
mLog.error( "coulcn't open outputstream to save playlist [" + filePath.toString() + "]", e );
|
||||
mLog.error( "coulcn't open outputstream to save playlist [" +
|
||||
mCurrentPlaylistPath.toString() + "]", e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -276,85 +296,17 @@ public class PlaylistManager implements ChannelEventListener, Listener<AliasEven
|
||||
}
|
||||
}
|
||||
|
||||
private void createBackupPlaylist()
|
||||
{
|
||||
SystemProperties props = SystemProperties.getInstance();
|
||||
|
||||
Path playlistPath = props.getApplicationFolder( "playlist" );
|
||||
|
||||
String playlistDefault = props.get( "playlist.defaultfilename",
|
||||
"playlist.xml" );
|
||||
|
||||
String playlistCurrent = props.get( "playlist.currentfilename",
|
||||
playlistDefault );
|
||||
|
||||
Path current = playlistPath.resolve( playlistCurrent );
|
||||
|
||||
if( Files.exists( current ) )
|
||||
{
|
||||
int revision = 1;
|
||||
|
||||
String playlistBackup = playlistCurrent.replace( ".xml", "_backup_" + revision + ".xml" );
|
||||
|
||||
Path filePath = playlistPath.resolve( playlistBackup );
|
||||
|
||||
while( Files.exists( filePath ) )
|
||||
{
|
||||
revision++;
|
||||
|
||||
playlistBackup = playlistCurrent.replace( ".xml", "_backup_" + revision + ".xml" );
|
||||
|
||||
filePath = playlistPath.resolve( playlistBackup );
|
||||
|
||||
if( revision > 10 )
|
||||
{
|
||||
mLog.error( "Couldn't create playlist backup - maximum revisions exceeded" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
File outputFile = new File( filePath.toString() );
|
||||
|
||||
try
|
||||
{
|
||||
if( !outputFile.exists() )
|
||||
{
|
||||
outputFile.createNewFile();
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
mLog.error( "PlaylistManager - couldn't create file to save "
|
||||
+ "playlist backup [" + filePath.toString() + "]" );
|
||||
}
|
||||
|
||||
try( OutputStream out = new FileOutputStream( outputFile ) )
|
||||
{
|
||||
Files.copy( current, out );
|
||||
|
||||
mLog.info( "Playlist backed up to:" + filePath );
|
||||
}
|
||||
catch( IOException ioe )
|
||||
{
|
||||
mLog.error( "Error copying playlist to backup file [" + filePath + "]" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mLog.error( "Couldn't create backup playlist - original playlist does not exist" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Erases current playlist and loads playlist from the playlistPath filename,
|
||||
* if it exists.
|
||||
* Loads a version 2 playlist
|
||||
*/
|
||||
public void load( Path playlistPath )
|
||||
public PlaylistV2 load( Path playlistPath )
|
||||
{
|
||||
mLog.info( "loading version 2 playlist file [" + playlistPath.toString() + "]" );
|
||||
|
||||
PlaylistV2 playlist = null;
|
||||
|
||||
if( Files.exists( playlistPath ) )
|
||||
{
|
||||
mLog.info( "loading playlist file [" + playlistPath.toString() + "]" );
|
||||
|
||||
JAXBContext context = null;
|
||||
|
||||
InputStream in = null;
|
||||
@@ -365,11 +317,11 @@ public class PlaylistManager implements ChannelEventListener, Listener<AliasEven
|
||||
|
||||
try
|
||||
{
|
||||
context = JAXBContext.newInstance( Playlist.class );
|
||||
context = JAXBContext.newInstance( PlaylistV2.class );
|
||||
|
||||
Unmarshaller m = context.createUnmarshaller();
|
||||
|
||||
mPlaylist = (Playlist)m.unmarshal( in );
|
||||
playlist = (PlaylistV2)m.unmarshal( in );
|
||||
}
|
||||
catch ( JAXBException e )
|
||||
{
|
||||
@@ -401,91 +353,10 @@ public class PlaylistManager implements ChannelEventListener, Listener<AliasEven
|
||||
mLog.info( "PlaylistManager - playlist not found at [" +
|
||||
playlistPath.toString() + "]" );
|
||||
}
|
||||
|
||||
boolean saveRequired = false;
|
||||
|
||||
if( mPlaylist == null )
|
||||
{
|
||||
mPlaylist = new Playlist();
|
||||
saveRequired = true;
|
||||
}
|
||||
|
||||
//Check for and convert from legacy play list format
|
||||
if( mPlaylist.hasSystemList() || mPlaylist.hasAliasDirectory() )
|
||||
{
|
||||
convertPlaylistFormat();
|
||||
saveRequired = true;
|
||||
}
|
||||
|
||||
transferPlaylistToModels();
|
||||
|
||||
if( saveRequired )
|
||||
{
|
||||
save();
|
||||
}
|
||||
return playlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts playlist data over to new format
|
||||
*/
|
||||
private void convertPlaylistFormat()
|
||||
{
|
||||
mLog.info( "Legacy playlist format detected - converting" );
|
||||
|
||||
createBackupPlaylist();
|
||||
|
||||
//Playlist version 1 to version 2 format conversion. In order to keep
|
||||
//backwards compatibility, transfer all of the System-Site-Channel
|
||||
//objects over to the new channel list format
|
||||
if( mPlaylist.hasSystemList() )
|
||||
{
|
||||
SystemList systemList = mPlaylist.getSystemList();
|
||||
|
||||
for( controller.system.System system: systemList.getSystem() )
|
||||
{
|
||||
for( Site site: system.getSite() )
|
||||
{
|
||||
for( Channel channel: site.getChannel() )
|
||||
{
|
||||
channel.setSystem( system.getName() );
|
||||
channel.setSite( site.getName() );
|
||||
|
||||
mPlaylist.getChannels().add( channel );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mPlaylist.getSystemList().clearSystems();
|
||||
|
||||
mLog.info( "Converted [" + mPlaylist.getChannels().size() +
|
||||
"] channels to new playlist format" );
|
||||
}
|
||||
|
||||
if( mPlaylist.hasAliasDirectory() )
|
||||
{
|
||||
AliasDirectory aliasDirectory = mPlaylist.getAliasDirectory();
|
||||
|
||||
for( AliasList list: aliasDirectory.getAliasList() )
|
||||
{
|
||||
for( Group group: list.getGroup() )
|
||||
{
|
||||
for( Alias alias: group.getAlias() )
|
||||
{
|
||||
alias.setList( list.getName() );
|
||||
alias.setGroup( group.getName() );
|
||||
|
||||
mPlaylist.getAliases().add( alias );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mPlaylist.getAliasDirectory().clearAliasLists();
|
||||
|
||||
mLog.info( "Converted [" + mPlaylist.getAliases().size() +
|
||||
"] aliases to new playlist format" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a playlist save task. Subsequent calls to this method will be
|
||||
* ignored until the save event occurs, thus limiting repetitive playlist
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 playlist;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import settings.SettingsManager;
|
||||
import source.SourceManager;
|
||||
import alias.AliasDirectory;
|
||||
import alias.AliasDirectoryNode;
|
||||
import controller.BaseNode;
|
||||
import controller.EmptyEditor;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
import controller.channel.map.ChannelMapList;
|
||||
import controller.channel.map.ChannelMapListNode;
|
||||
import controller.system.SystemList;
|
||||
import controller.system.SystemListNode;
|
||||
|
||||
public class PlaylistNode extends BaseNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private AliasDirectoryNode mAliasDirectoryNode;
|
||||
private ChannelMapListNode mChannelMapListNode;
|
||||
private SystemListNode mSystemListNode;
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private SettingsManager mSettingsManager;
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
public PlaylistNode( ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
SourceManager sourceManager )
|
||||
{
|
||||
super( null );
|
||||
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mPlaylistManager = playlistManager;
|
||||
mSettingsManager = settingsManager;
|
||||
mSourceManager = sourceManager;
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
/**
|
||||
* Delete any existing children
|
||||
*/
|
||||
delete();
|
||||
|
||||
/**
|
||||
* Load the AliasDirectory
|
||||
*/
|
||||
AliasDirectory directory = getPlaylist().getAliasDirectory();
|
||||
|
||||
if( directory == null )
|
||||
{
|
||||
directory = new AliasDirectory();
|
||||
getPlaylist().setAliasDirectory( directory );
|
||||
}
|
||||
|
||||
mAliasDirectoryNode = new AliasDirectoryNode( mPlaylistManager,
|
||||
mSettingsManager, directory );
|
||||
|
||||
getModel().insertNodeInto( mAliasDirectoryNode, this, 0 );
|
||||
|
||||
mAliasDirectoryNode.init();
|
||||
|
||||
/**
|
||||
* Load the Channel Map List
|
||||
*/
|
||||
ChannelMapList channelMapList = getPlaylist().getChannelMapList();
|
||||
|
||||
if( channelMapList == null )
|
||||
{
|
||||
channelMapList = new ChannelMapList();
|
||||
}
|
||||
|
||||
mChannelMapListNode = new ChannelMapListNode( mPlaylistManager, channelMapList );
|
||||
|
||||
getModel().insertNodeInto( mChannelMapListNode, this, 1 );
|
||||
|
||||
mChannelMapListNode.init();
|
||||
|
||||
/**
|
||||
* Load the SystemList
|
||||
*/
|
||||
SystemList list = getPlaylist().getSystemList();
|
||||
|
||||
if( list == null )
|
||||
{
|
||||
list = new SystemList();
|
||||
getPlaylist().setSystemList( list );
|
||||
}
|
||||
|
||||
mSystemListNode = new SystemListNode( list, mChannelModel,
|
||||
mChannelProcessingManager, mPlaylistManager, mSourceManager );
|
||||
|
||||
getModel().insertNodeInto( mSystemListNode, this, 2 );
|
||||
|
||||
mSystemListNode.init();
|
||||
|
||||
mSystemListNode.show();
|
||||
}
|
||||
|
||||
public SystemListNode getSystemListNode()
|
||||
{
|
||||
return mSystemListNode;
|
||||
}
|
||||
|
||||
public AliasDirectoryNode getAliasDirectoryNode()
|
||||
{
|
||||
return mAliasDirectoryNode;
|
||||
}
|
||||
|
||||
public void loadPlaylist()
|
||||
{
|
||||
Playlist playlist = mPlaylistManager.getPlayist();
|
||||
|
||||
setUserObject( playlist );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
public Playlist getPlaylist()
|
||||
{
|
||||
Playlist retVal = null;
|
||||
|
||||
Object userObject = getUserObject();
|
||||
|
||||
if( userObject != null )
|
||||
{
|
||||
retVal = (Playlist)userObject;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Playlist";
|
||||
}
|
||||
|
||||
public JPanel getEditor()
|
||||
{
|
||||
return new EmptyEditor();
|
||||
}
|
||||
}
|
||||
77
src/playlist/PlaylistV2.java
Normal file
77
src/playlist/PlaylistV2.java
Normal file
@@ -0,0 +1,77 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2016 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 playlist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import alias.Alias;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.map.ChannelMap;
|
||||
|
||||
@XmlSeeAlso( { Alias.class,Channel.class,ChannelMap.class } )
|
||||
|
||||
@XmlRootElement( name = "playlist" )
|
||||
public class PlaylistV2
|
||||
{
|
||||
//Version 2 member variables
|
||||
private List<Alias> mAliases = new ArrayList<>();
|
||||
private List<Channel> mChannels = new ArrayList<>();
|
||||
private List<ChannelMap> mChannelMaps = new ArrayList<>();
|
||||
|
||||
public PlaylistV2()
|
||||
{
|
||||
}
|
||||
|
||||
@XmlElement( name = "alias" )
|
||||
public List<Alias> getAliases()
|
||||
{
|
||||
return mAliases;
|
||||
}
|
||||
|
||||
public void setAliases( List<Alias> aliases )
|
||||
{
|
||||
mAliases = aliases;
|
||||
}
|
||||
|
||||
@XmlElement( name = "channel" )
|
||||
public List<Channel> getChannels()
|
||||
{
|
||||
return mChannels;
|
||||
}
|
||||
|
||||
public void setChannels( List<Channel> channels )
|
||||
{
|
||||
mChannels = channels;
|
||||
}
|
||||
|
||||
@XmlElement( name = "channel_map" )
|
||||
public List<ChannelMap> getChannelMaps()
|
||||
{
|
||||
return mChannelMaps;
|
||||
}
|
||||
|
||||
public void setChannelMaps( List<ChannelMap> channelMaps )
|
||||
{
|
||||
mChannelMaps = channelMaps;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
* 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 playlist.version1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -23,11 +23,14 @@ import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import alias.AliasList;
|
||||
|
||||
@XmlSeeAlso( { AliasList.class} )
|
||||
@XmlRootElement( name = "alias_directory" )
|
||||
@Deprecated
|
||||
public class AliasDirectory
|
||||
{
|
||||
private ArrayList<AliasList> mAliasList = new ArrayList<AliasList>();
|
||||
private ArrayList<AliasListOld> mAliasList = new ArrayList<>();
|
||||
|
||||
public AliasDirectory()
|
||||
{
|
||||
@@ -35,10 +38,6 @@ public class AliasDirectory
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
for( AliasList list: mAliasList )
|
||||
{
|
||||
list.update();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearAliasLists()
|
||||
@@ -47,27 +46,27 @@ public class AliasDirectory
|
||||
}
|
||||
|
||||
@XmlElement( name = "alias_list" )
|
||||
public ArrayList<AliasList> getAliasList()
|
||||
public ArrayList<AliasListOld> getAliasList()
|
||||
{
|
||||
return mAliasList;
|
||||
}
|
||||
|
||||
public void setAliasList( ArrayList<AliasList> lists )
|
||||
public void setAliasList( ArrayList<AliasListOld> lists )
|
||||
{
|
||||
mAliasList = lists;
|
||||
|
||||
if( mAliasList == null )
|
||||
{
|
||||
mAliasList = new ArrayList<AliasList>();
|
||||
mAliasList = new ArrayList<AliasListOld>();
|
||||
}
|
||||
}
|
||||
|
||||
public void addAliasList( AliasList list )
|
||||
public void addAliasList( AliasListOld list )
|
||||
{
|
||||
mAliasList.add( list );
|
||||
}
|
||||
|
||||
public void removeAliasList( AliasList list )
|
||||
public void removeAliasList( AliasListOld list )
|
||||
{
|
||||
mAliasList.remove( list );
|
||||
}
|
||||
@@ -75,11 +74,11 @@ public class AliasDirectory
|
||||
/**
|
||||
* Gets the named alias list, or returns an empty alias list
|
||||
*/
|
||||
public AliasList getAliasList( String name )
|
||||
public AliasListOld getAliasList( String name )
|
||||
{
|
||||
AliasList retVal = new AliasList();
|
||||
AliasListOld retVal = new AliasListOld( name );
|
||||
|
||||
for( AliasList list: mAliasList )
|
||||
for( AliasListOld list: mAliasList )
|
||||
{
|
||||
if( list.getName().equalsIgnoreCase( name ) )
|
||||
{
|
||||
583
src/playlist/version1/AliasListOld.java
Normal file
583
src/playlist/version1/AliasListOld.java
Normal file
@@ -0,0 +1,583 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 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 playlist.version1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import module.decode.lj1200.LJ1200Message.Function;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.action.AliasAction;
|
||||
import alias.action.beep.BeepAction;
|
||||
import alias.action.clip.ClipAction;
|
||||
import alias.action.script.ScriptAction;
|
||||
import alias.id.AliasID;
|
||||
import alias.id.esn.Esn;
|
||||
import alias.id.fleetsync.FleetsyncID;
|
||||
import alias.id.lojack.LoJackFunctionAndID;
|
||||
import alias.id.mdc.MDC1200ID;
|
||||
import alias.id.mobileID.Min;
|
||||
import alias.id.mpt1327.MPT1327ID;
|
||||
import alias.id.nonrecordable.NonRecordable;
|
||||
import alias.id.priority.Priority;
|
||||
import alias.id.siteID.SiteID;
|
||||
import alias.id.status.StatusID;
|
||||
import alias.id.talkgroup.TalkgroupID;
|
||||
import alias.id.uniqueID.UniqueID;
|
||||
import audio.metadata.MetadataType;
|
||||
|
||||
@XmlSeeAlso( { Alias.class,
|
||||
|
||||
/* Alias ID's */
|
||||
AliasID.class,
|
||||
FleetsyncID.class,
|
||||
Esn.class,
|
||||
Group.class,
|
||||
LoJackFunctionAndID.class,
|
||||
MDC1200ID.class,
|
||||
Min.class,
|
||||
MPT1327ID.class,
|
||||
UniqueID.class,
|
||||
SiteID.class,
|
||||
StatusID.class,
|
||||
TalkgroupID.class,
|
||||
|
||||
/* Alias Attributes */
|
||||
NonRecordable.class,
|
||||
Priority.class,
|
||||
|
||||
/* Alias Actions */
|
||||
AliasAction.class,
|
||||
BeepAction.class,
|
||||
ClipAction.class,
|
||||
ScriptAction.class } )
|
||||
|
||||
@Deprecated
|
||||
@XmlRootElement( name = "alias_list" )
|
||||
public class AliasListOld implements Comparable<AliasListOld>
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( AliasListOld.class );
|
||||
|
||||
private String mName;
|
||||
private ArrayList<Group> mGroups = new ArrayList<Group>();
|
||||
|
||||
private Map<String,Alias> mESN = new HashMap<>();
|
||||
private Map<String,Alias> mFleetsync = new HashMap<>();
|
||||
private Map<LoJackFunctionAndID,Alias> mLoJack = new HashMap<>();
|
||||
private Map<String,Alias> mMDC1200 = new HashMap<>();
|
||||
private Map<String,Alias> mMobileID = new HashMap<>();
|
||||
private Map<String,Alias> mMPT1327 = new HashMap<>();
|
||||
private Map<String, Alias> mSiteID = new HashMap<>();
|
||||
private Map<Integer, Alias> mStatus = new HashMap<>();
|
||||
private Map<String,Alias> mTalkgroup = new HashMap<>();
|
||||
private Map<Integer,Alias> mUniqueID = new HashMap<>();
|
||||
|
||||
private boolean mESNWildcard = false;
|
||||
private boolean mMobileIDWildcard = false;
|
||||
private boolean mFleetsyncWildcard = false;
|
||||
private boolean mMDC1200Wildcard = false;
|
||||
private boolean mMPT1327Wildcard = false;
|
||||
private boolean mSiteWildcard = false;
|
||||
private boolean mTalkgroupWildcard = false;
|
||||
|
||||
public AliasListOld()
|
||||
{
|
||||
this( null );
|
||||
}
|
||||
|
||||
public AliasListOld( String name )
|
||||
{
|
||||
mName = name;
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load/Reload all lookup hashmaps
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
//Clear hashmaps
|
||||
mESN.clear();
|
||||
mFleetsync.clear();
|
||||
mLoJack.clear();
|
||||
mMDC1200.clear();
|
||||
mMobileID.clear();
|
||||
mMPT1327.clear();
|
||||
mSiteID.clear();
|
||||
mStatus.clear();
|
||||
mTalkgroup.clear();
|
||||
mUniqueID.clear();
|
||||
|
||||
for( Group group: mGroups )
|
||||
{
|
||||
for( Alias alias: group.getAlias() )
|
||||
{
|
||||
for( AliasID id: alias.getId() )
|
||||
{
|
||||
switch( id.getType() )
|
||||
{
|
||||
case ESN:
|
||||
Esn esn = (Esn)id;
|
||||
if( esn.getEsn().contains( "*" ) )
|
||||
{
|
||||
mESNWildcard = true;
|
||||
|
||||
mESN.put( fixWildcard( esn.getEsn() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mESN.put( esn.getEsn(), alias );
|
||||
}
|
||||
break;
|
||||
case Fleetsync:
|
||||
FleetsyncID fs = (FleetsyncID)id;
|
||||
|
||||
if( fs.getIdent().contains( "*" ) )
|
||||
{
|
||||
mFleetsyncWildcard = true;
|
||||
|
||||
mFleetsync.put( fixWildcard( fs.getIdent() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mFleetsync.put( fs.getIdent(), alias );
|
||||
}
|
||||
break;
|
||||
case LoJack:
|
||||
mLoJack.put( (LoJackFunctionAndID)id, alias );
|
||||
break;
|
||||
case MDC1200:
|
||||
MDC1200ID mdc = (MDC1200ID)id;
|
||||
|
||||
if( mdc.getIdent().contains( "*" ) )
|
||||
{
|
||||
mMDC1200Wildcard = true;
|
||||
|
||||
//Replace (*) wildcard with regex wildcard (.)
|
||||
mMDC1200.put( fixWildcard( mdc.getIdent() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMDC1200.put( mdc.getIdent(), alias );
|
||||
}
|
||||
break;
|
||||
case MPT1327:
|
||||
MPT1327ID mpt = (MPT1327ID)id;
|
||||
|
||||
String ident = mpt.getIdent();
|
||||
|
||||
if( ident != null )
|
||||
{
|
||||
if( ident.contains( "*" ) )
|
||||
{
|
||||
mMPT1327Wildcard = true;
|
||||
|
||||
//Replace (*) wildcard with regex wildcard (.)
|
||||
mMPT1327.put( fixWildcard( ident ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMPT1327.put( ident, alias );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MIN:
|
||||
Min min = (Min)id;
|
||||
|
||||
if( min.getMin().contains( "*" ) )
|
||||
{
|
||||
mMobileIDWildcard = true;
|
||||
mMobileID.put( fixWildcard( min.getMin() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMobileID.put( min.getMin(), alias );
|
||||
}
|
||||
break;
|
||||
case LTRNetUID:
|
||||
UniqueID uid = (UniqueID)id;
|
||||
|
||||
mUniqueID.put( uid.getUid(), alias );
|
||||
break;
|
||||
case Site:
|
||||
SiteID siteID = (SiteID)id;
|
||||
|
||||
if( siteID.getSite().contains( "*" ) )
|
||||
{
|
||||
mSiteWildcard = true;
|
||||
mSiteID.put( fixWildcard( siteID.getSite() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mSiteID.put( siteID.getSite(), alias );
|
||||
}
|
||||
|
||||
break;
|
||||
case Status:
|
||||
mStatus.put( ((StatusID)id).getStatus(), alias );
|
||||
break;
|
||||
case Talkgroup:
|
||||
TalkgroupID tgid = (TalkgroupID)id;
|
||||
|
||||
if( tgid.getTalkgroup().contains( "*" ) )
|
||||
{
|
||||
mTalkgroupWildcard = true;
|
||||
|
||||
//Replace (*) wildcard with regex wildcard (.)
|
||||
mTalkgroup.put( fixWildcard( tgid.getTalkgroup() ), alias );
|
||||
}
|
||||
else
|
||||
{
|
||||
mTalkgroup.put( tgid.getTalkgroup(), alias );
|
||||
}
|
||||
break;
|
||||
case NonRecordable:
|
||||
case Priority:
|
||||
//We don't maintain lookups for these items
|
||||
break;
|
||||
default:
|
||||
mLog.warn( "Unrecognized Alias ID Type:" + id.getType().name() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts user wildcard character (*) to regex single character wildcard (.)
|
||||
* but ignores a regex multi-character wildcard (.*)
|
||||
*/
|
||||
private String fixWildcard( String value )
|
||||
{
|
||||
if( value.contains( "*" ) && !value.contains( ".*" ) )
|
||||
{
|
||||
return value.replace( "*", "." );
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public Alias getSiteID( String siteID )
|
||||
{
|
||||
if( siteID != null )
|
||||
{
|
||||
if( mSiteWildcard )
|
||||
{
|
||||
for( String regex: mSiteID.keySet() )
|
||||
{
|
||||
if( siteID.matches( regex ) )
|
||||
{
|
||||
return mSiteID.get( regex );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mSiteID.get( siteID );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Alias getStatus( int status )
|
||||
{
|
||||
return mStatus.get( status );
|
||||
}
|
||||
|
||||
public Alias getUniqueID( int uniqueID )
|
||||
{
|
||||
return mUniqueID.get( uniqueID );
|
||||
}
|
||||
|
||||
public Alias getESNAlias( String esn )
|
||||
{
|
||||
if( esn != null )
|
||||
{
|
||||
if( mESNWildcard )
|
||||
{
|
||||
for( String regex: mESN.keySet() )
|
||||
{
|
||||
if( esn.matches( regex ) )
|
||||
{
|
||||
return mESN.get( regex );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mESN.get( esn );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Alias getFleetsyncAlias( String ident )
|
||||
{
|
||||
if( ident != null )
|
||||
{
|
||||
if( mFleetsyncWildcard )
|
||||
{
|
||||
for( String regex: mFleetsync.keySet() )
|
||||
{
|
||||
if( ident.matches( regex ) )
|
||||
{
|
||||
return mFleetsync.get( regex );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mFleetsync.get( ident );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Alias getLoJackAlias( Function function, String id )
|
||||
{
|
||||
if( id != null )
|
||||
{
|
||||
for( LoJackFunctionAndID lojack: mLoJack.keySet() )
|
||||
{
|
||||
if( lojack.matches( function, id ) )
|
||||
{
|
||||
return mLoJack.get( lojack );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Alias getMDC1200Alias( String ident )
|
||||
{
|
||||
if( ident != null )
|
||||
{
|
||||
if( mMDC1200Wildcard )
|
||||
{
|
||||
for( String regex: mMDC1200.keySet() )
|
||||
{
|
||||
if( ident.matches( regex ) )
|
||||
{
|
||||
return mMDC1200.get( regex );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mMDC1200.get( ident );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Alias getMPT1327Alias( String ident )
|
||||
{
|
||||
if( ident != null )
|
||||
{
|
||||
if( mMPT1327Wildcard )
|
||||
{
|
||||
for( String regex: mMPT1327.keySet() )
|
||||
{
|
||||
if( ident.matches( regex ) )
|
||||
{
|
||||
return mMPT1327.get( regex );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mMPT1327.get( ident );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Group getGroup( Alias alias )
|
||||
{
|
||||
if( alias != null )
|
||||
{
|
||||
for( Group group: mGroups )
|
||||
{
|
||||
if( group.contains( alias ) )
|
||||
{
|
||||
return group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Alias getMobileIDNumberAlias( String ident )
|
||||
{
|
||||
if( ident != null )
|
||||
{
|
||||
if( mMobileIDWildcard )
|
||||
{
|
||||
for( String regex: mMobileID.keySet() )
|
||||
{
|
||||
if( ident.matches( regex ) )
|
||||
{
|
||||
return mMobileID.get( regex );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mMobileID.get( ident );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Alias getTalkgroupAlias( String tgid )
|
||||
{
|
||||
if( tgid != null )
|
||||
{
|
||||
if( mTalkgroupWildcard )
|
||||
{
|
||||
for( String regex: mTalkgroup.keySet() )
|
||||
{
|
||||
if( tgid.matches( regex ) )
|
||||
{
|
||||
return mTalkgroup.get( regex );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return mTalkgroup.get( tgid );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public String getName()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
public void setName( String name )
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
|
||||
public ArrayList<Group> getGroup()
|
||||
{
|
||||
return mGroups;
|
||||
}
|
||||
|
||||
public void setGroup( ArrayList<Group> groups )
|
||||
{
|
||||
mGroups = groups;
|
||||
}
|
||||
|
||||
public void addGroup( Group group )
|
||||
{
|
||||
mGroups.add( group );
|
||||
}
|
||||
|
||||
public void removeGroup( Group group )
|
||||
{
|
||||
mGroups.remove( group );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( AliasListOld otherAliasList )
|
||||
{
|
||||
return getName().compareTo( otherAliasList.getName() );
|
||||
}
|
||||
|
||||
public Alias getAlias( String value, MetadataType type )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case ESN:
|
||||
return getESNAlias( value );
|
||||
case FLEETSYNC:
|
||||
return getFleetsyncAlias( value );
|
||||
case MDC1200:
|
||||
return getMDC1200Alias( value );
|
||||
case MOBILE_ID:
|
||||
return getMobileIDNumberAlias( value );
|
||||
case MPT1327:
|
||||
return getMPT1327Alias( value );
|
||||
case SITE_ID:
|
||||
return getSiteID( value );
|
||||
case STATUS:
|
||||
if( value != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
return getStatus( Integer.valueOf( value ) );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
//do nothing, we couldn't parse the int value
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FROM:
|
||||
case TO:
|
||||
return getTalkgroupAlias( value );
|
||||
case UNIQUE_ID:
|
||||
if( value != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
return getUniqueID( Integer.valueOf( value ) );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
//do nothing, we couldn't parse the int value
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,14 +15,17 @@
|
||||
* 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 controller.channel.map;
|
||||
package playlist.version1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import controller.channel.map.ChannelMap;
|
||||
|
||||
@XmlSeeAlso( ChannelMap.class )
|
||||
@Deprecated
|
||||
public class ChannelMapList
|
||||
{
|
||||
private ArrayList<ChannelMap> mChannelMap = new ArrayList<ChannelMap>();
|
||||
@@ -15,12 +15,15 @@
|
||||
* 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 playlist.version1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
import alias.Alias;
|
||||
|
||||
@Deprecated
|
||||
public class Group
|
||||
{
|
||||
private String mName;
|
||||
168
src/playlist/version1/PlaylistConverterV1ToV2.java
Normal file
168
src/playlist/version1/PlaylistConverterV1ToV2.java
Normal file
@@ -0,0 +1,168 @@
|
||||
package playlist.version1;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.PlaylistV2;
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.map.ChannelMap;
|
||||
|
||||
public class PlaylistConverterV1ToV2
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( PlaylistConverterV1ToV2.class );
|
||||
|
||||
private PlaylistV2 mConvertedPlaylist;
|
||||
private List<String> mErrors = new ArrayList<>();
|
||||
|
||||
public PlaylistConverterV1ToV2( Path path )
|
||||
{
|
||||
PlaylistV1 playlistVersion1 = null;
|
||||
|
||||
if( path != null && Files.exists( path ) )
|
||||
{
|
||||
mLog.info( "attempting playlist v1 to v2 conversion [" +
|
||||
path.toString() + "]" );
|
||||
|
||||
JAXBContext context = null;
|
||||
|
||||
InputStream in = null;
|
||||
|
||||
try
|
||||
{
|
||||
in = new FileInputStream( path.toString() );
|
||||
|
||||
try
|
||||
{
|
||||
context = JAXBContext.newInstance( PlaylistV1.class );
|
||||
|
||||
Unmarshaller m = context.createUnmarshaller();
|
||||
|
||||
playlistVersion1 = (PlaylistV1)m.unmarshal( in );
|
||||
}
|
||||
catch ( JAXBException e )
|
||||
{
|
||||
mErrors.add( "Couldn't unmarshall version 1 playlist - " +
|
||||
e.getLocalizedMessage() );
|
||||
}
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
mErrors.add( "Couldn't open version 1 playlist - [" +
|
||||
path.toString() + "] - " + e.getLocalizedMessage() );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if( in != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
mLog.error( "exception while closing " +
|
||||
"the playlist file inputstream reader", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mErrors.add( "version 1 playlist is null or not found [" +
|
||||
path.toString() + "]" );
|
||||
}
|
||||
|
||||
if( playlistVersion1 != null )
|
||||
{
|
||||
mConvertedPlaylist = new PlaylistV2();
|
||||
|
||||
if( playlistVersion1.hasSystemList() )
|
||||
{
|
||||
SystemList systemList = playlistVersion1.getSystemList();
|
||||
|
||||
for( playlist.version1.System system: systemList.getSystem() )
|
||||
{
|
||||
for( Site site: system.getSite() )
|
||||
{
|
||||
for( Channel channel: site.getChannel() )
|
||||
{
|
||||
channel.setSystem( system.getName() );
|
||||
channel.setSite( site.getName() );
|
||||
|
||||
mConvertedPlaylist.getChannels().add( channel );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( playlistVersion1.hasAliasDirectory() )
|
||||
{
|
||||
AliasDirectory aliasDirectory = playlistVersion1.getAliasDirectory();
|
||||
|
||||
for( AliasListOld list: aliasDirectory.getAliasList() )
|
||||
{
|
||||
for( Group group: list.getGroup() )
|
||||
{
|
||||
for( Alias alias: group.getAlias() )
|
||||
{
|
||||
alias.setList( list.getName() );
|
||||
alias.setGroup( group.getName() );
|
||||
|
||||
mConvertedPlaylist.getAliases().add( alias );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( playlistVersion1.hasChannelMapList() )
|
||||
{
|
||||
//Move the channel maps out of the channel map list
|
||||
ChannelMapList channelMapList = playlistVersion1.getChannelMapList();
|
||||
|
||||
List<ChannelMap> channelMaps = channelMapList.getChannelMap();
|
||||
|
||||
if( channelMaps != null && !channelMaps.isEmpty() )
|
||||
{
|
||||
mConvertedPlaylist.getChannelMaps().addAll( channelMaps );
|
||||
}
|
||||
}
|
||||
|
||||
mLog.info( "Converted [" + mConvertedPlaylist.getChannels().size() +
|
||||
"] channels to new playlist format" );
|
||||
mLog.info( "Converted [" + mConvertedPlaylist.getAliases().size() +
|
||||
"] aliases to new playlist format" );
|
||||
mLog.info( "Converted [" + mConvertedPlaylist.getChannelMaps().size() +
|
||||
"] channel maps to new playlist format" );
|
||||
}
|
||||
}
|
||||
|
||||
public PlaylistV2 getConvertedPlaylist()
|
||||
{
|
||||
return mConvertedPlaylist;
|
||||
}
|
||||
|
||||
public List<String> getErrorMessages()
|
||||
{
|
||||
return mErrors;
|
||||
}
|
||||
|
||||
public boolean hasErrorMessages()
|
||||
{
|
||||
return !mErrors.isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -15,20 +15,14 @@
|
||||
* 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 playlist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
package playlist.version1;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasDirectory;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.map.ChannelMapList;
|
||||
import controller.system.SystemList;
|
||||
|
||||
@XmlSeeAlso( { AliasDirectory.class,
|
||||
Alias.class,
|
||||
@@ -36,41 +30,19 @@ import controller.system.SystemList;
|
||||
ChannelMapList.class,
|
||||
SystemList.class } )
|
||||
|
||||
@Deprecated
|
||||
@XmlRootElement( name = "playlist" )
|
||||
public class Playlist
|
||||
public class PlaylistV1
|
||||
{
|
||||
//Note: these are for legacy version 1 format playlists
|
||||
private AliasDirectory mAliasDirectory = new AliasDirectory();
|
||||
private ChannelMapList mChannelMapList = new ChannelMapList();
|
||||
private SystemList mSystemList = new SystemList();
|
||||
private List<Alias> mAliases = new ArrayList<>();
|
||||
private List<Channel> mChannels = new ArrayList<>();
|
||||
|
||||
public Playlist()
|
||||
|
||||
public PlaylistV1()
|
||||
{
|
||||
}
|
||||
|
||||
@XmlElement( name = "alias" )
|
||||
public List<Alias> getAliases()
|
||||
{
|
||||
return mAliases;
|
||||
}
|
||||
|
||||
public void setAliases( List<Alias> aliases )
|
||||
{
|
||||
mAliases = aliases;
|
||||
}
|
||||
|
||||
@XmlElement( name = "channel" )
|
||||
public List<Channel> getChannels()
|
||||
{
|
||||
return mChannels;
|
||||
}
|
||||
|
||||
public void setChannels( List<Channel> channels )
|
||||
{
|
||||
mChannels = channels;
|
||||
}
|
||||
|
||||
@XmlElement( name = "alias_directory" )
|
||||
public AliasDirectory getAliasDirectory()
|
||||
{
|
||||
@@ -79,6 +51,7 @@ public class Playlist
|
||||
return mAliasDirectory;
|
||||
}
|
||||
|
||||
|
||||
public void setAliasDirectory( AliasDirectory directory )
|
||||
{
|
||||
mAliasDirectory = directory;
|
||||
@@ -90,6 +63,7 @@ public class Playlist
|
||||
mAliasDirectory.getAliasList() != null &&
|
||||
!mAliasDirectory.getAliasList().isEmpty();
|
||||
}
|
||||
|
||||
|
||||
@XmlElement( name = "system_list" )
|
||||
public SystemList getSystemList()
|
||||
@@ -97,6 +71,7 @@ public class Playlist
|
||||
return mSystemList;
|
||||
}
|
||||
|
||||
|
||||
public void setSystemList( SystemList list )
|
||||
{
|
||||
mSystemList = list;
|
||||
@@ -109,12 +84,21 @@ public class Playlist
|
||||
!mSystemList.getSystem().isEmpty();
|
||||
}
|
||||
|
||||
|
||||
@XmlElement( name = "channel_maps" )
|
||||
public ChannelMapList getChannelMapList()
|
||||
{
|
||||
return mChannelMapList;
|
||||
}
|
||||
|
||||
public boolean hasChannelMapList()
|
||||
{
|
||||
return mChannelMapList != null &&
|
||||
mChannelMapList.getChannelMap() != null &&
|
||||
!mChannelMapList.getChannelMap().isEmpty();
|
||||
}
|
||||
|
||||
|
||||
public void setChannelMapList( ChannelMapList list )
|
||||
{
|
||||
mChannelMapList = list;
|
||||
@@ -15,7 +15,7 @@
|
||||
* 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 controller.site;
|
||||
package playlist.version1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -27,6 +27,7 @@ import controller.channel.Channel;
|
||||
|
||||
@XmlSeeAlso( { Channel.class } )
|
||||
@XmlRootElement( name = "site" )
|
||||
@Deprecated
|
||||
public class Site
|
||||
{
|
||||
private String mName;
|
||||
@@ -15,7 +15,7 @@
|
||||
* 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 controller.system;
|
||||
package playlist.version1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -23,10 +23,9 @@ import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import controller.site.Site;
|
||||
|
||||
@XmlSeeAlso( { Site.class } )
|
||||
@XmlRootElement( name = "system" )
|
||||
@Deprecated
|
||||
public class System
|
||||
{
|
||||
private String mName;
|
||||
@@ -15,16 +15,17 @@
|
||||
* 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 controller.system;
|
||||
package playlist.version1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
@XmlSeeAlso( { controller.system.System.class } )
|
||||
@XmlSeeAlso( { playlist.version1.System.class } )
|
||||
|
||||
@XmlRootElement( name = "system_list" )
|
||||
@Deprecated
|
||||
public class SystemList
|
||||
{
|
||||
private ArrayList<System> mSystem = new ArrayList<System>();
|
||||
@@ -51,12 +51,10 @@ public class TunerNode extends BaseNode implements IFrequencyChangeProcessor
|
||||
private int mSampleRate;
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private SettingsManager mSettingsManager;
|
||||
|
||||
public TunerNode( ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
Tuner tuner )
|
||||
{
|
||||
@@ -64,7 +62,6 @@ public class TunerNode extends BaseNode implements IFrequencyChangeProcessor
|
||||
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mPlaylistManager = playlistManager;
|
||||
mSettingsManager = settingsManager;
|
||||
|
||||
tuner.addFrequencyChangeProcessor( this );
|
||||
@@ -130,8 +127,7 @@ public class TunerNode extends BaseNode implements IFrequencyChangeProcessor
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
SpectrumFrame frame = new SpectrumFrame( getModel(), mChannelModel,
|
||||
mChannelProcessingManager, mPlaylistManager,
|
||||
mSettingsManager, getTuner() );
|
||||
mChannelProcessingManager, mSettingsManager, getTuner() );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
||||
* Copyright (C) 2014-2016 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
|
||||
@@ -53,7 +53,6 @@ import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import properties.SystemProperties;
|
||||
import sample.Listener;
|
||||
import sample.SampleType;
|
||||
@@ -118,7 +117,6 @@ public class SpectralDisplayPanel extends JPanel
|
||||
private ConfigurationControllerModel mControllerModel;
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private PlaylistManager mPlaylistManager;
|
||||
private SettingsManager mSettingsManager;
|
||||
private Tuner mTuner;
|
||||
|
||||
@@ -137,13 +135,11 @@ public class SpectralDisplayPanel extends JPanel
|
||||
public SpectralDisplayPanel( ConfigurationControllerModel controllerModel,
|
||||
ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager )
|
||||
{
|
||||
mControllerModel = controllerModel;
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mPlaylistManager = playlistManager;
|
||||
mSettingsManager = settingsManager;
|
||||
|
||||
mSpectrumPanel = new SpectrumPanel( mSettingsManager );
|
||||
@@ -200,7 +196,6 @@ public class SpectralDisplayPanel extends JPanel
|
||||
}
|
||||
|
||||
mControllerModel = null;
|
||||
mPlaylistManager = null;
|
||||
mSettingsManager = null;
|
||||
|
||||
mDFTProcessor.dispose();
|
||||
@@ -657,7 +652,7 @@ public class SpectralDisplayPanel extends JPanel
|
||||
for( Channel channel: channels )
|
||||
{
|
||||
JMenu channelMenu = ChannelUtils.getContextMenu( mChannelModel,
|
||||
mChannelProcessingManager, mPlaylistManager, channel,
|
||||
mChannelProcessingManager, channel,
|
||||
SpectralDisplayPanel.this );
|
||||
|
||||
if( channelMenu != null )
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.awt.event.WindowListener;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import playlist.PlaylistManager;
|
||||
import settings.SettingsManager;
|
||||
import source.tuner.Tuner;
|
||||
import controller.ConfigurationControllerModel;
|
||||
@@ -40,7 +39,6 @@ public class SpectrumFrame extends JFrame implements WindowListener
|
||||
public SpectrumFrame( ConfigurationControllerModel controllerModel,
|
||||
ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
PlaylistManager playlistManager,
|
||||
SettingsManager settingsManager,
|
||||
Tuner tuner )
|
||||
{
|
||||
@@ -51,7 +49,7 @@ public class SpectrumFrame extends JFrame implements WindowListener
|
||||
setLayout( new MigLayout( "insets 0 0 0 0", "[grow]", "[grow]") );
|
||||
|
||||
mSpectralDisplayPanel = new SpectralDisplayPanel( controllerModel,
|
||||
channelModel, channelProcessingManager, playlistManager, settingsManager );
|
||||
channelModel, channelProcessingManager, settingsManager );
|
||||
|
||||
mSpectralDisplayPanel.tunerSelected( tuner );
|
||||
add( mSpectralDisplayPanel, "grow" );
|
||||
|
||||
Reference in New Issue
Block a user