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

@@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import alias.action.AliasAction;
import alias.priority.Priority;
import alias.id.priority.Priority;
@XmlSeeAlso( { AliasID.class, AliasAction.class } )
@XmlRootElement( name = "alias" )

View File

@@ -91,7 +91,7 @@ public class AliasEditor extends JPanel implements ActionListener, Listener<Alia
tabs.setForeground( Color.BLACK );
tabs.addTab( "Alias", mAliasNameEditor );
tabs.addTab( "IDs", mAliasIdentifierEditor );
tabs.addTab( "Identifiers", mAliasIdentifierEditor );
add( tabs, "span,grow" );
JButton btnSave = new JButton( "Save" );

View File

@@ -4,17 +4,29 @@ import alias.action.AliasAction;
import alias.action.beep.BeepAction;
import alias.action.clip.ClipAction;
import alias.action.script.ScriptAction;
import alias.id.esn.ESNEditor;
import alias.id.esn.Esn;
import alias.id.fleetsync.FleetsyncID;
import alias.id.fleetsync.FleetsyncIDEditor;
import alias.id.lojack.LoJackIDEditor;
import alias.id.lojack.LoJackFunctionAndID;
import alias.id.mdc.MDC1200IDEditor;
import alias.id.mdc.MDC1200ID;
import alias.id.mobileID.MINEditor;
import alias.id.mobileID.Min;
import alias.id.mpt1327.MPT1327ID;
import alias.id.mpt1327.MPT1327IDEditor;
import alias.id.nonrecordable.NonRecordable;
import alias.id.nonrecordable.NonRecordableEditor;
import alias.id.priority.Priority;
import alias.id.priority.PriorityEditor;
import alias.id.siteID.SiteIDEditor;
import alias.id.siteID.SiteID;
import alias.id.status.StatusIDEditor;
import alias.id.talkgroup.TalkgroupID;
import alias.id.talkgroup.TalkgroupIDEditor;
import alias.id.uniqueID.UniqueID;
import alias.priority.Priority;
import alias.record.NonRecordable;
import alias.id.uniqueID.UniqueIDEditor;
public class AliasFactory
{
@@ -135,4 +147,62 @@ public class AliasFactory
return copy;
}
public static ComponentEditor<AliasID> getEditor( AliasID aliasID )
{
if( aliasID != null )
{
switch( aliasID.getType() )
{
case ESN:
return new ESNEditor( aliasID );
case Fleetsync:
return new FleetsyncIDEditor( aliasID );
case LTRNetUID:
return new UniqueIDEditor( aliasID );
case LoJack:
return new LoJackIDEditor( aliasID );
case MDC1200:
return new MDC1200IDEditor( aliasID );
case MIN:
return new MINEditor( aliasID );
case MPT1327:
return new MPT1327IDEditor( aliasID );
case NonRecordable:
return new NonRecordableEditor( aliasID );
case Priority:
return new PriorityEditor( aliasID );
case Site:
return new SiteIDEditor( aliasID );
case Status:
return new StatusIDEditor( aliasID );
case Talkgroup:
return new TalkgroupIDEditor( aliasID );
default:
break;
}
}
return new EmptyAliasIDEditor();
}
public static ComponentEditor<AliasAction> getEditor( AliasAction aliasAction )
{
if( aliasAction != null )
{
if( aliasAction instanceof BeepAction )
{
}
else if( aliasAction instanceof ClipAction )
{
}
else if( aliasAction instanceof ScriptAction )
{
}
}
return new EmptyAliasActionEditor();
}
}

View File

@@ -22,16 +22,16 @@ import javax.xml.bind.annotation.XmlSeeAlso;
import alias.id.esn.Esn;
import alias.id.fleetsync.FleetsyncID;
import alias.id.fleetsync.StatusID;
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 alias.priority.Priority;
import alias.record.NonRecordable;
@XmlSeeAlso( { Esn.class, FleetsyncID.class, Group.class, LoJackFunctionAndID.class,
MDC1200ID.class, Min.class, MPT1327ID.class, NonRecordable.class,

View File

@@ -7,18 +7,28 @@ import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AliasIdentifierEditor extends AliasConfigurationEditor
{
private static final long serialVersionUID = 1L;
private final static Logger mLog = LoggerFactory.getLogger( AliasIdentifierEditor.class );
private static ListModel<AliasID> EMPTY_MODEL = new DefaultListModel<>();
private JList<AliasID> mAliasIDList = new JList<>( EMPTY_MODEL );
private EditorContainer mEditorContainer = new EditorContainer();
private Alias mAlias;
@@ -30,14 +40,36 @@ public class AliasIdentifierEditor extends AliasConfigurationEditor
private void init()
{
setLayout( new MigLayout( "fill,wrap 3",
"[grow,fill][grow,fill][grow,fill]", "[grow,fill][][grow,fill]" ) );
"[grow,fill][grow,fill][grow,fill]", "[][grow,fill][]" ) );
mAliasIDList.setVisibleRowCount( 6 );
mAliasIDList.setVisibleRowCount( 4 );
mAliasIDList.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
mAliasIDList.setLayoutOrientation( JList.VERTICAL );
mAliasIDList.addListSelectionListener( new ListSelectionListener()
{
@Override
public void valueChanged( ListSelectionEvent event )
{
if( !event.getValueIsAdjusting() )
{
JList<?> list = (JList<?>)event.getSource();
Object selectedItem = list.getSelectedValue();
if( selectedItem != null && selectedItem instanceof AliasID )
{
AliasID selected = (AliasID)selectedItem;
mEditorContainer.setAliasID( selected );
}
}
}
} );
JScrollPane scroller = new JScrollPane( mAliasIDList );
add( scroller, "span,grow" );
add( mEditorContainer, "span,grow" );
add( new JButton( "New" ) );
add( new JButton( "Copy" ) );
@@ -75,6 +107,8 @@ public class AliasIdentifierEditor extends AliasConfigurationEditor
mAliasIDList.setModel( model );
}
mEditorContainer.setAliasID( null );
}
@Override
@@ -83,4 +117,46 @@ public class AliasIdentifierEditor extends AliasConfigurationEditor
// TODO Auto-generated method stub
}
public class EditorContainer extends JPanel
{
private static final long serialVersionUID = 1L;
private ComponentEditor<AliasID> mEditor = new EmptyAliasIDEditor();
public EditorContainer()
{
setLayout( new MigLayout( "","[grow,fill]", "[grow,fill]" ) );
add( mEditor );
}
public void setAliasID( AliasID aliasID )
{
if( mEditor != null )
{
if( mEditor.isModified() )
{
int option = JOptionPane.showConfirmDialog(
EditorContainer.this,
"Identifier settings have changed. Do you want to save these changes?",
"Save Changes?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE );
if( option == JOptionPane.YES_OPTION )
{
mEditor.save();
}
}
}
removeAll();
mEditor = AliasFactory.getEditor( aliasID );
add( mEditor );
revalidate();
}
}
}

