mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user