Work in progress - updates to alias and alias ID editors.

This commit is contained in:
denny
2016-02-21 20:02:27 -05:00
parent bd09911e68
commit e5004f9fa6
44 changed files with 1331 additions and 945 deletions

View File

@@ -0,0 +1,25 @@
package alias.id.nonrecordable;
import alias.AliasID;
import alias.AliasIDType;
public class NonRecordable extends AliasID
{
@Override
public AliasIDType getType()
{
return AliasIDType.NonRecordable;
}
@Override
public boolean matches( AliasID id )
{
return false;
}
@Override
public String toString()
{
return "Non-Recordable";
}
}

View File

@@ -0,0 +1,62 @@
/*******************************************************************************
* 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 alias.id.nonrecordable;
import javax.swing.JTextArea;
import net.miginfocom.swing.MigLayout;
import alias.AliasID;
import alias.ComponentEditor;
public class NonRecordableEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private static final String HELP_TEXT = "This identifies an alias as "
+ "non-recordable. The alias can still be monitored but it will "
+ "not be recorded when recording is enabled for the decoding channel.";
public NonRecordableEditor( AliasID aliasID )
{
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 1", "[]", "[][grow]" ) );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
@Override
public void setComponent( AliasID aliasID )
{
}
@Override
public void save()
{
}
}

View File

@@ -0,0 +1,89 @@
/*******************************************************************************
* 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.AliasID;
import alias.AliasIDNode;
import alias.AliasNode;
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;
}
}