View File

@@ -36,16 +36,16 @@ import alias.action.clip.ClipAction;
import alias.action.script.ScriptAction;
import alias.id.esn.Esn;
import alias.id.fleetsync.FleetsyncID;
import alias.id.fleetsync.StatusID;
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 alias.priority.Priority;
import alias.record.NonRecordable;
import audio.metadata.MetadataType;
@XmlSeeAlso( { Alias.class,

View File

@@ -50,6 +50,10 @@ public class AliasNameEditor extends AliasConfigurationEditor
setLayout( new MigLayout( "fill,wrap 2", "[right][grow,fill]",
"[][][][][][][grow]" ) );
add( new JLabel( "Name:" ) );
mName = new JTextField();
add( mName, "wrap" );
add( new JLabel( "List:" ) );
mListCombo.setEditable( true );
mListCombo.addActionListener( new ActionListener()
@@ -80,10 +84,6 @@ public class AliasNameEditor extends AliasConfigurationEditor
mGroupCombo.setEditable( true );
add( mGroupCombo, "wrap" );
add( new JLabel( "Name:" ) );
mName = new JTextField();
add( mName, "wrap" );
add( new JLabel( "Color:" ) );
mButtonColor = new JButton( "Select ..." );

View File

@@ -40,8 +40,6 @@ import alias.id.esn.ESNNode;
import alias.id.esn.Esn;
import alias.id.fleetsync.FleetsyncID;
import alias.id.fleetsync.FleetsyncIDNode;
import alias.id.fleetsync.StatusID;
import alias.id.fleetsync.StatusIDNode;
import alias.id.lojack.LoJackFunctionAndID;
import alias.id.lojack.LoJackIDNode;
import alias.id.mdc.MDC1200ID;
@@ -50,16 +48,18 @@ 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 alias.priority.Priority;
import alias.priority.PriorityNode;
import alias.record.NonRecordable;
import alias.record.NonRecordableNode;
import controller.ConfigurableNode;
public class AliasNode extends ConfigurableNode

View File

@@ -0,0 +1,137 @@
/*******************************************************************************
* 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;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
public abstract class ComponentEditor<T> extends JPanel implements DocumentListener
{
private static final long serialVersionUID = 1L;
private boolean mModified;
private ComponentModificationListener mListener;
protected T mComponent;
/**
* Abstract class for editor with notifications when contents are modified
* and methods for saving or resetting the component values with the
* contents of the editor.
*/
public ComponentEditor( T component )
{
mComponent = component;
}
public ComponentEditor()
{
}
public void dispose()
{
mComponent = null;
mListener = null;
}
public T getComponent()
{
return mComponent;
}
protected void setModified( boolean modified )
{
mModified = modified;
if( modified && mListener != null )
{
mListener.componentModified();
}
}
/**
* Indicates if the contents of the editor have been modified
*/
public boolean isModified()
{
return mModified;
}
@Override
public void insertUpdate( DocumentEvent e )
{
setModified( true );
}
@Override
public void removeUpdate( DocumentEvent e )
{
setModified( true );
}
@Override
public void changedUpdate( DocumentEvent e ) { }
public void setComponentModificationListener( ComponentModificationListener listener )
{
mListener = listener;
}
/**
* Sets or resets the editable component
*/
public abstract void setComponent( T t );
/**
* Saves changed editor values to the component
*/
public abstract void save();
/**
* Reloads the editor contents from the source component and resets the
* modified flag
*/
public void reset()
{
setComponent( getComponent() );
}
/**
* Validate contents of other editors against this component editor before
* saving. Override this method to allow controller to pass other editors
* to this editor for content inspection/validation before indicating that
* this editor passes validation. This allows for validating editor contents
* that are contingent on settings in other editors.
*
* @throws ComponentValidationException if the contents of the editor
* argument cannot be validated, with the exception containing a detailed
* description of the issue.
*/
public void validate( ComponentEditor<?> editor ) throws ComponentValidationException
{
}
/**
* Listener interface to receive notification that the contents of the
* editor have been modified from the original component value and either
* need to be saved or reset
*/
public interface ComponentModificationListener
{
public void componentModified();
}
}

View File

@@ -0,0 +1,14 @@
package alias;
public class ComponentValidationException extends Exception
{
private static final long serialVersionUID = 1L;
/**
* Component editor contents validation error
*/
public ComponentValidationException( String message )
{
super( message );
}
}

View File

@@ -0,0 +1,32 @@
package alias;
import javax.swing.JLabel;
import net.miginfocom.swing.MigLayout;
import alias.action.AliasAction;
public class EmptyAliasActionEditor extends ComponentEditor<AliasAction>
{
private static final long serialVersionUID = 1L;
public EmptyAliasActionEditor()
{
setLayout( new MigLayout( "", "[center]", "[][grow]" ) );
add( new JLabel( "Please select an alias action" ), "wrap" );
}
@Override
public void setComponent( AliasAction t )
{
}
@Override
public void save()
{
}
@Override
public void reset()
{
}
}

View File

@@ -0,0 +1,31 @@
package alias;
import javax.swing.JLabel;
import net.miginfocom.swing.MigLayout;
public class EmptyAliasIDEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
public EmptyAliasIDEditor()
{
setLayout( new MigLayout( "", "[center]", "[][grow]" ) );
add( new JLabel( "Please select an identifier" ), "wrap" );
}
@Override
public void setComponent( AliasID t )
{
}
@Override
public void save()
{
}
@Override
public void reset()
{
}
}

View File

@@ -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
@@ -20,76 +20,86 @@ package alias.id.esn;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import net.miginfocom.swing.MigLayout;
import controller.ConfigurableNode;
import alias.AliasID;
import alias.ComponentEditor;
public class ESNEditor extends JPanel implements ActionListener
public class ESNEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private ESNNode mESNNode;
private JTextField mTextESN;
public ESNEditor( ESNNode esnNode )
private static final String HELP_TEXT = "An Electronic Serial Number (ESN)"
+ " is a unique radio hardware identifier normally composed of"
+ " hexadecimal (0-9,A-F) characters. Use an asterisk (*) to wildcard"
+ " individual digits (e.g. ABCD123* or AB**1**4)";
private JTextField mTextField;
public ESNEditor( AliasID aliasID )
{
mESNNode = esnNode;
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
add( new JLabel( "Electronic Serial Number ID" ), "span,align center" );
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
add( new JLabel( "ESN:" ) );
mTextESN = new JTextField( mESNNode.getESN().getEsn() );
add( mTextESN, "growx,push" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( ESNEditor.this );
add( btnSave, "growx,push" );
mTextField = new JTextField();
mTextField.getDocument().addDocumentListener( this );
add( mTextField, "growx,push" );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( ESNEditor.this );
add( btnReset, "growx,push" );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public Esn getEsn()
{
if( getComponent() instanceof Esn )
{
return (Esn)getComponent();
}
return null;
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
if( command.contentEquals( "Save" ) )
Esn esn = getEsn();
if( esn != null )
{
String esn = mTextESN.getText();
if( esn != null )
{
mESNNode.getESN().setEsn( esn );
((ConfigurableNode)mESNNode.getParent()).sort();
mESNNode.save();
mESNNode.show();
}
else
{
JOptionPane.showMessageDialog( ESNEditor.this, "Please enter an ESN" );
}
}
else if( command.contentEquals( "Reset" ) )
{
mTextESN.setText( mESNNode.getESN().getEsn() );
mTextField.setText( esn.getEsn() );
}
mESNNode.refresh();
}
setModified( false );
repaint();
}
@Override
public void save()
{
Esn esn = getEsn();
if( esn != null )
{
esn.setEsn( mTextField.getText() );
}
setModified( false );
}
}

View File

@@ -41,7 +41,7 @@ public class ESNNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new ESNEditor( this );
return null;
}
public Esn getESN()

