wip #34 - reformatting the channel configuration editors.

This commit is contained in:
denny
2016-03-20 19:35:45 -04:00
parent f32c520cab
commit d93f497b33
32 changed files with 1415 additions and 1472 deletions

View File

@@ -23,9 +23,9 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
import module.decode.DecoderFactory;
import module.decode.DecoderType;
import module.decode.config.AuxDecodeConfiguration;
import module.decode.config.DecodeConfigFactory;
import module.decode.config.DecodeConfiguration;
import module.log.EventLogType;
import module.log.config.EventLogConfiguration;
@@ -42,7 +42,6 @@ import source.config.SourceConfigTuner;
import source.config.SourceConfiguration;
import source.tuner.TunerChannel;
import source.tuner.TunerChannel.Type;
import source.tuner.frequency.FrequencyChangeEvent;
import source.tuner.frequency.FrequencyChangeEvent.Event;
import source.tuner.frequency.IFrequencyChangeProcessor;
@@ -61,8 +60,7 @@ public class Channel extends Configuration implements IFrequencyChangeProcessor
// Static unique channel identifier tracking
private static int UNIQUE_ID = 0;
private DecodeConfiguration mDecodeConfiguration =
DecodeConfigFactory.getDefaultDecodeConfiguration();
private DecodeConfiguration mDecodeConfiguration = DecoderFactory.getDefaultDecodeConfiguration();
private AuxDecodeConfiguration mAuxDecodeConfiguration =
new AuxDecodeConfiguration();
private SourceConfiguration mSourceConfiguration =
@@ -135,7 +133,7 @@ public class Channel extends Configuration implements IFrequencyChangeProcessor
channel.setAuxDecodeConfiguration( aux );
channel.setDecodeConfiguration( DecodeConfigFactory.copy( mDecodeConfiguration ) );
channel.setDecodeConfiguration( DecoderFactory.copy( mDecodeConfiguration ) );
EventLogConfiguration log = new EventLogConfiguration();

View File

@@ -2,6 +2,7 @@ package controller.channel;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -23,7 +24,6 @@ import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import playlist.PlaylistManager;
import source.SourceManager;
import alias.AliasModel;
@@ -57,8 +57,7 @@ public class ChannelController extends JPanel
{
mChannelModel = channelModel;
mEditor = new ChannelEditor( channelModel, channelMapModel,
sourceManager, aliasModel );
mEditor = new ChannelEditor( channelModel, channelMapModel, sourceManager, aliasModel );
mChannelModel.addListener( mEditor );
init();
@@ -66,9 +65,7 @@ public class ChannelController extends JPanel
private void init()
{
setLayout( new MigLayout( "insets 0 0 0 0",
"[grow,fill]",
"[grow,fill]") );
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill]") );
//System Configuration View and Editor
mChannelTable = new JTable( mChannelModel );
@@ -109,11 +106,22 @@ public class ChannelController extends JPanel
listAndButtonsPanel.add( channelScroller, "wrap" );
listAndButtonsPanel.add( buttonsPanel );
JideSplitPane splitPane = new JideSplitPane( JideSplitPane.HORIZONTAL_SPLIT );
JideSplitPane splitPane = new JideSplitPane( JideSplitPane.VERTICAL_SPLIT );
splitPane.setDividerSize( 5 );
splitPane.setShowGripper( true );
splitPane.add( listAndButtonsPanel );
splitPane.add( mEditor );
//Shrink this guy so that he'll eventually be expanded to the scroller preferred size
listAndButtonsPanel.setPreferredSize( new Dimension( 10, 10 ) );
//Attempt to get a 60:40 vertical sizing preference
JScrollPane listScroller = new JScrollPane( listAndButtonsPanel );
listScroller.setPreferredSize( new Dimension( 800, 60 ) );
JScrollPane editorScroller = new JScrollPane( mEditor );
editorScroller.setPreferredSize( new Dimension( 800, 40 ) );
splitPane.add( listScroller );
splitPane.add( editorScroller );
add( splitPane );
}
@@ -134,14 +142,14 @@ public class ChannelController extends JPanel
if( channel != null )
{
mEditor.setChannel( channel );
mEditor.setItem( channel );
mCopyChannelButton.setEnabled( true );
mDeleteChannelButton.setEnabled( true );
}
}
else
{
mEditor.setChannel( null );
mEditor.setItem( null );
mCopyChannelButton.setEnabled( false );
mDeleteChannelButton.setEnabled( false );
}

