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:
denny
2016-03-06 07:48:14 -05:00
parent 8aebdd1c26
commit 2394ac2fa9
75 changed files with 2154 additions and 5008 deletions

View File

@@ -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;

View File

@@ -1,36 +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;
import playlist.PlaylistManager;
import controller.ConfigurableNode;
public class AliasIDNode extends ConfigurableNode
{
private static final long serialVersionUID = 1L;
public AliasIDNode( PlaylistManager playlistManager, AliasID id )
{
super( playlistManager, id );
}
public void save()
{
getPlaylistManager().save();
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}