View File

@@ -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
@@ -20,89 +20,107 @@ package alias.id.fleetsync;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.MaskFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import controller.channel.Channel;
import net.miginfocom.swing.MigLayout;
import controller.ConfigurableNode;
import alias.AliasID;
import alias.ComponentEditor;
public class FleetsyncIDEditor extends JPanel implements ActionListener
public class FleetsyncIDEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private FleetsyncIDNode mFleetsyncIDNode;
private JLabel mLabelName;
private JTextField mTextIdent;
private final static Logger mLog = LoggerFactory.getLogger( FleetsyncIDEditor.class );
private String mHelpText = "Enter a formatted fleetsync identifier.\n\n"
+ "Format: PPP-IIII (P=Prefix, I=Identifier)\n\n"
+ "Wildcard: use one or more asterisks (*) for any talkgroup "
+ "digits.\n\n";
private static final long serialVersionUID = 1L;
public FleetsyncIDEditor( FleetsyncIDNode fsNode )
private static final String HELP_TEXT = "A Fleetsync identifier is a"
+ " composite decimal [0-9] value formatted as ggg-uuuu where"
+ " g=Group and u=Unit.";
private JTextField mTextField;
public FleetsyncIDEditor( AliasID aliasID )
{
mFleetsyncIDNode = fsNode;
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
add( new JLabel( "Fleetsync ID" ), "span,align center" );
add( new JLabel( "Fleetsync ID:" ) );
add( new JLabel( "Ident:" ) );
mTextIdent = new JTextField( mFleetsyncIDNode.getFleetsyncID().getIdent() );
MaskFormatter formatter = null;
add( mTextIdent, "grow, wrap" );
try
{
//Mask: 3 digits - 4 digits
formatter = new MaskFormatter( "###-####" );
}
catch( Exception e )
{
//Do nothing, the mask was invalid
}
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( FleetsyncIDEditor.this );
add( btnSave, "growx,push" );
mTextField = new JFormattedTextField( formatter );
mTextField.getDocument().addDocumentListener( this );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( FleetsyncIDEditor.this );
add( btnReset, "growx,push" );
add( mTextField, "growx,push" );
JTextArea helpText = new JTextArea( mHelpText );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public FleetsyncID getFleetsyncID()
{
if( getComponent() instanceof FleetsyncID )
{
return (FleetsyncID)getComponent();
}
return null;
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
if( command.contentEquals( "Save" ) )
FleetsyncID fleetsync = getFleetsyncID();
if( fleetsync != null )
{
String ident = mTextIdent.getText();
if( ident != null )
{
mFleetsyncIDNode.getFleetsyncID().setIdent( ident );
mTextField.setText( fleetsync.getIdent() );
}
setModified( false );
repaint();
}
((ConfigurableNode)mFleetsyncIDNode.getParent()).sort();
mFleetsyncIDNode.save();
mFleetsyncIDNode.show();
}
else
{
JOptionPane.showMessageDialog( FleetsyncIDEditor.this, "Please enter an ident" );
}
}
else if( command.contentEquals( "Reset" ) )
@Override
public void save()
{
FleetsyncID fleetsync = getFleetsyncID();
if( fleetsync != null )
{
mTextIdent.setText( mFleetsyncIDNode.getFleetsyncID().getIdent() );
fleetsync.setIdent( mTextField.getText() );
}
mFleetsyncIDNode.refresh();
}
setModified( false );
}
}

View File

@@ -41,7 +41,7 @@ public class FleetsyncIDNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new FleetsyncIDEditor( this );
return null;
}
public FleetsyncID getFleetsyncID()

View File