View File

@@ -17,28 +17,26 @@
******************************************************************************/
package controller.channel;
import gui.editor.Editor;
import java.awt.Color;
import java.awt.Component;
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.JSeparator;
import module.decode.AuxDecodeComponentEditor;
import module.decode.DecodeComponentEditor;
import module.log.EventLogComponentEditor;
import module.decode.AuxDecodeConfigurationEditor;
import module.decode.DecodeConfigurationEditor;
import module.log.EventLogConfigurationEditor;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import playlist.PlaylistManager;
import record.RecordComponentEditor;
import source.SourceComponentEditor;
import record.RecordConfigurationEditor;
import source.SourceConfigurationEditor;
import source.SourceManager;
import alias.AliasModel;
@@ -47,22 +45,19 @@ import com.jidesoft.swing.JideTabbedPane;
import controller.channel.ChannelEvent.Event;
import controller.channel.map.ChannelMapModel;
public class ChannelEditor extends JPanel
implements ActionListener, ChannelEventListener
public class ChannelEditor extends Editor<Channel> implements ActionListener, ChannelEventListener
{
private static final long serialVersionUID = 1L;
private final static Logger mLog = LoggerFactory.getLogger( ChannelEditor.class );
private NameConfigurationEditor mNameConfigurationEditor;
private DecodeComponentEditor mDecodeEditor;
private AuxDecodeComponentEditor mAuxDecodeEditor;
private EventLogComponentEditor mEventLogEditor;
private RecordComponentEditor mRecordEditor;
private SourceComponentEditor mSourceEditor;
private SourceConfigurationEditor mSourceConfigurationEditor;
private DecodeConfigurationEditor mDecodeConfigurationEditor;
private AuxDecodeConfigurationEditor mAuxDecodeConfigurationEditor;
private EventLogConfigurationEditor mEventLogConfiguraitonEditor;
private RecordConfigurationEditor mRecordConfigurationEditor;
private Channel mChannel;
private JButton mEnableButton = new JButton( "Enable" );
private JLabel mChannelName = new JLabel( "Channel:" );
@@ -77,30 +72,42 @@ public class ChannelEditor extends JPanel
SourceManager sourceManager,
AliasModel aliasModel )
{
super();
mChannelModel = channelModel;
mChannelMapModel = channelMapModel;
mSourceManager = sourceManager;
mNameConfigurationEditor = new NameConfigurationEditor( aliasModel,
mChannelModel );
mNameConfigurationEditor = new NameConfigurationEditor( aliasModel, mChannelModel );
initGUI();
init();
}
/**
* Sets the channel configuration in each of the channel editor components
* Note: this method must be invoked on the swing event dispatch thread
*/
public void setChannel( final Channel channel )
public void setItem( final Channel channel )
{
mNameConfigurationEditor.setConfiguration( channel );
mSourceEditor.setConfiguration( channel );
mDecodeEditor.setConfiguration( channel );
mAuxDecodeEditor.setConfiguration( channel );
mEventLogEditor.setConfiguration( channel );
mRecordEditor.setConfiguration( channel );
//Check if the current channel configuration has changed
if( hasItem() &&
( mNameConfigurationEditor.isModified() ) )
{
int option = JOptionPane.showConfirmDialog( ChannelEditor.this,
"This channel configuration has changed. Do you want to save these changes?",
"Save Changes?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
if( option == JOptionPane.YES_OPTION )
{
save();
}
setModified( false );
}
mNameConfigurationEditor.setItem( channel );
mSourceConfigurationEditor.setItem( channel );
mDecodeConfigurationEditor.setItem( channel );
mAuxDecodeConfigurationEditor.setItem( channel );
mEventLogConfiguraitonEditor.setItem( channel );
mRecordConfigurationEditor.setItem( channel );
if( channel != null )
{
@@ -116,77 +123,73 @@ public class ChannelEditor extends JPanel
mEnableButton.setEnabled( false );
mEnableButton.setBackground( getBackground() );
}
mChannel = channel;
}
private void initGUI()
private void init()
{
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][][][grow]" ) );
setLayout( new MigLayout( "fill,wrap 3", "[grow,fill][grow,fill][grow,fill]", "[][][][][grow]" ) );
mEnableButton.addActionListener( this );
mEnableButton.setEnabled( false );
add( mEnableButton, "growx,push" );
add( mChannelName, "growx,push" );
add( mChannelName, "wrap" );
add( new JSeparator( JSeparator.HORIZONTAL ), "span,growx,push" );
JideTabbedPane tabs = new JideTabbedPane();
tabs.setFont( this.getFont() );
tabs.setForeground( Color.BLACK );
tabs.setTabTrailingComponent( mChannelName );
tabs.addTab( "Name/Alias", mNameConfigurationEditor );
mSourceEditor = new SourceComponentEditor( mSourceManager );
tabs.addTab( "Source", mSourceEditor );
mSourceConfigurationEditor = new SourceConfigurationEditor( mSourceManager );
tabs.addTab( "Source", mSourceConfigurationEditor );
mDecodeEditor = new DecodeComponentEditor( mChannelMapModel );
tabs.addTab( "Decoder", mDecodeEditor );
mDecodeConfigurationEditor = new DecodeConfigurationEditor( mChannelMapModel );
tabs.addTab( "Decoder", mDecodeConfigurationEditor );
mAuxDecodeEditor = new AuxDecodeComponentEditor();
tabs.addTab( "Aux Decoders", mAuxDecodeEditor );
mAuxDecodeConfigurationEditor = new AuxDecodeConfigurationEditor();
tabs.addTab( "Aux Decoders", mAuxDecodeConfigurationEditor );
mEventLogEditor = new EventLogComponentEditor();
tabs.addTab( "Logging", mEventLogEditor );
mEventLogConfiguraitonEditor = new EventLogConfigurationEditor();
tabs.addTab( "Logging", mEventLogConfiguraitonEditor );
mRecordEditor = new RecordComponentEditor();
tabs.addTab( "Recording", mRecordEditor );
mRecordConfigurationEditor = new RecordConfigurationEditor();
tabs.addTab( "Recording", mRecordConfigurationEditor );
add( tabs, "span" );
mEnableButton.addActionListener( this );
mEnableButton.setEnabled( false );
add( mEnableButton );
add( tabs, "span,grow,push" );
JButton btnSave = new JButton( "Save" );
btnSave.addActionListener( ChannelEditor.this );
add( btnSave, "growx,push" );
add( btnSave );
JButton btnReset = new JButton( "Reset" );
btnReset.addActionListener( ChannelEditor.this );
add( btnReset, "growx,push" );
add( btnReset );
}
@Override
public void channelChanged( ChannelEvent event )
{
if( mChannel != null && mChannel == event.getChannel() )
if( hasItem() && getItem() == event.getChannel() )
{
switch( event.getEvent() )
{
case NOTIFICATION_CONFIGURATION_CHANGE:
case NOTIFICATION_PROCESSING_START:
case NOTIFICATION_PROCESSING_STOP:
setChannel( mChannel );
setItem( getItem() );
mChannelEnableRequested = false;
break;
case NOTIFICATION_DELETE:
mChannel = null;
setChannel( mChannel );
setItem( null );
break;
case NOTIFICATION_ENABLE_REJECTED:
if( mChannelEnableRequested )
{
JOptionPane.showMessageDialog( ChannelEditor.this,
"Channel could not be enabled. This is likely because "
+ "there are no tuner channels available", "Couldn't "
+ "enable channel", JOptionPane.INFORMATION_MESSAGE );
JOptionPane.showMessageDialog( ChannelEditor.this, "Channel could not be "
+ "enabled. This is likely because there are no tuner channels "
+ "available", "Couldn't enable channel", JOptionPane.INFORMATION_MESSAGE );
mChannelEnableRequested = false;
}
@@ -195,7 +198,6 @@ public class ChannelEditor extends JPanel
break;
}
}
}
@Override
@@ -205,17 +207,17 @@ public class ChannelEditor extends JPanel
if( command.contentEquals( "Enable" ) )
{
if( mChannel != null )
if( hasItem() )
{
mChannelEnableRequested = true;
mChannelModel.broadcast( new ChannelEvent( mChannel, Event.REQUEST_ENABLE ) );
mChannelModel.broadcast( new ChannelEvent( getItem(), Event.REQUEST_ENABLE ) );
}
}
else if( command.contentEquals( "Disable" ) )
{
if( mChannel != null )
if( hasItem() )
{
mChannelModel.broadcast( new ChannelEvent( mChannel, Event.REQUEST_DISABLE ) );
mChannelModel.broadcast( new ChannelEvent( getItem(), Event.REQUEST_DISABLE ) );
}
}
else if( command.contentEquals( "Save" ) )
@@ -224,90 +226,50 @@ public class ChannelEditor extends JPanel
}
else if( command.contentEquals( "Reset" ) )
{
setChannel( mChannel );
setItem( getItem() );
}
}
public void save()
{
try
{
//Validate each of the configuration editors to check for errors
mNameConfigurationEditor.validateConfiguration();
mSourceEditor.validateConfiguration();
mDecodeEditor.validateConfiguration();
mAuxDecodeEditor.validateConfiguration();
mEventLogEditor.validateConfiguration();
//Validate the source configuration against the decode editor to
//ensure that the source type is compatible with the decode type
//Validate the aux decoders against the primary decoder
//TODO: make sure that no aux decoders are running with P25
// /**
// * Validate the source configuration against the other component
// * configuration editors
// */
// validate( mSourceEditor.getSourceEditor() );
if( hasItem() )
{
// try
// {
//TODO: validate the source editor against the decode editor
//TODO: validate the aux editor against the decode editor - verify no aux decoders with P25
// }
// catch( ConfigurationValidationException e )
// {
// /* ChannelValidationException can be thrown by any of the component
// * editors. Show the validation error text in a popup menu to the
// * user and set the focus on the error component */
// JOptionPane.showMessageDialog( ChannelEditor.this,
// validationException.getMessage(),
// "Channel Configuration Error",
// JOptionPane.ERROR_MESSAGE );
//
// mSourceEditor.save();
// mDecodeEditor.save();
// mAuxDecodeEditor.save();
// mEventLogEditor.save();
// mRecordEditor.save();
//
// mChannel.setName( mChannelName.getText() );
// mChannel.setEnabled( mChannelEnabled.isSelected() );
//
// AliasList selected = mComboAliasLists.getItemAt(
// mComboAliasLists.getSelectedIndex() );
// if( selected != null )
// {
// mChannel.setAliasListName( selected.getName() );
// }
}
catch ( ConfigurationValidationException validationException )
{
/* ChannelValidationException can be thrown by any of the component
* editors. Show the validation error text in a popup menu to the
* user and set the focus on the error component */
JOptionPane.showMessageDialog( ChannelEditor.this,
validationException.getMessage(),
"Channel Configuration Error",
JOptionPane.ERROR_MESSAGE );
// Component component = validationException.getComponent();
//
// if( component != null )
// {
// component.requestFocus();
// }
//
// return;
// }
Component component = validationException.getComponent();
if( component != null )
{
component.requestFocus();
}
return;
}
mNameConfigurationEditor.save();
mSourceConfigurationEditor.save();
mDecodeConfigurationEditor.save();
mAuxDecodeConfigurationEditor.save();
mEventLogConfiguraitonEditor.save();
mRecordConfigurationEditor.save();
//Save the contents of each editor to the channel configuration
mNameConfigurationEditor.save();
mSourceEditor.save();
mDecodeEditor.save();
mAuxDecodeEditor.save();
mEventLogEditor.save();
//Broadcast a channel configuration change event
mChannelModel.broadcast( new ChannelEvent( mChannel,
Event.NOTIFICATION_CONFIGURATION_CHANGE ) );
//Broadcast a channel configuration change event
mChannelModel.broadcast( new ChannelEvent( getItem(), Event.NOTIFICATION_CONFIGURATION_CHANGE ) );
}
setModified( false );
}
// /**
// * Validate the specified editor against each of the component editors
// */
// @Override
// public void validate( ChannelConfigurationEditor editor ) throws ConfigurationValidationException
// {
// mSourceEditor.validate( editor );
// mDecodeEditor.validate( editor );
// mAuxDecodeEditor.validate( editor );
// mEventLogEditor.validate( editor );
// mRecordEditor.validate( editor );
// }
}