@@ -1,120 +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.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import controller.ConfigurableNode;
public class StatusIDEditor extends JPanel implements ActionListener
{
private static final long serialVersionUID = 1L;
private final static Logger mLog =
LoggerFactory.getLogger( StatusIDEditor.class );
private StatusIDNode mStatusIDNode;
private JLabel mLabelName;
private JTextField mTextStatusID;
public StatusIDEditor( StatusIDNode statusIDNode )
{
mStatusIDNode = statusIDNode;
initGUI();
}
private void initGUI()
{
setLayout( new MigLayout() );
setBorder( BorderFactory.createTitledBorder( "Status Code" ) );
mLabelName = new JLabel( "Status Code:" );
add( mLabelName, "align right" );
mTextStatusID = new JTextField(
String.valueOf( mStatusIDNode.getStatusID().getStatus() ) );
add( mTextStatusID, "grow, wrap" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( StatusIDEditor.this );
add( btnSave );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( StatusIDEditor.this );
add( btnReset, "wrap" );
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
if( command.contentEquals( "Save" ) )
{
String statusIDString = mTextStatusID.getText();
if( statusIDString != null )
{
try
{
int id = Integer.parseInt( statusIDString );
mStatusIDNode.getStatusID().setStatus( id );
((ConfigurableNode)mStatusIDNode.getParent()).sort();
mStatusIDNode.save();
mStatusIDNode.show();
}
catch( Exception ex )
{
mLog.error( "StatusIDEditor - error parsing int status " +
"id from [" + statusIDString + "]" );
}
}
else
{
JOptionPane.showMessageDialog( StatusIDEditor.this,
"Please enter a status ID code" );
}
}
else if( command.contentEquals( "Reset" ) )
{
mTextStatusID.setText(
String.valueOf( mStatusIDNode.getStatusID().getStatus() ) );
}
mStatusIDNode.refresh();
}
}

View File

@@ -1,6 +1,6 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 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
@@ -20,109 +20,125 @@ package alias.id.lojack;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.MaskFormatter;
import module.decode.lj1200.LJ1200Message;
import module.decode.lj1200.LJ1200Message.Function;
import net.miginfocom.swing.MigLayout;
import controller.ConfigurableNode;
import alias.AliasID;
import alias.ComponentEditor;
public class LoJackIDEditor extends JPanel implements ActionListener
public class LoJackIDEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private LoJackIDNode mLoJackIDNode;
private JTextField mTextField;
private JComboBox<LJ1200Message.Function> mFunctionCombo;
private JTextField mTextIdent;
private String mHelpText = "Select a LoJack message function code and enter"
+ " a five character reply code/identifier in the ID field.\n\n"
+ "Wildcard: use an asterisk (*) to wildcard any character in the "
+ "five character reply code (e.g. AB*CD or ***12 or *****)\n\n"
+ "Reply codes are five characters where the middle character"
+ " identifies the entity (tower/site or transponder) as follows:\n"
+ "X,Y\t\tTower\n"
+ "0-9,A,C-H,J-N,P-W\tTransponder\n"
+ "B,I,O,Z\t\tNot Used";
private static final String HELP_TEXT = "LoJack function code and five character ID."
+ " The middle character in a reply ID code identifies the entity:"
+ " Tower[X,Y] Transponder[0-9,A,C-H,J-N,P-W] Not Used[B,I,O,Z]."
+ " Use an asterisk (*) to wildcard ID characters (e.g. AB*CD or ***12 or *****)";
public LoJackIDEditor( LoJackIDNode lojackNode )
public LoJackIDEditor( AliasID aliasID )
{
mLoJackIDNode = lojackNode;
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
add( new JLabel( "LoJack Function and ID" ), "span,align center" );
LoJackFunctionAndID lojack = mLoJackIDNode.getLoJackID();
add( new JLabel( "Function:" ) );
mFunctionCombo = new JComboBox<LJ1200Message.Function>( Function.values() );
mFunctionCombo.setSelectedItem( lojack.getFunction() );
add( mFunctionCombo, "grow, wrap" );
mFunctionCombo.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
setModified( true );
}
} );
add( mFunctionCombo, "growx, push" );
add( new JLabel( "ID:" ) );
mTextIdent = new JTextField( lojack.getID() );
add( mTextIdent, "grow, wrap" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( LoJackIDEditor.this );
add( btnSave, "growx,push" );
MaskFormatter formatter = null;
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( LoJackIDEditor.this );
add( btnReset, "growx,push" );
try
{
//Mask: any character or number, 5 places
formatter = new MaskFormatter( "AAAAA" );
}
catch( Exception e )
{
//Do nothing, the mask was invalid
}
JTextArea helpText = new JTextArea( mHelpText );
mTextField = new JFormattedTextField( formatter );
mTextField.getDocument().addDocumentListener( this );
add( mTextField, "growx,push" );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public LoJackFunctionAndID getLoJackID()
{
if( getComponent() instanceof LoJackFunctionAndID )
{
return (LoJackFunctionAndID)getComponent();
}
return null;
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
final LoJackFunctionAndID lojack = mLoJackIDNode.getLoJackID();
if( command.contentEquals( "Save" ) )
{
String id = mTextIdent.getText();
if( id != null )
{
lojack.setID( id );
lojack.setFunction( (Function)mFunctionCombo.getSelectedItem() );
((ConfigurableNode)mLoJackIDNode.getParent()).sort();
mLoJackIDNode.save();
mLoJackIDNode.show();
}
else
{
JOptionPane.showMessageDialog( LoJackIDEditor.this, "Please enter an ident" );
}
}
else if( command.contentEquals( "Reset" ) )
LoJackFunctionAndID lojack = getLoJackID();
if( lojack != null )
{
mFunctionCombo.setSelectedItem( lojack.getFunction() );
mTextIdent.setText( lojack.getID() );
mTextField.setText( lojack.getID() );
}
else
{
mFunctionCombo.setSelectedItem( null );
mTextField.setText( null );
}
mLoJackIDNode.refresh();
}
setModified( false );
repaint();
}
@Override
public void save()
{
LoJackFunctionAndID lojack = getLoJackID();
if( lojack != null )
{
lojack.setID( mTextField.getText() );
lojack.setFunction( (Function)mFunctionCombo.getSelectedItem() );
}
setModified( false );
}
}

View File

@@ -41,7 +41,7 @@ public class LoJackIDNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new LoJackIDEditor( this );
return null;
}
public LoJackFunctionAndID getLoJackID()

View File

@@ -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,79 +17,100 @@
******************************************************************************/
package alias.id.mdc;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.MaskFormatter;
import net.miginfocom.swing.MigLayout;
import controller.ConfigurableNode;
import alias.AliasID;
import alias.ComponentEditor;
public class MDC1200IDEditor extends JPanel implements ActionListener
public class MDC1200IDEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private MDC1200IDNode mMDC1200IDNode;
private JTextField mTextIdent;
public MDC1200IDEditor( MDC1200IDNode fsNode )
private static final String HELP_TEXT = "An MDC-1200 identifier is a"
+ " four digit [0-9] value. Use an asterisk (*) to wildcard"
+ " individual digits (e.g. 123* or **34)";
private JTextField mTextField;
public MDC1200IDEditor( AliasID aliasID )
{
mMDC1200IDNode = fsNode;
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
add( new JLabel( "MDC-1200 " ), "span,align center" );
add( new JLabel( "MDC-1200 ID:" ) );
add( new JLabel( "Unit ID:" ) );
mTextIdent = new JTextField( mMDC1200IDNode.getMDC1200ID().getIdent() );
add( mTextIdent, "growx,push" );
MaskFormatter formatter = null;
try
{
//Mask: 4 digits
formatter = new MaskFormatter( "####" );
}
catch( Exception e )
{
//Do nothing, the mask was invalid
}
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( MDC1200IDEditor.this );
add( btnSave, "growx,push" );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( MDC1200IDEditor.this );
add( btnReset, "growx,push" );
mTextField = new JFormattedTextField( formatter );
mTextField.getDocument().addDocumentListener( this );
add( mTextField, "growx,push" );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public MDC1200ID getMDC1200ID()
{
if( getComponent() instanceof MDC1200ID )
{
return (MDC1200ID)getComponent();
}
return null;
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
if( command.contentEquals( "Save" ) )
MDC1200ID mdc = getMDC1200ID();
if( mdc != null )
{
String ident = mTextIdent.getText();
if( ident != null )
{
mMDC1200IDNode.getMDC1200ID().setIdent( ident );
mTextField.setText( mdc.getIdent() );
}
setModified( false );
repaint();
}
((ConfigurableNode)mMDC1200IDNode.getParent()).sort();
mMDC1200IDNode.save();
mMDC1200IDNode.show();
}
else
{
JOptionPane.showMessageDialog( MDC1200IDEditor.this, "Please enter a unit ID" );
}
}
else if( command.contentEquals( "Reset" ) )
@Override
public void save()
{
MDC1200ID mdc = getMDC1200ID();
if( mdc != null )
{
mTextIdent.setText( mMDC1200IDNode.getMDC1200ID().getIdent() );
mdc.setIdent( mTextField.getText() );
}
mMDC1200IDNode.refresh();
}
setModified( false );
}
}

View File

@@ -41,7 +41,7 @@ public class MDC1200IDNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new MDC1200IDEditor( this );
return null;
}
public MDC1200ID getMDC1200ID()

View File

@@ -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
@@ -20,79 +20,99 @@ package alias.id.mobileID;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.MaskFormatter;
import net.miginfocom.swing.MigLayout;
import controller.ConfigurableNode;
import alias.AliasID;
import alias.ComponentEditor;
public class MINEditor extends JPanel implements ActionListener
public class MINEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private MINNode mMINNode;
private JLabel mLabelName;
private JTextField mTextMIN;
public MINEditor( MINNode minNode )
private static final String HELP_TEXT = "A Passport Mobile Identifier (MIN) is a"
+ " six character hexadecimal value";
private JTextField mTextField;
public MINEditor( AliasID aliasID )
{
mMINNode = minNode;
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
add( new JLabel( "Mobile ID Number (MIN)" ), "span,align center" );
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
add( new JLabel( "MIN:" ) );
mTextMIN = new JTextField( mMINNode.getMIN().getMin() );
add( mTextMIN, "growx,push" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( MINEditor.this );
add( btnSave, "growx,push" );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( MINEditor.this );
add( btnReset, "growx,push" );
MaskFormatter formatter = null;
try
{
//Mask: 6 hex characters
formatter = new MaskFormatter( "HHHHHH" );
}
catch( Exception e )
{
//Do nothing, the mask was invalid
}
mTextField = new JFormattedTextField( formatter );
mTextField.getDocument().addDocumentListener( this );
add( mTextField, "growx,push" );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public Min getMin()
{
if( getComponent() instanceof Min )
{
return (Min)getComponent();
}
return null;
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
if( command.contentEquals( "Save" ) )
Min min = getMin();
if( min != null )
{
String esn = mTextMIN.getText();
if( esn != null )
{
mMINNode.getMIN().setMin( esn );
((ConfigurableNode)mMINNode.getParent()).sort();
mMINNode.save();
mMINNode.show();
}
else
{
JOptionPane.showMessageDialog( MINEditor.this, "Please enter an ESN" );
}
}
else if( command.contentEquals( "Reset" ) )
{
mTextMIN.setText( mMINNode.getMIN().getMin() );
mTextField.setText( min.getMin() );
}
mMINNode.refresh();
}
setModified( false );
repaint();
}
@Override
public void save()
{
Min min = getMin();
if( min != null )
{
min.setMin( mTextField.getText() );
}
setModified( false );
}
}

View File

@@ -41,7 +41,7 @@ public class MINNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new MINEditor( this );
return null;
}
public Min getMIN()

View File

@@ -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,80 +17,101 @@
******************************************************************************/
package alias.id.mpt1327;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.MaskFormatter;
import net.miginfocom.swing.MigLayout;
import controller.ConfigurableNode;
import alias.AliasID;
import alias.ComponentEditor;
public class MPT1327IDEditor extends JPanel implements ActionListener
public class MPT1327IDEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private MPT1327IDNode mMPT1327IDNode;
private JTextField mTextIdent;
private static final long serialVersionUID = 1L;
public MPT1327IDEditor( MPT1327IDNode fsNode )
private static final String HELP_TEXT = "An MPT-1327 identifier is a"
+ " composite decimal [0-9] value formatted as ppp-iiii where"
+ " p=Prefix and i=Ident.";
private JTextField mTextField;
public MPT1327IDEditor( AliasID aliasID )
{
mMPT1327IDNode = fsNode;
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
add( new JLabel( "MPT-1327 Radio or Group ID" ), "span,align center" );
add( new JLabel( "MPT-1327 ID:" ) );
add( new JLabel( "ID:" ) );
MaskFormatter formatter = null;
try
{
//Mask: 3 digits - 4 digits
formatter = new MaskFormatter( "###-####" );
}
catch( Exception e )
{
//Do nothing, the mask was invalid
}
mTextIdent = new JTextField( mMPT1327IDNode.getMPT1327ID().getIdent() );
add( mTextIdent, "growx,push" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( MPT1327IDEditor.this );
add( btnSave, "growx,push" );
mTextField = new JFormattedTextField( formatter );
mTextField.getDocument().addDocumentListener( this );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( MPT1327IDEditor.this );
add( btnReset, "growx,push" );
add( mTextField, "growx,push" );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public MPT1327ID getMPT1327ID()
{
if( getComponent() instanceof MPT1327ID )
{
return (MPT1327ID)getComponent();
}
return null;
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
if( command.contentEquals( "Save" ) )
MPT1327ID mpt = getMPT1327ID();
if( mpt != null )
{
String ident = mTextIdent.getText();
if( ident != null )
{
mMPT1327IDNode.getMPT1327ID().setIdent( ident );
mTextField.setText( mpt.getIdent() );
}
setModified( false );
repaint();
}
((ConfigurableNode)mMPT1327IDNode.getParent()).sort();
mMPT1327IDNode.save();
mMPT1327IDNode.show();
}
else
{
JOptionPane.showMessageDialog( MPT1327IDEditor.this, "Please enter a MPT1327 unit ID" );
}
}
else if( command.contentEquals( "Reset" ) )
@Override
public void save()
{
MPT1327ID mpt = getMPT1327ID();
if( mpt != null )
{
mTextIdent.setText( mMPT1327IDNode.getMPT1327ID().getIdent() );
mpt.setIdent( mTextField.getText() );
}
mMPT1327IDNode.refresh();
}
setModified( false );
}
}

View File

@@ -41,7 +41,7 @@ public class MPT1327IDNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new MPT1327IDEditor( this );
return null;
}
public MPT1327ID getMPT1327ID()

View File

@@ -1,4 +1,4 @@
package alias.record;
package alias.id.nonrecordable;
import alias.AliasID;
import alias.AliasIDType;
@@ -16,4 +16,10 @@ public class NonRecordable extends AliasID
{
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

@@ -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.record;
package alias.id.nonrecordable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -42,7 +42,7 @@ public class NonRecordableNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new NonRecordableEditor( this );
return null;
}
@Override

View File

@@ -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.priority;
package alias.id.priority;
import javax.xml.bind.annotation.XmlAttribute;

View File