View File

@@ -17,6 +17,8 @@
******************************************************************************/
package controller.channel;
import gui.editor.Editor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collections;
@@ -24,43 +26,55 @@ import java.util.List;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.miginfocom.swing.MigLayout;
import playlist.PlaylistManager;
import alias.AliasModel;
public class NameConfigurationEditor extends ChannelConfigurationEditor
public class NameConfigurationEditor extends Editor<Channel> implements DocumentListener
{
private static final long serialVersionUID = 1L;
private static final String DEFAULT_NAME = "Please select a channel to view/edit";
private final static Logger mLog = LoggerFactory.getLogger( NameConfigurationEditor.class );
private static ComboBoxModel<String> EMPTY_MODEL = new DefaultComboBoxModel<>();
private AliasModel mAliasModel;
private ChannelModel mChannelModel;
private JTextField mChannelName = new JTextField( DEFAULT_NAME );
private JComboBox<String> mSystemNameCombo = new JComboBox<>( EMPTY_MODEL );
private JComboBox<String> mSiteNameCombo = new JComboBox<>( EMPTY_MODEL );
private JTextField mChannelName;
private JComboBox<String> mSystemNameCombo;
private JComboBox<String> mSiteNameCombo;
private JComboBox<String> mAliasListCombo;
private Channel mChannel;
public NameConfigurationEditor( AliasModel aliasModel, ChannelModel model )
{
mAliasModel = aliasModel;
mChannelModel = model;
setLayout( new MigLayout( "fill,wrap 2", "[right][]", "[][][][][][grow]" ) );
init();
}
private void init()
{
setLayout( new MigLayout( "fill,wrap 4", "[right][grow,fill][right][grow,fill]", "[][][grow]" ) );
mChannelName = new JTextField( "" );
mChannelName.getDocument().addDocumentListener( this );
mChannelName.setEnabled( false );
add( new JLabel( "Name:" ) );
add( mChannelName, "growx" );
add( mChannelName );
mSystemNameCombo = new JComboBox<>( EMPTY_MODEL );
mSystemNameCombo.setEnabled( false );
mSystemNameCombo.setEditable( true );
mSystemNameCombo.addActionListener( new ActionListener()
{
@@ -75,9 +89,9 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
List<String> sites = mChannelModel.getSites( system );
if( !sites.contains( mChannel.getSite() ) )
if( !sites.contains( getItem().getSite() ) )
{
sites.add( mChannel.getSite() );
sites.add( getItem().getSite() );
}
if( sites.isEmpty() )
@@ -90,110 +104,99 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
sites.toArray( new String[ sites.size() ] ) ) );;
}
mSiteNameCombo.setSelectedItem( mChannel.getSite() );
mSiteNameCombo.setSelectedItem( getItem().getSite() );
}
setModified( true );
}
} );
add( new JLabel( "System:" ) );
add( mSystemNameCombo, "growx" );
mSiteNameCombo.setEditable( true );
add( new JLabel( "Site:" ) );
add( mSiteNameCombo, "growx" );
/**
* ComboBox: Alias Lists
*/
add( new JLabel( "Alias List:" ) );
add( mSystemNameCombo );
mAliasListCombo = new JComboBox<String>();
List<String> lists = mAliasModel.getListNames();
Collections.sort( lists );
mAliasListCombo.setEnabled( false );
mAliasListCombo.setEditable( true );
mAliasListCombo.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
setModified( true );
}
} );
mAliasListCombo.setModel( new DefaultComboBoxModel<String>(
lists.toArray( new String[ lists.size() ] ) ) );
add( new JLabel( "Alias List:" ) );
add( mAliasListCombo );
add( mAliasListCombo, "growx" );
mSiteNameCombo = new JComboBox<>( EMPTY_MODEL );
mSiteNameCombo.setEnabled( false );
mSiteNameCombo.setEditable( true );
mSiteNameCombo.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
setModified( true );
}
} );
add( new JLabel() );
final JButton aliasListButton = new JButton( "New Alias List ..." );
// aliasListButton.addActionListener( new ActionListener()
// {
// @Override
// public void actionPerformed( ActionEvent e )
// {
// String name = JOptionPane.showInputDialog( aliasListButton,
// "Please enter an Alias List name:" );
//
// if( name != null && !name.isEmpty() )
// {
// AliasListOld aliasList = new AliasListOld( name );
//
// mPlaylistManager.getPlayist().getAliasDirectory()
// .addAliasList( aliasList );
//
// mPlaylistManager.save();
//
// List<AliasListOld> lists = mPlaylistManager.getPlayist()
// .getAliasDirectory().getAliasList();
//
// Collections.sort( lists );
//
// mAliasListCombo.setModel( new DefaultComboBoxModel<AliasListOld>(
// lists.toArray( new AliasListOld[ lists.size() ] ) ) );
//
// mAliasListCombo.setSelectedItem( aliasList );
// }
// }
// } );
add( aliasListButton, "growx" );
add( new JLabel( "Site:" ) );
add( mSiteNameCombo );
}
@Override
public void save()
{
if( mChannel != null )
if( hasItem() && isModified() )
{
mChannel.setName( mChannelName.getText() );
getItem().setName( mChannelName.getText() );
Object system = mSystemNameCombo.getSelectedItem();
mChannel.setSystem( ( system == null ? null : (String)system ) );
getItem().setSystem( ( system == null ? null : (String)system ) );
Object site = mSiteNameCombo.getSelectedItem();
mChannel.setSite( ( site == null ? null : (String)site ) );
getItem().setSite( ( site == null ? null : (String)site ) );
Object aliasList = mAliasListCombo.getSelectedItem();
mChannel.setAliasListName( aliasList == null ? null : (String)aliasList );
getItem().setAliasListName( aliasList == null ? null : (String)aliasList );
}
setModified( false );
}
private void setControlsEnabled( boolean enabled )
{
if( mChannelName.isEnabled() != enabled )
{
mChannelName.setEnabled( enabled );
}
if( mAliasListCombo.isEnabled() != enabled )
{
mAliasListCombo.setEnabled( enabled );
}
if( mSystemNameCombo.isEnabled() != enabled )
{
mSystemNameCombo.setEnabled( enabled );
}
if( mSiteNameCombo.isEnabled() != enabled )
{
mSiteNameCombo.setEnabled( enabled );
}
}
@Override
public void validateConfiguration() throws ConfigurationValidationException
public void setItem( Channel channel )
{
//System and site can be null, but we must (should?) have a channel name
String name = mChannelName.getText();
super.setItem( channel );
if( name == null || name.isEmpty() )
{
throw new ConfigurationValidationException(
mChannelName, "Channel name cannot be empty" );
}
}
@Override
public void setConfiguration( Channel channel )
{
mChannel = channel;
if( mChannel != null )
if( hasItem() )
{
setControlsEnabled( true );
mChannelName.setText( channel.getName() );
List<String> systems = mChannelModel.getSystems();
@@ -221,21 +224,43 @@ public class NameConfigurationEditor extends ChannelConfigurationEditor
mSiteNameCombo.setModel( new DefaultComboBoxModel<String>(
sites.toArray( new String[ sites.size() ] ) ) );;
}
mSiteNameCombo.setSelectedItem( channel.getSite() );
String aliasListName = mChannel.getAliasListName();
if( aliasListName != null )
{
mAliasListCombo.setSelectedItem( aliasListName );
}
if( channel.getSite() != null )
{
mSiteNameCombo.setSelectedItem( channel.getSite() );
}
List<String> lists = mAliasModel.getListNames();
Collections.sort( lists );
mAliasListCombo.setModel( new DefaultComboBoxModel<String>(
lists.toArray( new String[ lists.size() ] ) ) );
if( channel.getAliasListName() != null )
{
mAliasListCombo.setSelectedItem( channel.getAliasListName() );
}
}
else
{
mChannelName.setText( DEFAULT_NAME );
mSystemNameCombo.setModel( EMPTY_MODEL );
mSiteNameCombo.setModel( EMPTY_MODEL );
setControlsEnabled( false );
mChannelName.setText( null );
}
setModified( false );
}
@Override
public void insertUpdate( DocumentEvent e )
{
setModified( true );
}
@Override
public void changedUpdate( DocumentEvent e )
{
setModified( true );
}
@Override
public void removeUpdate( DocumentEvent e ) {}
}