@@ -0,0 +1,137 @@
/*******************************************************************************
* 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.priority;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.JTextArea;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import net.miginfocom.swing.MigLayout;
import alias.AliasID;
import alias.ComponentEditor;
public class PriorityEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
public static final String DO_NOT_MONITOR = "Do Not Monitor";
private static final String HELP_TEXT = "Priority determines which calls"
+ " have priority for playback over your computer speakers, or designates"
+ " an alias for non-monitoring if you don't want to hear calls"
+ " from an alias. Lower values indicate higher priority levels.";
private JCheckBox mDoNotMonitorCheckBox = new JCheckBox( DO_NOT_MONITOR );
private JSlider mPrioritySlider;
private JLabel mPrioritySliderLabel;
public PriorityEditor( AliasID aliasID )
{
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
add( mDoNotMonitorCheckBox, "span,align center" );
mPrioritySlider = new JSlider( JSlider.HORIZONTAL,
Priority.MIN_PRIORITY,
Priority.MAX_PRIORITY,
Priority.MIN_PRIORITY );
mPrioritySlider.setMajorTickSpacing( 20 );
mPrioritySlider.setMinorTickSpacing( 5 );
mPrioritySlider.setPaintTicks( true );
mPrioritySlider.setLabelTable( mPrioritySlider.createStandardLabels( 20, 20 ) );
mPrioritySlider.setPaintLabels( true );
mPrioritySlider.addChangeListener( new ChangeListener()
{
@Override
public void stateChanged( ChangeEvent e )
{
mPrioritySliderLabel.setText( "Priority: " + mPrioritySlider.getValue() );
}
} );
mPrioritySliderLabel = new JLabel( "Priority: " + mPrioritySlider.getValue() + " " );
add( mPrioritySliderLabel );
add( mPrioritySlider, "wrap,grow" );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public Priority getPriority()
{
if( getComponent() instanceof Priority )
{
return (Priority)getComponent();
}
return null;
}
@Override
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
Priority priority = getPriority();
if( priority != null )
{
mPrioritySlider.setValue( priority.getPriority() );
mDoNotMonitorCheckBox.setSelected( priority.isDoNotMonitor() );
}
setModified( false );
repaint();
}
@Override
public void save()
{
Priority priority = getPriority();
if( priority != null )
{
if( mDoNotMonitorCheckBox.isSelected() )
{
priority.setPriority( Priority.DO_NOT_MONITOR );
}
else
{
priority.setPriority( mPrioritySlider.getValue() );
}
}
setModified( false );
}
}

View File

@@ -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.priority;
package alias.id.priority;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -41,7 +41,7 @@ public class PriorityNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new PriorityEditor( this );
return null;
}
public Priority getPriority()

View File

@@ -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,95 +17,86 @@
******************************************************************************/
package alias.id.siteID;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import net.miginfocom.swing.MigLayout;
import alias.AliasID;
import alias.ComponentEditor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SiteIDEditor extends JPanel implements ActionListener
public class SiteIDEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private final static Logger mLog =
LoggerFactory.getLogger( SiteIDEditor.class );
private SiteIDNode mSiteIDNode;
private JTextField mTextSiteID;
public SiteIDEditor( SiteIDNode siteIDNode )
private static final String HELP_TEXT = "Site number for P25 systems uses"
+ " the format RR-SS, where RR = RF Subsystem and SS = Site Number. "
+ " (e.g. RFSS 1 Site 3: 01-03). For other protocols, simply use"
+ " a decimal value for the site ID";
private JTextField mTextField;
public SiteIDEditor( AliasID aliasID )
{
mSiteIDNode = siteIDNode;
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][][grow]" ) );
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
add( new JLabel( "Site ID" ), "span,align center" );
add( new JLabel( "Site ID:" ) );
mTextField = new JTextField();
mTextField.getDocument().addDocumentListener( this );
add( mTextField, "growx,push" );
add( new JLabel( "Site:" ) );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public SiteID getSiteID()
{
if( getComponent() instanceof SiteID )
{
return (SiteID)getComponent();
}
mTextSiteID = new JTextField(
String.valueOf( mSiteIDNode.getSiteID().getSite() ) );
add( mTextSiteID, "growx,push" );
JTextArea description = new JTextArea( "Enter a site number. "
+ "For P25 systems, use the format RR-SS, where RR = RF "
+ "Subsystem and SS = Site Number. For example, RFSS 1 and "
+ "Site 3 would be: 01-03");
description.setLineWrap( true );
description.setBackground( getBackground() );
add( description, "growx,span" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( SiteIDEditor.this );
add( btnSave, "growx,push" );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( SiteIDEditor.this );
add( btnReset, "growx,push" );
return null;
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
if( command.contentEquals( "Save" ) )
SiteID siteID = getSiteID();
if( siteID != null )
{
String siteIDString = mTextSiteID.getText();
if( siteIDString != null )
{
mSiteIDNode.getSiteID().setSite( siteIDString );
mTextField.setText( siteID.getSite() );
}
setModified( false );
repaint();
}
mSiteIDNode.save();
mSiteIDNode.show();
}
else
{
JOptionPane.showMessageDialog( SiteIDEditor.this,
"Please enter a site ID" );
}
}
else if( command.contentEquals( "Reset" ) )
@Override
public void save()
{
SiteID siteID = getSiteID();
if( siteID != null )
{
mTextSiteID.setText( mSiteIDNode.getSiteID().getSite() );
siteID.setSite( mTextField.getText() );
}
mSiteIDNode.refresh();
}
setModified( false );
}
}

View File

@@ -41,7 +41,7 @@ public class SiteIDNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new SiteIDEditor( this );
return null;
}
public SiteID getSiteID()

View File

@@ -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.id.fleetsync;
package alias.id.status;
import javax.xml.bind.annotation.XmlAttribute;

View File

@@ -0,0 +1,128 @@
/*******************************************************************************
* 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.status;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.MaskFormatter;
import net.miginfocom.swing.MigLayout;
import alias.AliasID;
import alias.ComponentEditor;
public class StatusIDEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private static final String HELP_TEXT = "Status numbers are used in some"
+ " protocols like Fleetsync. The status number is assigned a meaning"
+ " in the radio. You can assign a 3 digit status code (use leading zeros) to an"
+ " alias where the alias contains the status meaning.";
private JTextField mTextField;
public StatusIDEditor( AliasID aliasID )
{
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
add( new JLabel( "Status:" ) );
MaskFormatter formatter = null;
try
{
//Mask: 3 digits
formatter = new MaskFormatter( "###" );
}
catch( Exception e )
{
//Do nothing, the mask was invalid
}
mTextField = new JFormattedTextField( formatter );
mTextField.getDocument().addDocumentListener( this );
add( mTextField, "growx,push" );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public StatusID getStatusID()
{
if( getComponent() instanceof StatusID )
{
return (StatusID)getComponent();
}
return null;
}
@Override
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
StatusID statusID = getStatusID();
if( statusID != null )
{
mTextField.setText( String.valueOf( statusID.getStatus() ) );
}
setModified( false );
repaint();
}
@Override
public void save()
{
StatusID statusID = getStatusID();
if( statusID != null )
{
int status = 0;
try
{
status = Integer.valueOf( mTextField.getText() );
}
catch( Exception e )
{
//Do nothing, we couldn't parse the value
}
statusID.setStatus( status );
}
setModified( false );
}
}

View File

@@ -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.id.fleetsync;
package alias.id.status;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -41,7 +41,7 @@ public class StatusIDNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new StatusIDEditor( this );
return null;
}
public StatusID getStatusID()

View File

@@ -17,99 +17,87 @@
******************************************************************************/
package alias.id.talkgroup;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import net.miginfocom.swing.MigLayout;
import controller.ConfigurableNode;
import alias.AliasID;
import alias.ComponentEditor;
public class TalkgroupIDEditor extends JPanel implements ActionListener
public class TalkgroupIDEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private TalkgroupIDNode mTalkgroupIDNode;
private JTextField mTextTalkgroupID;
private String mHelpText = "Enter a formatted talkgroup identifier.\n\n"
+ "P25 Talkgroup Format: hexadecimal value, 4 characters for "
+ "talkgroup or 6 characters for a mobile radio\n\n"
+ "LTR Talkgroup Format: A-HH-TTT (A=Area, H=Home Repeater, "
+ "T=Talkgroup)\n\n"
+ "Passport Talkgroup Format: xxxxx (up to 5-digit number)\n\n"
+ "Wildcard: use one or more asterisks (*) for any talkgroup digits.";
public TalkgroupIDEditor( TalkgroupIDNode talkgroupIDNode )
private static final String HELP_TEXT = "Enter a formatted talkgroup identifier.\n"
+ "P25: 4 or 6 hex characters (e.g. AB12 or ABC123)\n"
+ "LTR: A-HH-TTT (A=Area H=Home T=Talkgroup)\n"
+ "Passport: xxxxx (up to 5-digit number)\n\n"
+ "Wildcard: use an asterisk (*) in place of each talkgroup digit";
private JTextField mTextField;
public TalkgroupIDEditor( AliasID aliasID )
{
mTalkgroupIDNode = talkgroupIDNode;
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][][grow]" ) );
add( new JLabel( "Talkgroup ID" ), "span,align center" );
add( new JLabel( "TGID:" ) );
mTextTalkgroupID = new JTextField();
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
mTextTalkgroupID.setText( mTalkgroupIDNode.getTalkgroupID().getTalkgroup() );
add( new JLabel( "Talkgroup:" ) );
mTextField = new JTextField();
mTextField.getDocument().addDocumentListener( this );
add( mTextField, "growx,push" );
add( mTextTalkgroupID, "growx,push" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( TalkgroupIDEditor.this );
add( btnSave, "growx,push" );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( TalkgroupIDEditor.this );
add( btnReset, "growx,push" );
JTextArea helpText = new JTextArea( mHelpText );
helpText.setBackground( getBackground() );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public TalkgroupID getTalkgroupID()
{
if( getComponent() instanceof TalkgroupID )
{
return (TalkgroupID)getComponent();
}
return null;
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
if( command.contentEquals( "Save" ) )
TalkgroupID talkgroup = getTalkgroupID();
if( talkgroup != null )
{
String tgid = mTextTalkgroupID.getText();
if( tgid != null )
{
mTalkgroupIDNode.getTalkgroupID().setTalkgroup( tgid );
((ConfigurableNode)mTalkgroupIDNode.getParent()).sort();
mTextField.setText( talkgroup.getTalkgroup() );
}
setModified( false );
repaint();
}
mTalkgroupIDNode.save();
mTalkgroupIDNode.show();
}
else
{
JOptionPane.showMessageDialog( TalkgroupIDEditor.this,
"Please enter a talkgroup ID" );
}
}
else if( command.contentEquals( "Reset" ) )
@Override
public void save()
{
TalkgroupID talkgroup = getTalkgroupID();
if( talkgroup != null )
{
mTextTalkgroupID.setText(
mTalkgroupIDNode.getTalkgroupID().getTalkgroup() );
talkgroup.setTalkgroup( mTextField.getText() );
}
mTalkgroupIDNode.refresh();
}
setModified( false );
}
}

View File

@@ -41,7 +41,7 @@ public class TalkgroupIDNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new TalkgroupIDEditor( this );
return null;
}
public TalkgroupID getTalkgroupID()

View File

@@ -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,101 +17,95 @@
******************************************************************************/
package alias.id.uniqueID;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import net.miginfocom.swing.MigLayout;
import alias.AliasID;
import alias.ComponentEditor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import controller.ConfigurableNode;
public class UniqueIDEditor extends JPanel implements ActionListener
public class UniqueIDEditor extends ComponentEditor<AliasID>
{
private static final long serialVersionUID = 1L;
private final static Logger mLog =
LoggerFactory.getLogger( UniqueIDEditor.class );
private UniqueIDNode mUniqueIDNode;
private JLabel mLabelUniqueID;
private JTextField mTextUniqueID;
public UniqueIDEditor( UniqueIDNode uniqueIDNode )
private static final String HELP_TEXT = "LTR-Net Unique ID (UID) is a system"
+ " identifier assigned to each radio in the range 1 - 2097152";
private JTextField mTextField;
public UniqueIDEditor( AliasID aliasID )
{
mUniqueIDNode = uniqueIDNode;
super( aliasID );
initGUI();
setComponent( aliasID );
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
add( new JLabel( "LTR-Net Radio Unique ID" ), "span,align center" );
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][grow]" ) );
add( new JLabel( "Unique ID:" ) );
mTextUniqueID = new JTextField(
String.valueOf( mUniqueIDNode.getUniqueID().getUid() ) );
add( mTextUniqueID, "growx,push" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( UniqueIDEditor.this );
add( btnSave, "growx,push" );
mTextField = new JTextField();
mTextField.getDocument().addDocumentListener( this );
add( mTextField, "growx,push" );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( UniqueIDEditor.this );
add( btnReset, "growx,push" );
JTextArea helpText = new JTextArea( HELP_TEXT );
helpText.setLineWrap( true );
helpText.setBackground( getBackground() );
add( helpText, "span,grow,push" );
}
public UniqueID getUniqueID()
{
if( getComponent() instanceof UniqueID )
{
return (UniqueID)getComponent();
}
return null;
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
public void setComponent( AliasID aliasID )
{
mComponent = aliasID;
if( command.contentEquals( "Save" ) )
UniqueID uid = getUniqueID();
if( uid != null )
{
String uid = mTextUniqueID.getText();
mTextField.setText( String.valueOf( uid.getUid() ) );
}
setModified( false );
repaint();
}
@Override
public void save()
{
UniqueID uid = getUniqueID();
if( uid != null )
{
int id = 0;
if( uid != null )
try
{
try
{
int uidInt = Integer.parseInt( uid );
mUniqueIDNode.getUniqueID().setUid( uidInt );
((ConfigurableNode)mUniqueIDNode.getParent()).sort();
mUniqueIDNode.save();
mUniqueIDNode.show();
}
catch( Exception ex )
{
mLog.error( "UniqueIDEditor - exception trying to parse " +
"int from uid [" + uid + "]", ex );
}
id = Integer.parseInt( mTextField.getText() );
}
else
catch( Exception e )
{
JOptionPane.showMessageDialog( UniqueIDEditor.this,
"Please enter a site number and unique ID" );
//Do nothing, we couldn't parse the value
}
}
else if( command.contentEquals( "Reset" ) )
{
mTextUniqueID.setText(
String.valueOf( mUniqueIDNode.getUniqueID().getUid() ) );
uid.setUid( id );
}
mUniqueIDNode.refresh();
}
setModified( false );
}
}

View File

@@ -41,7 +41,7 @@ public class UniqueIDNode extends AliasIDNode
@Override
public JPanel getEditor()
{
return new UniqueIDEditor( this );
return null;
}
public UniqueID getUniqueID()

View File

@@ -1,191 +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.priority;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.JTextArea;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import controller.ConfigurableNode;
public class PriorityEditor extends JPanel implements ActionListener
{
private final static Logger mLog = LoggerFactory.getLogger( PriorityEditor.class );
public static final String DO_NOT_MONITOR = "Do Not Monitor";
public static final String SAVE = "Save";
public static final String RESET = "Reset";
private static final long serialVersionUID = 1L;
private PriorityNode mPriorityNode;
private JCheckBox mDoNotMonitorCheckBox = new JCheckBox( DO_NOT_MONITOR );
private JSlider mPrioritySlider;
private JLabel mPrioritySliderLabel;
public PriorityEditor( PriorityNode priorityNode )
{
mPriorityNode = priorityNode;
initGUI();
}
private void initGUI()
{
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
add( new JLabel( "Priority" ), "span,align center" );
boolean doNotMonitor = mPriorityNode.getPriority().isDoNotMonitor();
mDoNotMonitorCheckBox.addActionListener( this );
if( doNotMonitor )
{
mDoNotMonitorCheckBox.setSelected( true );
}
add( mDoNotMonitorCheckBox, "span,align center" );
int priority = mPriorityNode.getPriority().getPriority();
/* Adjust the displayable priority value to within the min/max bounds
* so we don't get an error in the jslider control. If the actual
* priority is -1 (ie do not follow), the controls will be updated
* to reflect that state */
if( priority < Priority.MIN_PRIORITY )
{
priority = Priority.DEFAULT_PRIORITY;
}
else if( priority > Priority.MAX_PRIORITY )
{
priority = Priority.DEFAULT_PRIORITY;
}
mPrioritySlider = new JSlider( JSlider.HORIZONTAL,
Priority.MIN_PRIORITY,
Priority.MAX_PRIORITY,
priority );
mPrioritySlider.setMajorTickSpacing( 20 );
mPrioritySlider.setMinorTickSpacing( 5 );
mPrioritySlider.setPaintTicks( true );
mPrioritySlider.setLabelTable( mPrioritySlider.createStandardLabels( 20, 20 ) );
mPrioritySlider.setPaintLabels( true );
mPrioritySliderLabel = new JLabel( "Priority: " + mPrioritySlider.getValue() + " " );
mPrioritySlider.addChangeListener( new ChangeListener()
{
@Override
public void stateChanged( ChangeEvent e )
{
mPrioritySliderLabel.setText( "Priority: " + mPrioritySlider.getValue() );
}
} );
if( doNotMonitor )
{
mPrioritySlider.setEnabled( false );
mPrioritySliderLabel.setEnabled( false );
}
add( mPrioritySliderLabel );
add( mPrioritySlider, "wrap,grow" );
JButton btnSave = new JButton( SAVE );
btnSave.addActionListener( PriorityEditor.this );
add( btnSave, "growx,push" );
JButton btnReset = new JButton( RESET );
btnReset.addActionListener( PriorityEditor.this );
add( btnReset, "growx,push" );
StringBuilder sb = new StringBuilder();
sb.append( "Select a value for audio priority within the range " );
sb.append( Priority.MIN_PRIORITY );
sb.append( " and " );
sb.append( Priority.MAX_PRIORITY );
sb.append( ". Lower values indicate higher priority levels." );
JTextArea helpText = new JTextArea( sb.toString() );
helpText.setLineWrap( true );
add( helpText, "span,grow,push" );
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
if( command.contentEquals( SAVE ) )
{
if( mDoNotMonitorCheckBox.isSelected() )
{
mPriorityNode.getPriority().setPriority( Priority.DO_NOT_MONITOR );
}
else
{
mPriorityNode.getPriority().setPriority( mPrioritySlider.getValue() );
}
((ConfigurableNode)mPriorityNode.getParent()).sort();
mPriorityNode.save();
mPriorityNode.show();
}
else if( command.contentEquals( RESET ) )
{
mPrioritySlider.setValue( mPriorityNode.getPriority().getPriority() );
}
else if( command.contentEquals( DO_NOT_MONITOR ) )
{
if( mDoNotMonitorCheckBox.isSelected() )
{
mPriorityNode.getPriority().setPriority( Priority.DO_NOT_MONITOR );
mPrioritySlider.setEnabled( false );
mPrioritySliderLabel.setEnabled( false );
}
else
{
mPriorityNode.getPriority().setPriority( Priority.DEFAULT_PRIORITY );
mPrioritySlider.setEnabled( true );
mPrioritySliderLabel.setEnabled( true );
}
mPriorityNode.save();
mPriorityNode.show();
}
mPriorityNode.refresh();
}
}

View File

@@ -1,75 +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.record;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import net.miginfocom.swing.MigLayout;
public class NonRecordableEditor extends JPanel implements ActionListener
{
private static final long serialVersionUID = 1L;
private NonRecordableNode mNode;
public NonRecordableEditor( NonRecordableNode node )
{
mNode = node;
initGUI();
}
private void initGUI()
{
setLayout( new MigLayout( "fill", "[left]", "[grow]" ) );
JTextArea description = new JTextArea( "Non-Recordable. Any audio where"
+ " this alias is a participant in the call will not be recorded." );
description.setLineWrap( true );
description.setBackground( getBackground() );
add( description, "growx,span" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( NonRecordableEditor.this );
add( btnSave, "growx,push" );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( NonRecordableEditor.this );
add( btnReset, "growx,push" );
}
@Override
public void actionPerformed( ActionEvent e )
{
String command = e.getActionCommand();
if( command.contentEquals( "Save" ) )
{
mNode.save();
mNode.show();
}
mNode.refresh();
}
}

View File

@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
import sample.Listener;
import alias.Alias;
import alias.priority.Priority;
import alias.id.priority.Priority;
public class AudioMetadata implements Listener<Metadata>
{

View File

@@ -22,7 +22,7 @@ import source.config.SourceConfigTuner;
import source.tuner.TunerChannel;
import source.tuner.TunerChannel.Type;
import alias.Alias;
import alias.priority.Priority;
import alias.id.priority.Priority;
import controller.channel.Channel;
import controller.channel.Channel.ChannelType;
import controller.channel.ChannelEvent;