#82 WIP - converted all classes to get icons from IconManager and removed icon management from the SettingsManager

This commit is contained in:
Denny
2017-01-08 21:06:02 -05:00
parent 488dc9da4c
commit b6498d048a
43 changed files with 4809 additions and 5084 deletions

View File

@@ -1,26 +1,38 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import alias.AliasList;
import alias.AliasModel;
import audio.AudioModule;
import controller.channel.Channel;
import controller.channel.Channel.ChannelType;
import controller.channel.ChannelModel;
import controller.channel.ChannelProcessingManager;
import controller.channel.map.ChannelMap;
import controller.channel.map.ChannelMapModel;
import filter.AllPassFilter;
import filter.FilterSet;
import filter.IFilter;
import gui.editor.EmptyValidatingEditor;
import gui.editor.ValidatingEditor;
import icon.IconManager;
import message.Message;
import message.MessageDirection;
import module.Module;
@@ -95,479 +107,460 @@ import record.RecorderType;
import record.config.RecordConfiguration;
import settings.SettingsManager;
import util.TimeStamp;
import alias.AliasList;
import alias.AliasModel;
import audio.AudioModule;
import controller.channel.Channel;
import controller.channel.Channel.ChannelType;
import controller.channel.ChannelModel;
import controller.channel.ChannelProcessingManager;
import controller.channel.map.ChannelMap;
import controller.channel.map.ChannelMapModel;
import filter.AllPassFilter;
import filter.FilterSet;
import filter.IFilter;
import gui.editor.EmptyValidatingEditor;
import gui.editor.ValidatingEditor;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class DecoderFactory
{
public static final boolean NO_REMOVE_DC = false;
public static final boolean REMOVE_DC = true;
public static final int NO_FREQUENCY_CORRECTION = 0;
/**
* Returns a list of one primary decoder and any auxiliary decoders, as
* specified in the configurations.
*
* @return list of configured decoders
*/
public static List<Module> getModules( ChannelModel channelModel,
ChannelMapModel channelMapModel,
ChannelProcessingManager channelProcessingManager,
AliasModel aliasModel,
Channel channel )
{
/* Get the optional alias list for the decode modules to use */
AliasList aliasList = aliasModel.getAliasList( channel.getAliasListName() );
List<Module> modules = getPrimaryModules( channelModel, channelMapModel,
channelProcessingManager, aliasList, channel );
modules.addAll( getAuxiliaryDecoders( channel.getAuxDecodeConfiguration(), aliasList ) );
return modules;
}
/**
* Constructs a primary decoder as specified in the decode configuration
*/
public static List<Module> getPrimaryModules( ChannelModel channelModel,
ChannelMapModel channelMapModel,
ChannelProcessingManager channelProcessingManager,
AliasList aliasList,
Channel channel )
{
List<Module> modules = new ArrayList<Module>();
public static final boolean NO_REMOVE_DC = false;
public static final boolean REMOVE_DC = true;
ChannelType channelType = channel.getChannelType();
public static final int NO_FREQUENCY_CORRECTION = 0;
/**
* Returns a list of one primary decoder and any auxiliary decoders, as
* specified in the configurations.
*
* @return list of configured decoders
*/
public static List<Module> getModules(ChannelModel channelModel,
ChannelMapModel channelMapModel,
ChannelProcessingManager channelProcessingManager,
AliasModel aliasModel,
Channel channel)
{
/* Get the optional alias list for the decode modules to use */
AliasList aliasList = aliasModel.getAliasList(channel.getAliasListName());
List<Module> modules = getPrimaryModules(channelModel, channelMapModel,
channelProcessingManager, aliasList, channel);
modules.addAll(getAuxiliaryDecoders(channel.getAuxDecodeConfiguration(), aliasList));
return modules;
}
/**
* Constructs a primary decoder as specified in the decode configuration
*/
public static List<Module> getPrimaryModules(ChannelModel channelModel,
ChannelMapModel channelMapModel,
ChannelProcessingManager channelProcessingManager,
AliasList aliasList,
Channel channel)
{
List<Module> modules = new ArrayList<Module>();
ChannelType channelType = channel.getChannelType();
/* Baseband low-pass filter pass and stop frequencies */
DecodeConfiguration decodeConfig = channel.getDecodeConfiguration();
int iqPass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
int iqStop = iqPass + 1250;
DecodeConfiguration decodeConfig = channel.getDecodeConfiguration();
RecordConfiguration recordConfig = channel.getRecordConfiguration();
boolean recordAudio = recordConfig == null ? false :
recordConfig.getRecorders().contains( RecorderType.AUDIO );
switch( decodeConfig.getDecoderType() )
{
case AM:
modules.add( new AMDecoder( decodeConfig ) );
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.AM, channel.getName() ) );
modules.add( new AMDemodulatorModule() );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case NBFM:
modules.add( new NBFMDecoder( decodeConfig ) );
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.NBFM, channel.getName() ) );
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case LTR_STANDARD:
MessageDirection direction = ((DecodeConfigLTRStandard)decodeConfig).getMessageDirection();
modules.add( new LTRStandardDecoder( aliasList, direction ) );
modules.add( new LTRStandardDecoderState( aliasList ) );
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case LTR_NET:
modules.add( new LTRNetDecoder( (DecodeConfigLTRNet)decodeConfig, aliasList ) );
modules.add( new LTRNetDecoderState( aliasList ) );
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case MPT1327:
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327)decodeConfig;
ChannelMap channelMap = channelMapModel
.getChannelMap( mptConfig.getChannelMapName() );
Sync sync = mptConfig.getSync();
modules.add( new MPT1327Decoder( aliasList, sync ) );
modules.add( new MPT1327DecoderState( aliasList, channelMap,
channelType, mptConfig.getCallTimeout() * 1000 ) );
int iqPass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
int iqStop = iqPass + 1250;
if( channelType == ChannelType.STANDARD )
{
long timeout = mptConfig.getCallTimeout() * 1000; //convert to milliseconds
RecordConfiguration recordConfig = channel.getRecordConfiguration();
modules.add( new TrafficChannelManager( channelModel, channelProcessingManager,
decodeConfig, recordConfig, channel.getSystem(),
channel.getSite(), ( aliasList != null ? aliasList.getName() : null ), timeout,
mptConfig.getTrafficChannelPoolSize() ) );
}
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case PASSPORT:
modules.add( new PassportDecoder( decodeConfig, aliasList ) );
modules.add( new PassportDecoderState( aliasList ) );
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case P25_PHASE1:
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1)decodeConfig;
boolean recordAudio = recordConfig == null ? false :
recordConfig.getRecorders().contains(RecorderType.AUDIO);
Modulation modulation = p25Config.getModulation();
switch( modulation )
{
case C4FM:
modules.add( new FMDemodulatorModule( 6750, 7500 ) );
modules.add( new P25_C4FMDecoder( aliasList, decodeConfig.getAFCMaximumCorrection() ) );
modules.add( new P25DecoderState( aliasList, channelType,
Modulation.C4FM, p25Config.getIgnoreDataCalls() ) );
break;
case CQPSK:
modules.add( new P25_LSMDecoder( aliasList ) );
modules.add( new P25DecoderState( aliasList, channelType,
Modulation.CQPSK, p25Config.getIgnoreDataCalls() ) );
break;
default:
throw new IllegalArgumentException( "Unrecognized P25 "
+ "Phase 1 Modulation [" + modulation + "]" );
}
switch(decodeConfig.getDecoderType())
{
case AM:
modules.add(new AMDecoder(decodeConfig));
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.AM, channel.getName()));
modules.add(new AMDemodulatorModule());
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule(recordAudio));
break;
case NBFM:
modules.add(new NBFMDecoder(decodeConfig));
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.NBFM, channel.getName()));
modules.add(new FMDemodulatorModule(iqPass, iqStop));
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule(recordAudio));
break;
case LTR_STANDARD:
MessageDirection direction = ((DecodeConfigLTRStandard) decodeConfig).getMessageDirection();
modules.add(new LTRStandardDecoder(aliasList, direction));
modules.add(new LTRStandardDecoderState(aliasList));
modules.add(new FMDemodulatorModule(iqPass, iqStop));
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule(recordAudio));
break;
case LTR_NET:
modules.add(new LTRNetDecoder((DecodeConfigLTRNet) decodeConfig, aliasList));
modules.add(new LTRNetDecoderState(aliasList));
modules.add(new FMDemodulatorModule(iqPass, iqStop));
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule(recordAudio));
break;
case MPT1327:
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327) decodeConfig;
if( channelType == ChannelType.STANDARD )
{
//Set call timeout to 3 seconds for P25 traffic channels
long timeout = 3000;
ChannelMap channelMap = channelMapModel
.getChannelMap(mptConfig.getChannelMapName());
modules.add( new TrafficChannelManager( channelModel,
channelProcessingManager, decodeConfig,
recordConfig, channel.getSystem(), channel.getSite(),
( aliasList != null ? aliasList.getName() : null ), timeout,
p25Config.getTrafficChannelPoolSize() ) );
}
modules.add( new P25AudioModule( recordAudio ) );
break;
default:
throw new IllegalArgumentException(
"Unknown decoder type [" +
decodeConfig.getDecoderType().toString() + "]" );
}
return modules;
}
/**
* Constructs a list of auxiliary decoders, as specified in the configuration
*
* @param config - auxiliary configuration
* @param aliasList - optional alias list
* @return - list of auxiliary decoders
*/
public static List<Module> getAuxiliaryDecoders( AuxDecodeConfiguration config,
AliasList aliasList )
{
List<Module> modules = new ArrayList<>();
Sync sync = mptConfig.getSync();
if( config != null )
{
for( DecoderType auxDecoder: config.getAuxDecoders() )
{
switch( auxDecoder )
{
case FLEETSYNC2:
modules.add( new Fleetsync2Decoder( aliasList ) );
modules.add( new Fleetsync2DecoderState( aliasList ) );
break;
case MDC1200:
modules.add( new MDCDecoder( aliasList ) );
modules.add( new MDCDecoderState( aliasList ) );
break;
case LJ_1200:
modules.add( new LJ1200Decoder( aliasList ) );
modules.add( new LJ1200DecoderState( aliasList ) );
break;
case TAIT_1200:
modules.add( new Tait1200Decoder( aliasList ) );
modules.add( new Tait1200DecoderState( aliasList ) );
break;
default:
throw new IllegalArgumentException( "Unrecognized auxiliary "
+ "decoder type [" + auxDecoder + "]" );
}
}
}
return modules;
}
modules.add(new MPT1327Decoder(aliasList, sync));
public static DecoderPanel getDecoderPanel( SettingsManager settingsManager,
DecoderState decoderState )
{
switch( decoderState.getDecoderType() )
{
case AM:
return new AMDecoderPanel( settingsManager, decoderState );
case FLEETSYNC2:
return new Fleetsync2DecoderPanel( settingsManager,
(Fleetsync2DecoderState)decoderState );
case LJ_1200:
return new LJ1200DecoderPanel( settingsManager,
(LJ1200DecoderState)decoderState );
case LTR_NET:
return new LTRNetDecoderPanel( settingsManager,
(LTRNetDecoderState)decoderState );
case LTR_STANDARD:
return new LTRStandardDecoderPanel( settingsManager,
(LTRStandardDecoderState)decoderState );
case MDC1200:
return new MDCDecoderPanel( settingsManager,
(MDCDecoderState)decoderState );
case MPT1327:
return new MPT1327DecoderPanel( settingsManager,
(MPT1327DecoderState)decoderState );
case NBFM:
return new NBFMDecoderPanel( settingsManager, decoderState );
case P25_PHASE1:
return new P25DecoderPanel( settingsManager,
(P25DecoderState)decoderState );
case PASSPORT:
return new PassportDecoderPanel( settingsManager,
(PassportDecoderState)decoderState );
case TAIT_1200:
return new Tait1200DecoderPanel( settingsManager,
(Tait1200DecoderState)decoderState );
default:
throw new IllegalArgumentException( "Unrecognized decoder: " +
decoderState.getDecoderType().getDisplayString() );
}
}
/**
* Assembles a filter set containing filters for the primary channel
* decoder and each of the auxiliary decoders
*/
public static FilterSet<Message> getMessageFilters( List<Module> modules )
{
FilterSet<Message> filterSet = new FilterSet<>();
for( Module module: modules )
{
if( module instanceof Decoder )
{
filterSet.addFilters( getMessageFilter(
((Decoder)module).getDecoderType() ) );
}
}
modules.add(new MPT1327DecoderState(aliasList, channelMap,
channelType, mptConfig.getCallTimeout() * 1000));
if(channelType == ChannelType.STANDARD)
{
long timeout = mptConfig.getCallTimeout() * 1000; //convert to milliseconds
modules.add(new TrafficChannelManager(channelModel, channelProcessingManager,
decodeConfig, recordConfig, channel.getSystem(),
channel.getSite(), (aliasList != null ? aliasList.getName() : null), timeout,
mptConfig.getTrafficChannelPoolSize()));
}
modules.add(new FMDemodulatorModule(iqPass, iqStop));
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule(recordAudio));
break;
case PASSPORT:
modules.add(new PassportDecoder(decodeConfig, aliasList));
modules.add(new PassportDecoderState(aliasList));
modules.add(new FMDemodulatorModule(iqPass, iqStop));
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule(recordAudio));
break;
case P25_PHASE1:
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1) decodeConfig;
Modulation modulation = p25Config.getModulation();
switch(modulation)
{
case C4FM:
modules.add(new FMDemodulatorModule(6750, 7500));
modules.add(new P25_C4FMDecoder(aliasList, decodeConfig.getAFCMaximumCorrection()));
modules.add(new P25DecoderState(aliasList, channelType,
Modulation.C4FM, p25Config.getIgnoreDataCalls()));
break;
case CQPSK:
modules.add(new P25_LSMDecoder(aliasList));
modules.add(new P25DecoderState(aliasList, channelType,
Modulation.CQPSK, p25Config.getIgnoreDataCalls()));
break;
default:
throw new IllegalArgumentException("Unrecognized P25 "
+ "Phase 1 Modulation [" + modulation + "]");
}
if(channelType == ChannelType.STANDARD)
{
//Set call timeout to 3 seconds for P25 traffic channels
long timeout = 3000;
modules.add(new TrafficChannelManager(channelModel,
channelProcessingManager, decodeConfig,
recordConfig, channel.getSystem(), channel.getSite(),
(aliasList != null ? aliasList.getName() : null), timeout,
p25Config.getTrafficChannelPoolSize()));
}
modules.add(new P25AudioModule(recordAudio));
break;
default:
throw new IllegalArgumentException(
"Unknown decoder type [" +
decodeConfig.getDecoderType().toString() + "]");
}
return modules;
}
/**
* Constructs a list of auxiliary decoders, as specified in the configuration
*
* @param config - auxiliary configuration
* @param aliasList - optional alias list
* @return - list of auxiliary decoders
*/
public static List<Module> getAuxiliaryDecoders(AuxDecodeConfiguration config,
AliasList aliasList)
{
List<Module> modules = new ArrayList<>();
if(config != null)
{
for(DecoderType auxDecoder : config.getAuxDecoders())
{
switch(auxDecoder)
{
case FLEETSYNC2:
modules.add(new Fleetsync2Decoder(aliasList));
modules.add(new Fleetsync2DecoderState(aliasList));
break;
case MDC1200:
modules.add(new MDCDecoder(aliasList));
modules.add(new MDCDecoderState(aliasList));
break;
case LJ_1200:
modules.add(new LJ1200Decoder(aliasList));
modules.add(new LJ1200DecoderState(aliasList));
break;
case TAIT_1200:
modules.add(new Tait1200Decoder(aliasList));
modules.add(new Tait1200DecoderState(aliasList));
break;
default:
throw new IllegalArgumentException("Unrecognized auxiliary "
+ "decoder type [" + auxDecoder + "]");
}
}
}
return modules;
}
public static DecoderPanel getDecoderPanel(IconManager iconManager, SettingsManager settingsManager,
DecoderState decoderState)
{
switch(decoderState.getDecoderType())
{
case AM:
return new AMDecoderPanel(iconManager, settingsManager, decoderState);
case FLEETSYNC2:
return new Fleetsync2DecoderPanel(iconManager, settingsManager, (Fleetsync2DecoderState) decoderState);
case LJ_1200:
return new LJ1200DecoderPanel(iconManager, settingsManager, (LJ1200DecoderState) decoderState);
case LTR_NET:
return new LTRNetDecoderPanel(iconManager, settingsManager, (LTRNetDecoderState) decoderState);
case LTR_STANDARD:
return new LTRStandardDecoderPanel(iconManager, settingsManager, (LTRStandardDecoderState) decoderState);
case MDC1200:
return new MDCDecoderPanel(iconManager, settingsManager, (MDCDecoderState) decoderState);
case MPT1327:
return new MPT1327DecoderPanel(iconManager, settingsManager, (MPT1327DecoderState) decoderState);
case NBFM:
return new NBFMDecoderPanel(iconManager, settingsManager, decoderState);
case P25_PHASE1:
return new P25DecoderPanel(iconManager, settingsManager, (P25DecoderState) decoderState);
case PASSPORT:
return new PassportDecoderPanel(iconManager, settingsManager, (PassportDecoderState) decoderState);
case TAIT_1200:
return new Tait1200DecoderPanel(iconManager, settingsManager, (Tait1200DecoderState) decoderState);
default:
throw new IllegalArgumentException("Unrecognized decoder: " +
decoderState.getDecoderType().getDisplayString());
}
}
/**
* Assembles a filter set containing filters for the primary channel
* decoder and each of the auxiliary decoders
*/
public static FilterSet<Message> getMessageFilters(List<Module> modules)
{
FilterSet<Message> filterSet = new FilterSet<>();
for(Module module : modules)
{
if(module instanceof Decoder)
{
filterSet.addFilters(getMessageFilter(
((Decoder) module).getDecoderType()));
}
}
/* If we don't have any filters, add an ALL-PASS filter */
if( filterSet.getFilters().isEmpty() )
{
filterSet.addFilter( new AllPassFilter<Message>() );
}
if(filterSet.getFilters().isEmpty())
{
filterSet.addFilter(new AllPassFilter<Message>());
}
return filterSet;
}
/**
* Returns a set of IMessageFilter objects (FilterSets or Filters) that
* can process all of the messages produced by the specified decoder type.
*/
public static List<IFilter<Message>> getMessageFilter( DecoderType decoder )
{
ArrayList<IFilter<Message>> filters = new ArrayList<IFilter<Message>>();
return filterSet;
}
switch( decoder )
{
case FLEETSYNC2:
filters.add( new FleetsyncMessageFilter() );
break;
case LJ_1200:
filters.add( new LJ1200MessageFilter() );
break;
case LTR_NET:
filters.add( new LTRNetMessageFilter() );
break;
case LTR_STANDARD:
filters.add( new LTRStandardMessageFilter() );
break;
case MDC1200:
filters.add( new MDCMessageFilter() );
break;
case MPT1327:
filters.add( new MPT1327MessageFilter() );
break;
case P25_PHASE1:
case P25_PHASE2:
filters.add( new P25MessageFilterSet() );
break;
case PASSPORT:
filters.add( new PassportMessageFilter() );
break;
default:
break;
}
return filters;
}
/**
* Returns a set of IMessageFilter objects (FilterSets or Filters) that
* can process all of the messages produced by the specified decoder type.
*/
public static List<IFilter<Message>> getMessageFilter(DecoderType decoder)
{
ArrayList<IFilter<Message>> filters = new ArrayList<IFilter<Message>>();
public static DecodeConfiguration getDefaultDecodeConfiguration()
{
return getDecodeConfiguration( DecoderType.NBFM );
}
public static DecodeConfiguration getDecodeConfiguration( DecoderType decoder )
{
DecodeConfiguration retVal;
switch(decoder)
{
case FLEETSYNC2:
filters.add(new FleetsyncMessageFilter());
break;
case LJ_1200:
filters.add(new LJ1200MessageFilter());
break;
case LTR_NET:
filters.add(new LTRNetMessageFilter());
break;
case LTR_STANDARD:
filters.add(new LTRStandardMessageFilter());
break;
case MDC1200:
filters.add(new MDCMessageFilter());
break;
case MPT1327:
filters.add(new MPT1327MessageFilter());
break;
case P25_PHASE1:
case P25_PHASE2:
filters.add(new P25MessageFilterSet());
break;
case PASSPORT:
filters.add(new PassportMessageFilter());
break;
default:
break;
}
switch( decoder )
{
case AM:
return new DecodeConfigAM();
case LTR_NET:
return new DecodeConfigLTRNet();
case LTR_STANDARD:
return new DecodeConfigLTRStandard();
case MPT1327:
return new DecodeConfigMPT1327();
case NBFM:
return new DecodeConfigNBFM();
case PASSPORT:
return new DecodeConfigPassport();
case P25_PHASE1:
return new DecodeConfigP25Phase1();
default:
throw new IllegalArgumentException( "DecodeConfigFactory - unknown decoder type ["
+ decoder.toString() + "]" );
}
}
public static ValidatingEditor<Channel> getEditor( DecoderType type, ChannelMapModel model )
{
switch( type )
{
case AM:
return new AMDecoderEditor();
case LTR_NET:
return new LTRNetDecoderEditor();
case LTR_STANDARD:
return new LTRStandardDecoderEditor();
case MPT1327:
return new MPT1327DecoderEditor( model );
case NBFM:
return new NBFMDecoderEditor();
case P25_PHASE1:
return new P25DecoderEditor();
case PASSPORT:
return new PassportDecoderEditor();
default:
break;
}
return new EmptyValidatingEditor<Channel>( "a decoder" );
}
return filters;
}
/**
* Creates a copy of the configuration
*/
public static DecodeConfiguration copy( DecodeConfiguration config )
{
if( config != null )
{
switch( config.getDecoderType() )
{
case AM:
DecodeConfigAM originalAM = (DecodeConfigAM)config;
DecodeConfigAM copyAM = new DecodeConfigAM();
copyAM.setAFC( originalAM.getAFC() );
copyAM.setAFCMaximumCorrection( originalAM.getAFCMaximumCorrection() );
return copyAM;
case LTR_NET:
DecodeConfigLTRNet originalLTRNet = (DecodeConfigLTRNet)config;
DecodeConfigLTRNet copyLTRNet = new DecodeConfigLTRNet();
copyLTRNet.setAFC( originalLTRNet.getAFC() );
copyLTRNet.setAFCMaximumCorrection( originalLTRNet.getAFCMaximumCorrection() );
copyLTRNet.setMessageDirection( originalLTRNet.getMessageDirection() );
return copyLTRNet;
case LTR_STANDARD:
DecodeConfigLTRStandard originalLTRStandard = (DecodeConfigLTRStandard)config;
DecodeConfigLTRStandard copyLTRStandard = new DecodeConfigLTRStandard();
copyLTRStandard.setAFC( originalLTRStandard.getAFC() );
copyLTRStandard.setAFCMaximumCorrection( originalLTRStandard.getAFCMaximumCorrection() );
copyLTRStandard.setMessageDirection( originalLTRStandard.getMessageDirection() );
return copyLTRStandard;
case MPT1327:
DecodeConfigMPT1327 originalMPT = (DecodeConfigMPT1327)config;
DecodeConfigMPT1327 copyMPT = new DecodeConfigMPT1327();
copyMPT.setAFC( originalMPT.getAFC() );
copyMPT.setAFCMaximumCorrection( originalMPT.getAFCMaximumCorrection() );
copyMPT.setCallTimeout( originalMPT.getCallTimeout() );
copyMPT.setChannelMapName( originalMPT.getChannelMapName() );
copyMPT.setSync( originalMPT.getSync() );
copyMPT.setTrafficChannelPoolSize( originalMPT.getTrafficChannelPoolSize() );
return copyMPT;
case NBFM:
DecodeConfigNBFM originalNBFM = (DecodeConfigNBFM)config;
DecodeConfigNBFM copyNBFM = new DecodeConfigNBFM();
copyNBFM.setAFC( originalNBFM.getAFC() );
copyNBFM.setAFCMaximumCorrection( originalNBFM.getAFCMaximumCorrection() );
return copyNBFM;
case P25_PHASE1:
DecodeConfigP25Phase1 originalP25 = (DecodeConfigP25Phase1)config;
DecodeConfigP25Phase1 copyP25 = new DecodeConfigP25Phase1();
copyP25.setAFC( originalP25.getAFC() );
copyP25.setAFCMaximumCorrection( originalP25.getAFCMaximumCorrection() );
copyP25.setIgnoreDataCalls( originalP25.getIgnoreDataCalls() );
copyP25.setModulation( originalP25.getModulation() );
copyP25.setTrafficChannelPoolSize( originalP25.getTrafficChannelPoolSize() );
return copyP25;
case PASSPORT:
DecodeConfigPassport originalPass = (DecodeConfigPassport)config;
DecodeConfigPassport copyPass = new DecodeConfigPassport();
copyPass.setAFC( originalPass.getAFC() );
copyPass.setAFCMaximumCorrection( originalPass.getAFCMaximumCorrection() );
return copyPass;
default:
throw new IllegalArgumentException( "Unrecognized decoder "
+ "configuration type:" + config.getDecoderType() );
}
}
return null;
}
public static DecodeConfiguration getDefaultDecodeConfiguration()
{
return getDecodeConfiguration(DecoderType.NBFM);
}
public static String getRecordingFilename( String token )
{
//Get the base recording filename
public static DecodeConfiguration getDecodeConfiguration(DecoderType decoder)
{
DecodeConfiguration retVal;
switch(decoder)
{
case AM:
return new DecodeConfigAM();
case LTR_NET:
return new DecodeConfigLTRNet();
case LTR_STANDARD:
return new DecodeConfigLTRStandard();
case MPT1327:
return new DecodeConfigMPT1327();
case NBFM:
return new DecodeConfigNBFM();
case PASSPORT:
return new DecodeConfigPassport();
case P25_PHASE1:
return new DecodeConfigP25Phase1();
default:
throw new IllegalArgumentException("DecodeConfigFactory - unknown decoder type ["
+ decoder.toString() + "]");
}
}
public static ValidatingEditor<Channel> getEditor(DecoderType type, ChannelMapModel model)
{
switch(type)
{
case AM:
return new AMDecoderEditor();
case LTR_NET:
return new LTRNetDecoderEditor();
case LTR_STANDARD:
return new LTRStandardDecoderEditor();
case MPT1327:
return new MPT1327DecoderEditor(model);
case NBFM:
return new NBFMDecoderEditor();
case P25_PHASE1:
return new P25DecoderEditor();
case PASSPORT:
return new PassportDecoderEditor();
default:
break;
}
return new EmptyValidatingEditor<Channel>("a decoder");
}
/**
* Creates a copy of the configuration
*/
public static DecodeConfiguration copy(DecodeConfiguration config)
{
if(config != null)
{
switch(config.getDecoderType())
{
case AM:
DecodeConfigAM originalAM = (DecodeConfigAM) config;
DecodeConfigAM copyAM = new DecodeConfigAM();
copyAM.setAFC(originalAM.getAFC());
copyAM.setAFCMaximumCorrection(originalAM.getAFCMaximumCorrection());
return copyAM;
case LTR_NET:
DecodeConfigLTRNet originalLTRNet = (DecodeConfigLTRNet) config;
DecodeConfigLTRNet copyLTRNet = new DecodeConfigLTRNet();
copyLTRNet.setAFC(originalLTRNet.getAFC());
copyLTRNet.setAFCMaximumCorrection(originalLTRNet.getAFCMaximumCorrection());
copyLTRNet.setMessageDirection(originalLTRNet.getMessageDirection());
return copyLTRNet;
case LTR_STANDARD:
DecodeConfigLTRStandard originalLTRStandard = (DecodeConfigLTRStandard) config;
DecodeConfigLTRStandard copyLTRStandard = new DecodeConfigLTRStandard();
copyLTRStandard.setAFC(originalLTRStandard.getAFC());
copyLTRStandard.setAFCMaximumCorrection(originalLTRStandard.getAFCMaximumCorrection());
copyLTRStandard.setMessageDirection(originalLTRStandard.getMessageDirection());
return copyLTRStandard;
case MPT1327:
DecodeConfigMPT1327 originalMPT = (DecodeConfigMPT1327) config;
DecodeConfigMPT1327 copyMPT = new DecodeConfigMPT1327();
copyMPT.setAFC(originalMPT.getAFC());
copyMPT.setAFCMaximumCorrection(originalMPT.getAFCMaximumCorrection());
copyMPT.setCallTimeout(originalMPT.getCallTimeout());
copyMPT.setChannelMapName(originalMPT.getChannelMapName());
copyMPT.setSync(originalMPT.getSync());
copyMPT.setTrafficChannelPoolSize(originalMPT.getTrafficChannelPoolSize());
return copyMPT;
case NBFM:
DecodeConfigNBFM originalNBFM = (DecodeConfigNBFM) config;
DecodeConfigNBFM copyNBFM = new DecodeConfigNBFM();
copyNBFM.setAFC(originalNBFM.getAFC());
copyNBFM.setAFCMaximumCorrection(originalNBFM.getAFCMaximumCorrection());
return copyNBFM;
case P25_PHASE1:
DecodeConfigP25Phase1 originalP25 = (DecodeConfigP25Phase1) config;
DecodeConfigP25Phase1 copyP25 = new DecodeConfigP25Phase1();
copyP25.setAFC(originalP25.getAFC());
copyP25.setAFCMaximumCorrection(originalP25.getAFCMaximumCorrection());
copyP25.setIgnoreDataCalls(originalP25.getIgnoreDataCalls());
copyP25.setModulation(originalP25.getModulation());
copyP25.setTrafficChannelPoolSize(originalP25.getTrafficChannelPoolSize());
return copyP25;
case PASSPORT:
DecodeConfigPassport originalPass = (DecodeConfigPassport) config;
DecodeConfigPassport copyPass = new DecodeConfigPassport();
copyPass.setAFC(originalPass.getAFC());
copyPass.setAFCMaximumCorrection(originalPass.getAFCMaximumCorrection());
return copyPass;
default:
throw new IllegalArgumentException("Unrecognized decoder "
+ "configuration type:" + config.getDecoderType());
}
}
return null;
}
public static String getRecordingFilename(String token)
{
//Get the base recording filename
StringBuilder sb = new StringBuilder();
sb.append( SystemProperties.getInstance()
.getApplicationFolder( "recordings" ) );
sb.append( File.separator );
sb.append( TimeStamp.getTimeStamp( "_" ) );
sb.append( "_" );
sb.append( token );
sb.append(SystemProperties.getInstance()
.getApplicationFolder("recordings"));
sb.append(File.separator);
sb.append(TimeStamp.getTimeStamp("_"));
sb.append("_");
sb.append(token);
return sb.toString();
}
}
}

View File

@@ -1,82 +1,84 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.am;
import javax.swing.JLabel;
import net.miginfocom.swing.MigLayout;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import module.decode.state.DecoderState;
import net.miginfocom.swing.MigLayout;
import settings.ColorSetting;
import settings.Setting;
import settings.SettingsManager;
import javax.swing.*;
public class AMDecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private JLabel mProtocol = new JLabel( "AM" );
public AMDecoderPanel( SettingsManager settingsManager, DecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
public void init()
{
super.init();
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
private JLabel mProtocol = new JLabel("AM");
add( mProtocol, "wrap" );
}
public AMDecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
{
super(iconManager, settingsManager, decoderState);
@Override
public void receive( final ChangedAttribute changedAttribute )
init();
}
public void init()
{
super.init();
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
mProtocol.setFont(mFontDecoder);
mProtocol.setForeground(mColorLabelDecoder);
add(mProtocol, "wrap");
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_LABEL_DECODER:
if( mProtocol != null )
{
mProtocol.setForeground( mColorLabelDecoder );
}
break;
default:
break;
}
}
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting colorSetting = (ColorSetting) setting;
switch(colorSetting.getColorSettingName())
{
case CHANNEL_STATE_LABEL_DECODER:
if(mProtocol != null)
{
mProtocol.setForeground(mColorLabelDecoder);
}
break;
default:
break;
}
}
}
}

View File

@@ -1,27 +1,28 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.event;
import javax.swing.ImageIcon;
import javax.swing.table.DefaultTableCellRenderer;
import settings.SettingsManager;
import alias.Alias;
import icon.IconManager;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
/**
* Custom renderer for JTable cells that contain Alias objects. Renders the
@@ -30,45 +31,45 @@ import alias.Alias;
*/
public class CallEventAliasCellRenderer extends DefaultTableCellRenderer
{
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private SettingsManager mSettingsManager;
public CallEventAliasCellRenderer( SettingsManager settingsManager )
{
super();
mSettingsManager = settingsManager;
}
public void setValue( Object obj )
{
if( obj != null && obj instanceof Alias )
{
Alias alias = (Alias)obj;
setText( alias.getName() );
ImageIcon icon = getIcon( alias, SettingsManager.DEFAULT_ICON_SIZE );
if( icon != null )
{
setIcon( icon );
}
}
else
{
setText( " " );
setIcon( null );
}
}
private ImageIcon getIcon( Alias alias, int height )
{
if( mSettingsManager != null && alias != null )
{
return mSettingsManager.getImageIcon( alias.getIconName(), height );
}
return null;
}
private IconManager mIconManager;
public CallEventAliasCellRenderer(IconManager iconManager)
{
super();
mIconManager = iconManager;
}
public void setValue(Object obj)
{
if(obj != null && obj instanceof Alias)
{
Alias alias = (Alias) obj;
setText(alias.getName());
ImageIcon icon = getIcon(alias, IconManager.DEFAULT_ICON_SIZE);
if(icon != null)
{
setIcon(icon);
}
}
else
{
setText(" ");
setIcon(null);
}
}
private ImageIcon getIcon(Alias alias, int height)
{
if(mIconManager != null && alias != null)
{
return mIconManager.getIcon(alias.getIconName(), height);
}
return null;
}
}

View File

@@ -1,36 +1,34 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.event;
import java.awt.EventQueue;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import module.ProcessingChain;
import net.miginfocom.swing.MigLayout;
import settings.SettingsManager;
import controller.channel.Channel;
import controller.channel.ChannelEvent;
import controller.channel.ChannelEvent.Event;
import controller.channel.ChannelEventListener;
import controller.channel.ChannelProcessingManager;
import icon.IconManager;
import module.ProcessingChain;
import net.miginfocom.swing.MigLayout;
import javax.swing.*;
import java.awt.*;
public class CallEventPanel extends JPanel implements ChannelEventListener
{
@@ -41,100 +39,91 @@ public class CallEventPanel extends JPanel implements ChannelEventListener
private CallEventAliasCellRenderer mRenderer;
private ChannelProcessingManager mChannelProcessingManager;
public CallEventPanel( SettingsManager settingsManager,
ChannelProcessingManager channelProcessingManager )
{
mChannelProcessingManager = channelProcessingManager;
setLayout( new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]") );
JTable table = new JTable( new CallEventModel() );
table.setAutoCreateRowSorter( true );
table.setAutoResizeMode( JTable.AUTO_RESIZE_LAST_COLUMN );
mRenderer = new CallEventAliasCellRenderer( settingsManager );
table.getColumnModel().getColumn( CallEventModel.FROM_ALIAS )
.setCellRenderer( mRenderer );
table.getColumnModel().getColumn( CallEventModel.TO_ALIAS )
.setCellRenderer( mRenderer );
mEmptyScroller = new JScrollPane( table );
add( mEmptyScroller );
}
@Override
public void channelChanged( final ChannelEvent event )
public CallEventPanel(IconManager iconManager, ChannelProcessingManager channelProcessingManager)
{
if( event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
event.getChannel().isSelected() )
{
if( mDisplayedChannel == null ||
( mDisplayedChannel != null &&
mDisplayedChannel != event.getChannel() ) )
{
ProcessingChain chain = mChannelProcessingManager
.getProcessingChain( event.getChannel() );
if( chain != null )
{
final CallEventModel model = chain.getCallEventModel();
if( model != null )
{
EventQueue.invokeLater( new Runnable()
{
@Override
public void run()
{
removeAll();
JTable table = new JTable( model );
mChannelProcessingManager = channelProcessingManager;
table.setAutoCreateRowSorter( true );
table.setAutoResizeMode( JTable.AUTO_RESIZE_LAST_COLUMN );
table.getColumnModel().getColumn( CallEventModel.FROM_ALIAS )
.setCellRenderer( mRenderer );
setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]"));
table.getColumnModel().getColumn( CallEventModel.TO_ALIAS )
.setCellRenderer( mRenderer );
add( new JScrollPane( table ) );
mDisplayedChannel = event.getChannel();
revalidate();
repaint();
}
} );
}
}
}
}
else if( event.getEvent() == Event.NOTIFICATION_PROCESSING_STOP ||
event.getEvent() == Event.REQUEST_DISABLE )
{
if( mDisplayedChannel != null &&
mDisplayedChannel == event.getChannel() )
{
mDisplayedChannel = null;
EventQueue.invokeLater( new Runnable()
{
@Override
public void run()
{
removeAll();
add( mEmptyScroller );
JTable table = new JTable(new CallEventModel());
table.setAutoCreateRowSorter(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
revalidate();
repaint();
}
} );
}
}
mRenderer = new CallEventAliasCellRenderer(iconManager);
table.getColumnModel().getColumn(CallEventModel.FROM_ALIAS).setCellRenderer(mRenderer);
table.getColumnModel().getColumn(CallEventModel.TO_ALIAS).setCellRenderer(mRenderer);
mEmptyScroller = new JScrollPane(table);
add(mEmptyScroller);
}
@Override
public void channelChanged(final ChannelEvent event)
{
if(event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE && event.getChannel().isSelected())
{
if(mDisplayedChannel == null || (mDisplayedChannel != null && mDisplayedChannel != event.getChannel()))
{
ProcessingChain chain = mChannelProcessingManager.getProcessingChain(event.getChannel());
if(chain != null)
{
final CallEventModel model = chain.getCallEventModel();
if(model != null)
{
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
removeAll();
JTable table = new JTable(model);
table.setAutoCreateRowSorter(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
table.getColumnModel().getColumn(CallEventModel.FROM_ALIAS)
.setCellRenderer(mRenderer);
table.getColumnModel().getColumn(CallEventModel.TO_ALIAS)
.setCellRenderer(mRenderer);
add(new JScrollPane(table));
mDisplayedChannel = event.getChannel();
revalidate();
repaint();
}
});
}
}
}
}
else if(event.getEvent() == Event.NOTIFICATION_PROCESSING_STOP || event.getEvent() == Event.REQUEST_DISABLE)
{
if(mDisplayedChannel != null && mDisplayedChannel == event.getChannel())
{
mDisplayedChannel = null;
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
removeAll();
add(mEmptyScroller);
revalidate();
repaint();
}
});
}
}
}
}

View File

@@ -1,202 +1,201 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.fleetsync2;
import java.awt.EventQueue;
import javax.swing.JLabel;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import settings.ColorSetting;
import settings.ColorSetting.ColorSettingName;
import settings.Setting;
import settings.SettingsManager;
import javax.swing.*;
import java.awt.*;
public class Fleetsync2DecoderPanel extends DecoderPanel
{
private final static Logger mLog = LoggerFactory.getLogger( Fleetsync2DecoderPanel.class );
private final static Logger mLog = LoggerFactory.getLogger(Fleetsync2DecoderPanel.class);
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private static final String PROTOCOL = "FSync II";
private JLabel mToLabel = new JLabel( " " );
private JLabel mTo = new JLabel( " " );
private JLabel mToAlias = new JLabel( " " );
private JLabel mToLabel = new JLabel(" ");
private JLabel mTo = new JLabel(" ");
private JLabel mToAlias = new JLabel(" ");
private JLabel mFromLabel = new JLabel( " " );
private JLabel mFrom = new JLabel( " " );
private JLabel mFromAlias = new JLabel( " " );
private JLabel mProtocol = new JLabel( PROTOCOL );
private JLabel mMessage = new JLabel( " " );
private JLabel mMessageType = new JLabel( " " );
public Fleetsync2DecoderPanel( SettingsManager settingsManager,
Fleetsync2DecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
private JLabel mFromLabel = new JLabel(" ");
private JLabel mFrom = new JLabel(" ");
private JLabel mFromAlias = new JLabel(" ");
@Override
public Fleetsync2DecoderState getDecoderState()
{
return (Fleetsync2DecoderState)super.getDecoderState();
}
public void dispose()
{
super.dispose();
}
protected void init()
{
/* Calling super init will get and broadcast color settings to properly
* setup the jlabel colors */
super.init();
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "[]0[]0[]") );
private JLabel mProtocol = new JLabel(PROTOCOL);
private JLabel mMessage = new JLabel(" ");
private JLabel mMessageType = new JLabel(" ");
mToLabel.setFont( mFontAuxDecoder );
mToLabel.setForeground( mColorLabelAuxDecoder );
add( mToLabel );
mTo.setFont( mFontAuxDecoder );
mTo.setForeground( mColorLabelAuxDecoder );
add( mTo );
mToAlias.setFont( mFontAuxDecoder );
mToAlias.setForeground( mColorLabelAuxDecoder );
add( mToAlias, "wrap" );
mFromLabel.setFont( mFontAuxDecoder );
mFromLabel.setForeground( mColorLabelAuxDecoder );
add( mFromLabel );
mFrom.setFont( mFontAuxDecoder );
mFrom.setForeground( mColorLabelAuxDecoder );
add( mFrom );
mFromAlias.setFont( mFontAuxDecoder );
mFromAlias.setForeground( mColorLabelAuxDecoder );
add( mFromAlias, "wrap" );
mProtocol.setFont( mFontAuxDecoder );
mProtocol.setForeground( mColorLabelAuxDecoder );
add( mProtocol );
mMessageType.setFont( mFontAuxDecoder );
mMessageType.setForeground( mColorLabelAuxDecoder );
add( mMessageType );
mMessage.setFont( mFontAuxDecoder );
mMessage.setForeground( mColorLabelAuxDecoder );
add( mMessage, "wrap" );
}
@Override
public void receive( final ChangedAttribute changedAttribute )
public Fleetsync2DecoderPanel(IconManager iconManager, SettingsManager settingsManager,
Fleetsync2DecoderState decoderState)
{
EventQueue.invokeLater( new Runnable()
{
@Override
super(iconManager, settingsManager, decoderState);
init();
}
@Override
public Fleetsync2DecoderState getDecoderState()
{
return (Fleetsync2DecoderState) super.getDecoderState();
}
public void dispose()
{
super.dispose();
}
protected void init()
{
/* Calling super init will get and broadcast color settings to properly
* setup the jlabel colors */
super.init();
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
mToLabel.setFont(mFontAuxDecoder);
mToLabel.setForeground(mColorLabelAuxDecoder);
add(mToLabel);
mTo.setFont(mFontAuxDecoder);
mTo.setForeground(mColorLabelAuxDecoder);
add(mTo);
mToAlias.setFont(mFontAuxDecoder);
mToAlias.setForeground(mColorLabelAuxDecoder);
add(mToAlias, "wrap");
mFromLabel.setFont(mFontAuxDecoder);
mFromLabel.setForeground(mColorLabelAuxDecoder);
add(mFromLabel);
mFrom.setFont(mFontAuxDecoder);
mFrom.setForeground(mColorLabelAuxDecoder);
add(mFrom);
mFromAlias.setFont(mFontAuxDecoder);
mFromAlias.setForeground(mColorLabelAuxDecoder);
add(mFromAlias, "wrap");
mProtocol.setFont(mFontAuxDecoder);
mProtocol.setForeground(mColorLabelAuxDecoder);
add(mProtocol);
mMessageType.setFont(mFontAuxDecoder);
mMessageType.setForeground(mColorLabelAuxDecoder);
add(mMessageType);
mMessage.setFont(mFontAuxDecoder);
mMessage.setForeground(mColorLabelAuxDecoder);
add(mMessage, "wrap");
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
switch( changedAttribute )
{
case FROM_TALKGROUP:
String from = getDecoderState().getFromID();
if( from != null )
{
mFromLabel.setText( "FROM:" );
mFrom.setText( from );
}
else
{
mFromLabel.setText( " " );
mFrom.setText( " " );
}
break;
case FROM_TALKGROUP_ALIAS:
setAliasLabel( mFromAlias, getDecoderState().getFromIDAlias() );
break;
case MESSAGE:
mMessage.setText( getDecoderState().getMessage() );
break;
case MESSAGE_TYPE:
mMessageType.setText( getDecoderState().getMessageType() );
break;
case TO_TALKGROUP:
String to = getDecoderState().getToID();
if( to != null )
{
mToLabel.setText( "TO:" );
mTo.setText( to );
}
else
{
mToLabel.setText( " " );
mTo.setText( " " );
}
break;
case TO_TALKGROUP_ALIAS:
setAliasLabel( mToAlias, getDecoderState().getToIDAlias() );
break;
default:
break;
}
repaint();
}
} );
}
@Override
public void settingChanged( Setting setting )
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting color = (ColorSetting)setting;
switch(changedAttribute)
{
case FROM_TALKGROUP:
String from = getDecoderState().getFromID();
if( color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER )
{
mFromLabel.setForeground( color.getColor() );
mFrom.setForeground( color.getColor() );
mFromAlias.setForeground( color.getColor() );
mToLabel.setForeground( color.getColor() );
mTo.setForeground( color.getColor() );
mToAlias.setForeground( color.getColor() );
mProtocol.setForeground( color.getColor() );
mMessageType.setForeground( color.getColor() );
mMessage.setForeground( color.getColor() );
}
}
if(from != null)
{
mFromLabel.setText("FROM:");
mFrom.setText(from);
}
else
{
mFromLabel.setText(" ");
mFrom.setText(" ");
}
break;
case FROM_TALKGROUP_ALIAS:
setAliasLabel(mFromAlias, getDecoderState().getFromIDAlias());
break;
case MESSAGE:
mMessage.setText(getDecoderState().getMessage());
break;
case MESSAGE_TYPE:
mMessageType.setText(getDecoderState().getMessageType());
break;
case TO_TALKGROUP:
String to = getDecoderState().getToID();
if(to != null)
{
mToLabel.setText("TO:");
mTo.setText(to);
}
else
{
mToLabel.setText(" ");
mTo.setText(" ");
}
break;
case TO_TALKGROUP_ALIAS:
setAliasLabel(mToAlias, getDecoderState().getToIDAlias());
break;
default:
break;
}
repaint();
}
});
}
@Override
public void settingChanged(Setting setting)
{
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting color = (ColorSetting) setting;
if(color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
{
mFromLabel.setForeground(color.getColor());
mFrom.setForeground(color.getColor());
mFromAlias.setForeground(color.getColor());
mToLabel.setForeground(color.getColor());
mTo.setForeground(color.getColor());
mToAlias.setForeground(color.getColor());
mProtocol.setForeground(color.getColor());
mMessageType.setForeground(color.getColor());
mMessage.setForeground(color.getColor());
}
}
}
}

View File

@@ -1,25 +1,25 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.lj1200;
import javax.swing.JLabel;
import alias.Alias;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import net.miginfocom.swing.MigLayout;
@@ -28,98 +28,100 @@ import settings.ColorSetting.ColorSettingName;
import settings.Setting;
import settings.SettingsManager;
import javax.swing.*;
public class LJ1200DecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private static final String PROTOCOL = "LJ-1200";
private JLabel mProtocol = new JLabel( PROTOCOL );
private JLabel mProtocol = new JLabel(PROTOCOL);
private JLabel mTo = new JLabel();
private JLabel mToAlias = new JLabel();
public LJ1200DecoderPanel( SettingsManager settingsManager, LJ1200DecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
public void dispose()
{
super.dispose();
}
protected void init()
{
/* Calling super init will get and broadcast color settings to properly
* setup the jlabel colors */
super.init();
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "" ) );
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
mTo.setFont( mFontDecoder );
mTo.setForeground( mColorLabelDecoder );
mToAlias.setFont( mFontDecoder );
mToAlias.setForeground( mColorLabelDecoder );
add( mProtocol );
add( mTo );
add( mToAlias, "wrap" );
}
public LJ1200DecoderState getDecoderState()
{
return (LJ1200DecoderState)super.getDecoderState();
}
@Override
public void receive( final ChangedAttribute changedAttribute )
public LJ1200DecoderPanel(IconManager iconManager, SettingsManager settingsManager, LJ1200DecoderState decoderState)
{
switch( changedAttribute )
{
case TO_TALKGROUP:
mTo.setText( getDecoderState().getAddress() );
repaint();
break;
case TO_TALKGROUP_ALIAS:
Alias alias = getDecoderState().getAddressAlias();
if( alias != null )
{
mToAlias.setText( alias.getName() );
}
else
{
mToAlias.setText( "" );
}
repaint();
break;
default:
break;
}
super(iconManager, settingsManager, decoderState);
init();
}
@Override
public void settingChanged( Setting setting )
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting color = (ColorSetting)setting;
if( color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER )
{
mProtocol.setForeground( color.getColor() );
mTo.setForeground( color.getColor() );
mToAlias.setForeground( color.getColor() );
}
}
public void dispose()
{
super.dispose();
}
protected void init()
{
/* Calling super init will get and broadcast color settings to properly
* setup the jlabel colors */
super.init();
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", ""));
mProtocol.setFont(mFontDecoder);
mProtocol.setForeground(mColorLabelDecoder);
mTo.setFont(mFontDecoder);
mTo.setForeground(mColorLabelDecoder);
mToAlias.setFont(mFontDecoder);
mToAlias.setForeground(mColorLabelDecoder);
add(mProtocol);
add(mTo);
add(mToAlias, "wrap");
}
public LJ1200DecoderState getDecoderState()
{
return (LJ1200DecoderState) super.getDecoderState();
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
switch(changedAttribute)
{
case TO_TALKGROUP:
mTo.setText(getDecoderState().getAddress());
repaint();
break;
case TO_TALKGROUP_ALIAS:
Alias alias = getDecoderState().getAddressAlias();
if(alias != null)
{
mToAlias.setText(alias.getName());
}
else
{
mToAlias.setText("");
}
repaint();
break;
default:
break;
}
}
@Override
public void settingChanged(Setting setting)
{
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting color = (ColorSetting) setting;
if(color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
{
mProtocol.setForeground(color.getColor());
mTo.setForeground(color.getColor());
mToAlias.setForeground(color.getColor());
}
}
}
}

View File

@@ -1,157 +1,157 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.ltrnet;
import java.awt.EventQueue;
import javax.swing.JLabel;
import alias.Alias;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import net.miginfocom.swing.MigLayout;
import settings.ColorSetting;
import settings.Setting;
import settings.SettingsManager;
import alias.Alias;
import javax.swing.*;
import java.awt.*;
public class LTRNetDecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private JLabel mProtocol = new JLabel( "LTR-Net" );
private JLabel mProtocol = new JLabel("LTR-Net");
private JLabel mTalkgroup = new JLabel();
private JLabel mTalkgroupAlias = new JLabel();
private JLabel mLCN = new JLabel( "LCN:" );
private JLabel mLCN = new JLabel("LCN:");
private JLabel mDescription = new JLabel();
public LTRNetDecoderPanel( SettingsManager settingsManager,
LTRNetDecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
public void init()
{
super.init();
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
mTalkgroup.setFont( mFontDecoder );
mTalkgroup.setForeground( mColorLabelDecoder );
mTalkgroupAlias.setFont( mFontDecoder );
mTalkgroupAlias.setForeground( mColorLabelDecoder );
mLCN.setFont( mFontDecoder );
mLCN.setForeground( mColorLabelDecoder );
mDescription.setFont( mFontDecoder );
mDescription.setForeground( mColorLabelDecoder );
add( mProtocol );
add( mTalkgroup );
add( mTalkgroupAlias, "wrap" );
add( mLCN );
add( mDescription, "span" );
}
public LTRNetDecoderState getDecoderState()
{
return (LTRNetDecoderState)super.getDecoderState();
}
@Override
public void receive( final ChangedAttribute changedAttribute )
public LTRNetDecoderPanel(IconManager iconManager, SettingsManager settingsManager, LTRNetDecoderState decoderState)
{
EventQueue.invokeLater( new Runnable()
{
@Override
super(iconManager, settingsManager, decoderState);
init();
}
public void init()
{
super.init();
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
mProtocol.setFont(mFontDecoder);
mProtocol.setForeground(mColorLabelDecoder);
mTalkgroup.setFont(mFontDecoder);
mTalkgroup.setForeground(mColorLabelDecoder);
mTalkgroupAlias.setFont(mFontDecoder);
mTalkgroupAlias.setForeground(mColorLabelDecoder);
mLCN.setFont(mFontDecoder);
mLCN.setForeground(mColorLabelDecoder);
mDescription.setFont(mFontDecoder);
mDescription.setForeground(mColorLabelDecoder);
add(mProtocol);
add(mTalkgroup);
add(mTalkgroupAlias, "wrap");
add(mLCN);
add(mDescription, "span");
}
public LTRNetDecoderState getDecoderState()
{
return (LTRNetDecoderState) super.getDecoderState();
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
LTRNetDecoderState state = getDecoderState();
LTRNetDecoderState state = getDecoderState();
switch( changedAttribute )
{
case TO_TALKGROUP:
mTalkgroup.setText( state.getToTalkgroup() );
break;
case TO_TALKGROUP_ALIAS:
Alias tgAlias = state.getToTalkgroupAlias();
setAliasLabel( mTalkgroupAlias, tgAlias );
break;
case DESCRIPTION:
mDescription.setText( state.getDescription() );
break;
case CHANNEL_NUMBER:
mLCN.setText( "LCN: " + state.getChannelNumber() );
break;
default:
break;
}
repaint();
switch(changedAttribute)
{
case TO_TALKGROUP:
mTalkgroup.setText(state.getToTalkgroup());
break;
case TO_TALKGROUP_ALIAS:
Alias tgAlias = state.getToTalkgroupAlias();
setAliasLabel(mTalkgroupAlias, tgAlias);
break;
case DESCRIPTION:
mDescription.setText(state.getDescription());
break;
case CHANNEL_NUMBER:
mLCN.setText("LCN: " + state.getChannelNumber());
break;
default:
break;
}
repaint();
}
});
});
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_LABEL_DECODER:
if( mProtocol != null )
{
mProtocol.setForeground( mColorLabelDecoder );
}
if( mTalkgroup != null )
{
mTalkgroup.setForeground( mColorLabelDecoder );
}
if( mTalkgroupAlias != null )
{
mTalkgroupAlias.setForeground( mColorLabelDecoder );
}
if( mLCN != null )
{
mLCN.setForeground( mColorLabelDecoder );
}
if( mDescription != null )
{
mDescription.setForeground( mColorLabelDecoder );
}
break;
default:
break;
}
}
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting colorSetting = (ColorSetting) setting;
switch(colorSetting.getColorSettingName())
{
case CHANNEL_STATE_LABEL_DECODER:
if(mProtocol != null)
{
mProtocol.setForeground(mColorLabelDecoder);
}
if(mTalkgroup != null)
{
mTalkgroup.setForeground(mColorLabelDecoder);
}
if(mTalkgroupAlias != null)
{
mTalkgroupAlias.setForeground(mColorLabelDecoder);
}
if(mLCN != null)
{
mLCN.setForeground(mColorLabelDecoder);
}
if(mDescription != null)
{
mDescription.setForeground(mColorLabelDecoder);
}
break;
default:
break;
}
}
}
}

View File

@@ -1,163 +1,164 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.ltrstandard;
import java.awt.EventQueue;
import javax.swing.JLabel;
import net.miginfocom.swing.MigLayout;
import alias.Alias;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import net.miginfocom.swing.MigLayout;
import settings.ColorSetting;
import settings.Setting;
import settings.SettingsManager;
import alias.Alias;
import javax.swing.*;
import java.awt.*;
public class LTRStandardDecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private JLabel mProtocol = new JLabel( "LTR Standard" );
private JLabel mProtocol = new JLabel("LTR Standard");
private JLabel mTalkgroup = new JLabel();
private JLabel mTalkgroupAlias = new JLabel();
private JLabel mLCN = new JLabel( "LCN:" );
public LTRStandardDecoderPanel( SettingsManager settingsManager,
LTRStandardDecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
public void dispose()
{
super.dispose();
}
public void init()
{
super.init();
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
private JLabel mLCN = new JLabel("LCN:");
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
public LTRStandardDecoderPanel(IconManager iconManager, SettingsManager settingsManager,
LTRStandardDecoderState decoderState)
{
super(iconManager, settingsManager, decoderState);
mTalkgroup.setFont( mFontDecoder );
mTalkgroup.setForeground( mColorLabelDecoder );
init();
}
mTalkgroupAlias.setFont( mFontDecoder );
mTalkgroupAlias.setForeground( mColorLabelDecoder );
public void dispose()
{
super.dispose();
}
mLCN.setFont( mFontDecoder );
mLCN.setForeground( mColorLabelDecoder );
public void init()
{
super.init();
add( mProtocol );
add( mTalkgroup );
add( mTalkgroupAlias, "wrap" );
add( mLCN, "wrap" );
}
public LTRStandardDecoderState getDecoderState()
{
return (LTRStandardDecoderState)super.getDecoderState();
}
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
mProtocol.setFont(mFontDecoder);
mProtocol.setForeground(mColorLabelDecoder);
mTalkgroup.setFont(mFontDecoder);
mTalkgroup.setForeground(mColorLabelDecoder);
mTalkgroupAlias.setFont(mFontDecoder);
mTalkgroupAlias.setForeground(mColorLabelDecoder);
mLCN.setFont(mFontDecoder);
mLCN.setForeground(mColorLabelDecoder);
add(mProtocol);
add(mTalkgroup);
add(mTalkgroupAlias, "wrap");
add(mLCN, "wrap");
}
public LTRStandardDecoderState getDecoderState()
{
return (LTRStandardDecoderState) super.getDecoderState();
}
@Override
public void receive( final ChangedAttribute attribute )
public void receive(final ChangedAttribute attribute)
{
EventQueue.invokeLater( new Runnable()
{
@Override
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
LTRStandardDecoderState state = getDecoderState();
switch( attribute )
{
case CHANNEL_NUMBER:
if( state.getChannelNumber() != 0 )
{
mLCN.setText( "LCN: " + state.getChannelNumber() );
}
break;
case TO_TALKGROUP:
mTalkgroup.setText( state.getTalkgroup() );
/* fall-through */
case TO_TALKGROUP_ALIAS:
Alias alias = state.getTalkgroupAlias();
if( alias != null )
{
mTalkgroupAlias.setText( alias.getName() );
mTalkgroupAlias.setIcon( mSettingsManager
.getImageIcon( alias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
}
else
{
mTalkgroupAlias.setText( null );
mTalkgroupAlias.setIcon( null );
}
default:
break;
}
repaint();
LTRStandardDecoderState state = getDecoderState();
switch(attribute)
{
case CHANNEL_NUMBER:
if(state.getChannelNumber() != 0)
{
mLCN.setText("LCN: " + state.getChannelNumber());
}
break;
case TO_TALKGROUP:
mTalkgroup.setText(state.getTalkgroup());
/* fall-through */
case TO_TALKGROUP_ALIAS:
Alias alias = state.getTalkgroupAlias();
if(alias != null)
{
mTalkgroupAlias.setText(alias.getName());
mTalkgroupAlias.setIcon(mIconManager.getIcon(alias.getIconName(),
IconManager.DEFAULT_ICON_SIZE));
}
else
{
mTalkgroupAlias.setText(null);
mTalkgroupAlias.setIcon(null);
}
default:
break;
}
repaint();
}
});
});
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_LABEL_DECODER:
if( mProtocol != null )
{
mProtocol.setForeground( mColorLabelDecoder );
}
if( mTalkgroup != null )
{
mTalkgroup.setForeground( mColorLabelDecoder );
}
if( mTalkgroupAlias != null )
{
mTalkgroupAlias.setForeground( mColorLabelDecoder );
}
if( mLCN != null )
{
mLCN.setForeground( mColorLabelDecoder );
}
break;
default:
break;
}
}
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting colorSetting = (ColorSetting) setting;
switch(colorSetting.getColorSettingName())
{
case CHANNEL_STATE_LABEL_DECODER:
if(mProtocol != null)
{
mProtocol.setForeground(mColorLabelDecoder);
}
if(mTalkgroup != null)
{
mTalkgroup.setForeground(mColorLabelDecoder);
}
if(mTalkgroupAlias != null)
{
mTalkgroupAlias.setForeground(mColorLabelDecoder);
}
if(mLCN != null)
{
mLCN.setForeground(mColorLabelDecoder);
}
break;
default:
break;
}
}
}
}

View File

@@ -1,27 +1,25 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.mdc1200;
import java.awt.EventQueue;
import javax.swing.JLabel;
import alias.Alias;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import net.miginfocom.swing.MigLayout;
@@ -30,154 +28,156 @@ import settings.ColorSetting.ColorSettingName;
import settings.Setting;
import settings.SettingsManager;
import javax.swing.*;
import java.awt.*;
public class MDCDecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private static final String sPROTOCOL = "MDC-1200";
private JLabel mFromLabel = new JLabel( " " );
private JLabel mFromLabel = new JLabel(" ");
private JLabel mFrom = new JLabel();
private JLabel mFromAlias = new JLabel();
private JLabel mToLabel = new JLabel( " " );
private JLabel mToLabel = new JLabel(" ");
private JLabel mTo = new JLabel();
private JLabel mToAlias = new JLabel();
private JLabel mProtocol = new JLabel( sPROTOCOL );
private JLabel mProtocol = new JLabel(sPROTOCOL);
private JLabel mMessage = new JLabel();
private JLabel mMessageType = new JLabel();
public MDCDecoderPanel( SettingsManager settingsManager,
MDCDecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
public MDCDecoderState getDecoderState()
{
return (MDCDecoderState)super.getDecoderState();
}
protected void init()
{
/* Calling super init will get and broadcast color settings to properly
* setup the jlabel colors */
super.init();
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "[]0[]0[]") );
private JLabel mMessageType = new JLabel();
add( mFromLabel );
add( mFrom );
add( mFromAlias, "wrap" );
add( mToLabel );
add( mTo );
add( mToAlias, "wrap" );
add( mProtocol );
add( mMessageType );
add( mMessage, "wrap" );
}
@Override
public void receive( final ChangedAttribute changedAttribute )
public MDCDecoderPanel(IconManager iconManager, SettingsManager settingsManager, MDCDecoderState decoderState)
{
EventQueue.invokeLater( new Runnable()
{
@Override
super(iconManager, settingsManager, decoderState);
init();
}
public MDCDecoderState getDecoderState()
{
return (MDCDecoderState) super.getDecoderState();
}
protected void init()
{
/* Calling super init will get and broadcast color settings to properly
* setup the jlabel colors */
super.init();
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
add(mFromLabel);
add(mFrom);
add(mFromAlias, "wrap");
add(mToLabel);
add(mTo);
add(mToAlias, "wrap");
add(mProtocol);
add(mMessageType);
add(mMessage, "wrap");
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
switch( changedAttribute )
{
case FROM_TALKGROUP:
String from = getDecoderState().getFrom();
if( from != null )
{
mFromLabel.setText( "FM:" );
}
else
{
mFromLabel.setText( " " );
}
mFrom.setText( from );
break;
case FROM_TALKGROUP_ALIAS:
Alias fromAlias = getDecoderState().getFromAlias();
if( fromAlias != null )
{
mFromAlias.setText( fromAlias.getName() );
}
else
{
mFromAlias.setText( null );
}
break;
case TO_TALKGROUP:
String to = getDecoderState().getTo();
if( to != null )
{
mToLabel.setText( "TO:" );
}
else
{
mToLabel.setText( " " );
}
mTo.setText( to );
break;
case TO_TALKGROUP_ALIAS:
Alias toAlias = getDecoderState().getToAlias();
if( toAlias != null )
{
mToAlias.setText( toAlias.getName() );
}
else
{
mToAlias.setText( null );
}
break;
case MESSAGE:
mMessage.setText( getDecoderState().getMessage() );
break;
case MESSAGE_TYPE:
mMessageType.setText( getDecoderState().getMessageType() );
break;
default:
break;
}
repaint();
switch(changedAttribute)
{
case FROM_TALKGROUP:
String from = getDecoderState().getFrom();
if(from != null)
{
mFromLabel.setText("FM:");
}
else
{
mFromLabel.setText(" ");
}
mFrom.setText(from);
break;
case FROM_TALKGROUP_ALIAS:
Alias fromAlias = getDecoderState().getFromAlias();
if(fromAlias != null)
{
mFromAlias.setText(fromAlias.getName());
}
else
{
mFromAlias.setText(null);
}
break;
case TO_TALKGROUP:
String to = getDecoderState().getTo();
if(to != null)
{
mToLabel.setText("TO:");
}
else
{
mToLabel.setText(" ");
}
mTo.setText(to);
break;
case TO_TALKGROUP_ALIAS:
Alias toAlias = getDecoderState().getToAlias();
if(toAlias != null)
{
mToAlias.setText(toAlias.getName());
}
else
{
mToAlias.setText(null);
}
break;
case MESSAGE:
mMessage.setText(getDecoderState().getMessage());
break;
case MESSAGE_TYPE:
mMessageType.setText(getDecoderState().getMessageType());
break;
default:
break;
}
repaint();
}
} );
});
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting color = (ColorSetting)setting;
super.settingChanged(setting);
if( color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER )
{
mFromLabel.setForeground( color.getColor() );
mFrom.setForeground( color.getColor() );
mFromAlias.setForeground( color.getColor() );
mToLabel.setForeground( color.getColor() );
mTo.setForeground( color.getColor() );
mToAlias.setForeground( color.getColor() );
mProtocol.setForeground( color.getColor() );
mMessageType.setForeground( color.getColor() );
mMessage.setForeground( color.getColor() );
}
}
if(setting instanceof ColorSetting)
{
ColorSetting color = (ColorSetting) setting;
if(color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
{
mFromLabel.setForeground(color.getColor());
mFrom.setForeground(color.getColor());
mFromAlias.setForeground(color.getColor());
mToLabel.setForeground(color.getColor());
mTo.setForeground(color.getColor());
mToAlias.setForeground(color.getColor());
mProtocol.setForeground(color.getColor());
mMessageType.setForeground(color.getColor());
mMessage.setForeground(color.getColor());
}
}
}
}

View File

@@ -1,200 +1,200 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.mpt1327;
import java.awt.EventQueue;
import javax.swing.JLabel;
import controller.channel.Channel.ChannelType;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import net.miginfocom.swing.MigLayout;
import settings.ColorSetting;
import settings.Setting;
import settings.SettingsManager;
import controller.channel.Channel.ChannelType;
import javax.swing.*;
import java.awt.*;
public class MPT1327DecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private JLabel mProtocol = new JLabel( "" );
private JLabel mSiteOrToTalkgroup = new JLabel( "" );
private JLabel mSiteOrToTalkgroupAlias = new JLabel( "" );
private JLabel mFromTalkgroupLabel = new JLabel( "" );
private JLabel mFromTalkgroup = new JLabel( "" );
private JLabel mFromTalkgroupAliasLabel = new JLabel( "" );
public MPT1327DecoderPanel( SettingsManager settingsManager,
MPT1327DecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
private JLabel mProtocol = new JLabel("");
private JLabel mSiteOrToTalkgroup = new JLabel("");
private JLabel mSiteOrToTalkgroupAlias = new JLabel("");
private JLabel mFromTalkgroupLabel = new JLabel("");
private JLabel mFromTalkgroup = new JLabel("");
private JLabel mFromTalkgroupAliasLabel = new JLabel("");
public MPT1327DecoderPanel(IconManager iconManager, SettingsManager settingsManager, MPT1327DecoderState decoderState)
{
super(iconManager, settingsManager, decoderState);
init();
}
public MPT1327DecoderState getDecoderState()
{
return (MPT1327DecoderState)super.getDecoderState();
return (MPT1327DecoderState) super.getDecoderState();
}
public void dispose()
{
super.dispose();
super.dispose();
}
public void init()
{
super.init();
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
mProtocol.setText( "MPT1327" );
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
MPT1327DecoderState mptState = getDecoderState();
mSiteOrToTalkgroup.setFont( mFontDecoder );
mSiteOrToTalkgroup.setForeground( mColorLabelDecoder );
mSiteOrToTalkgroupAlias.setFont( mFontDecoder );
mSiteOrToTalkgroupAlias.setForeground( mColorLabelDecoder );
mFromTalkgroupLabel.setFont( mFontDetails );
mFromTalkgroupLabel.setForeground( mColorLabelDetails );
mFromTalkgroup.setFont( mFontDecoder );
mFromTalkgroup.setForeground( mColorLabelDecoder );
mFromTalkgroupAliasLabel.setFont( mFontDecoder );
mFromTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
switch( mptState.getChannelType() )
{
case STANDARD:
mSiteOrToTalkgroup.setText( mptState.getSite() );
setAliasLabel( mSiteOrToTalkgroupAlias, mptState.getSiteAlias() );
break;
case TRAFFIC:
mSiteOrToTalkgroup.setText( mptState.getToTalkgroup() );
setAliasLabel( mSiteOrToTalkgroupAlias, mptState.getToTalkgroupAlias() );
mFromTalkgroupLabel.setText( "From:" );
mFromTalkgroup.setText( getDecoderState().getFromTalkgroup() );
setAliasLabel( mFromTalkgroupAliasLabel, mptState.getFromTalkgroupAlias() );
break;
default:
throw new IllegalArgumentException( "Unrecognized channel "
+ "type in MPT1327 Decoder [" + getDecoderState()
.getChannelType().name() + "]" );
}
add( mProtocol );
add( mSiteOrToTalkgroup );
add( mSiteOrToTalkgroupAlias, "wrap" );
if( mptState.getChannelType() == ChannelType.TRAFFIC )
{
add( mFromTalkgroupLabel );
add( mFromTalkgroup );
add( mFromTalkgroupAliasLabel, "wrap" );
}
}
@Override
public void receive( final ChangedAttribute changedAttribute )
public void init()
{
final MPT1327DecoderState state = getDecoderState();
EventQueue.invokeLater( new Runnable()
{
@Override
super.init();
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
mProtocol.setText("MPT1327");
mProtocol.setFont(mFontDecoder);
mProtocol.setForeground(mColorLabelDecoder);
MPT1327DecoderState mptState = getDecoderState();
mSiteOrToTalkgroup.setFont(mFontDecoder);
mSiteOrToTalkgroup.setForeground(mColorLabelDecoder);
mSiteOrToTalkgroupAlias.setFont(mFontDecoder);
mSiteOrToTalkgroupAlias.setForeground(mColorLabelDecoder);
mFromTalkgroupLabel.setFont(mFontDetails);
mFromTalkgroupLabel.setForeground(mColorLabelDetails);
mFromTalkgroup.setFont(mFontDecoder);
mFromTalkgroup.setForeground(mColorLabelDecoder);
mFromTalkgroupAliasLabel.setFont(mFontDecoder);
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
switch(mptState.getChannelType())
{
case STANDARD:
mSiteOrToTalkgroup.setText(mptState.getSite());
setAliasLabel(mSiteOrToTalkgroupAlias, mptState.getSiteAlias());
break;
case TRAFFIC:
mSiteOrToTalkgroup.setText(mptState.getToTalkgroup());
setAliasLabel(mSiteOrToTalkgroupAlias, mptState.getToTalkgroupAlias());
mFromTalkgroupLabel.setText("From:");
mFromTalkgroup.setText(getDecoderState().getFromTalkgroup());
setAliasLabel(mFromTalkgroupAliasLabel, mptState.getFromTalkgroupAlias());
break;
default:
throw new IllegalArgumentException("Unrecognized channel "
+ "type in MPT1327 Decoder [" + getDecoderState()
.getChannelType().name() + "]");
}
add(mProtocol);
add(mSiteOrToTalkgroup);
add(mSiteOrToTalkgroupAlias, "wrap");
if(mptState.getChannelType() == ChannelType.TRAFFIC)
{
add(mFromTalkgroupLabel);
add(mFromTalkgroup);
add(mFromTalkgroupAliasLabel, "wrap");
}
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
final MPT1327DecoderState state = getDecoderState();
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
switch( changedAttribute )
{
case CHANNEL_SITE_NUMBER:
mSiteOrToTalkgroup.setText( String.valueOf( state.getSite() ) );
setAliasLabel( mSiteOrToTalkgroupAlias, state.getSiteAlias(), false );
repaint();
break;
case TO_TALKGROUP:
mSiteOrToTalkgroup.setText( state.getToTalkgroup() );
setAliasLabel( mSiteOrToTalkgroupAlias, state.getToTalkgroupAlias() );
repaint();
break;
case FROM_TALKGROUP:
mFromTalkgroup.setText( state.getFromTalkgroup() );
setAliasLabel( mFromTalkgroupAliasLabel, state.getFromTalkgroupAlias() );
repaint();
break;
default:
break;
}
switch(changedAttribute)
{
case CHANNEL_SITE_NUMBER:
mSiteOrToTalkgroup.setText(String.valueOf(state.getSite()));
setAliasLabel(mSiteOrToTalkgroupAlias, state.getSiteAlias(), false);
repaint();
break;
case TO_TALKGROUP:
mSiteOrToTalkgroup.setText(state.getToTalkgroup());
setAliasLabel(mSiteOrToTalkgroupAlias, state.getToTalkgroupAlias());
repaint();
break;
case FROM_TALKGROUP:
mFromTalkgroup.setText(state.getFromTalkgroup());
setAliasLabel(mFromTalkgroupAliasLabel, state.getFromTalkgroupAlias());
repaint();
break;
default:
break;
}
}
} );
});
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_LABEL_DECODER:
if( mProtocol != null )
{
mProtocol.setForeground( mColorLabelDecoder );
}
if( mSiteOrToTalkgroup != null )
{
mSiteOrToTalkgroup.setForeground( mColorLabelDecoder );
}
if( mSiteOrToTalkgroupAlias != null )
{
mSiteOrToTalkgroupAlias.setForeground( mColorLabelDecoder );
}
if( mFromTalkgroup != null )
{
mFromTalkgroup.setForeground( mColorLabelDecoder );
}
if( mFromTalkgroupAliasLabel != null )
{
mFromTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
}
break;
case CHANNEL_STATE_LABEL_DETAILS:
if( mFromTalkgroupLabel != null )
{
mFromTalkgroupLabel.setForeground( mColorLabelDetails );
}
break;
default:
break;
}
}
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting colorSetting = (ColorSetting) setting;
switch(colorSetting.getColorSettingName())
{
case CHANNEL_STATE_LABEL_DECODER:
if(mProtocol != null)
{
mProtocol.setForeground(mColorLabelDecoder);
}
if(mSiteOrToTalkgroup != null)
{
mSiteOrToTalkgroup.setForeground(mColorLabelDecoder);
}
if(mSiteOrToTalkgroupAlias != null)
{
mSiteOrToTalkgroupAlias.setForeground(mColorLabelDecoder);
}
if(mFromTalkgroup != null)
{
mFromTalkgroup.setForeground(mColorLabelDecoder);
}
if(mFromTalkgroupAliasLabel != null)
{
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
}
break;
case CHANNEL_STATE_LABEL_DETAILS:
if(mFromTalkgroupLabel != null)
{
mFromTalkgroupLabel.setForeground(mColorLabelDetails);
}
break;
default:
break;
}
}
}
}

View File

@@ -1,32 +1,33 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.mpt1327;
import java.awt.EventQueue;
import javax.swing.JLabel;
import alias.Alias;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import settings.ColorSetting;
import settings.Setting;
import settings.SettingsManager;
import alias.Alias;
import javax.swing.*;
import java.awt.*;
public class MPT1327TrafficPanel extends DecoderPanel
{
@@ -39,141 +40,140 @@ public class MPT1327TrafficPanel extends DecoderPanel
private JLabel mToLabel;
private JLabel mToTalkgroupLabel;
private JLabel mToTalkgroupAliasLabel;
public MPT1327TrafficPanel( SettingsManager settingsManager, MPT1327DecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
public MPT1327TrafficPanel(IconManager iconManager, SettingsManager settingsManager,
MPT1327DecoderState decoderState)
{
super(iconManager, settingsManager, decoderState);
init();
}
public MPT1327DecoderState getDecoderState()
{
return (MPT1327DecoderState)super.getDecoderState();
return (MPT1327DecoderState) super.getDecoderState();
}
public void dispose()
{
super.dispose();
super.dispose();
}
public void init()
{
mProtocolLabel = new JLabel( "MPT1327" );
mProtocolLabel.setFont( mFontDecoder );
mProtocolLabel.setForeground( mColorLabelDecoder );
mFromTalkgroupLabel = new JLabel();
mFromTalkgroupLabel.setFont( mFontDecoder );
mFromTalkgroupLabel.setForeground( mColorLabelDecoder );
mFromTalkgroupAliasLabel = new JLabel();
mFromTalkgroupAliasLabel.setFont( mFontDecoder );
mFromTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
mToLabel = new JLabel( "TO:" );
mToLabel.setFont( mFontDetails );
mToLabel.setForeground( mColorLabelDetails );
mToTalkgroupLabel = new JLabel( getDecoderState().getFromTalkgroup() );
mToTalkgroupLabel.setFont( mFontDecoder );
mToTalkgroupLabel.setForeground( mColorLabelDecoder );
mToTalkgroupAliasLabel = new JLabel();
mToTalkgroupAliasLabel.setFont( mFontDecoder );
mToTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
add( mProtocolLabel );
add( mFromTalkgroupLabel );
add( mFromTalkgroupAliasLabel, "wrap" );
add( mToLabel );
add( mToTalkgroupLabel );
add( mToTalkgroupAliasLabel, "wrap" );
}
@Override
public void receive( final ChangedAttribute changedAttribute )
public void init()
{
final MPT1327DecoderState state = getDecoderState();
EventQueue.invokeLater( new Runnable()
{
@Override
mProtocolLabel = new JLabel("MPT1327");
mProtocolLabel.setFont(mFontDecoder);
mProtocolLabel.setForeground(mColorLabelDecoder);
mFromTalkgroupLabel = new JLabel();
mFromTalkgroupLabel.setFont(mFontDecoder);
mFromTalkgroupLabel.setForeground(mColorLabelDecoder);
mFromTalkgroupAliasLabel = new JLabel();
mFromTalkgroupAliasLabel.setFont(mFontDecoder);
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
mToLabel = new JLabel("TO:");
mToLabel.setFont(mFontDetails);
mToLabel.setForeground(mColorLabelDetails);
mToTalkgroupLabel = new JLabel(getDecoderState().getFromTalkgroup());
mToTalkgroupLabel.setFont(mFontDecoder);
mToTalkgroupLabel.setForeground(mColorLabelDecoder);
mToTalkgroupAliasLabel = new JLabel();
mToTalkgroupAliasLabel.setFont(mFontDecoder);
mToTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
add(mProtocolLabel);
add(mFromTalkgroupLabel);
add(mFromTalkgroupAliasLabel, "wrap");
add(mToLabel);
add(mToTalkgroupLabel);
add(mToTalkgroupAliasLabel, "wrap");
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
final MPT1327DecoderState state = getDecoderState();
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
switch( changedAttribute )
{
case FROM_TALKGROUP:
String talkgroup = state.getFromTalkgroup();
mFromTalkgroupLabel.setText( talkgroup );
Alias alias = state.getFromTalkgroupAlias();
if( alias != null )
{
mFromTalkgroupAliasLabel.setText( alias.getName() );
String icon = alias.getIconName();
mFromTalkgroupAliasLabel.setIcon( mSettingsManager
.getImageIcon( icon, SettingsManager.DEFAULT_ICON_SIZE ) );
}
break;
case TO_TALKGROUP:
String toTalkgroup = state.getToTalkgroup();
mToTalkgroupLabel.setText( toTalkgroup );
Alias toAlias = state.getToTalkgroupAlias();
if( toAlias != null )
{
mToTalkgroupAliasLabel.setText( toAlias.getName() );
String icon = toAlias.getIconName();
if( icon != null )
{
mToTalkgroupAliasLabel.setIcon( mSettingsManager
.getImageIcon( icon, 12 ) );
}
}
break;
default:
break;
}
switch(changedAttribute)
{
case FROM_TALKGROUP:
String talkgroup = state.getFromTalkgroup();
repaint();
mFromTalkgroupLabel.setText(talkgroup);
Alias alias = state.getFromTalkgroupAlias();
if(alias != null)
{
mFromTalkgroupAliasLabel.setText(alias.getName());
String icon = alias.getIconName();
mFromTalkgroupAliasLabel.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
}
break;
case TO_TALKGROUP:
String toTalkgroup = state.getToTalkgroup();
mToTalkgroupLabel.setText(toTalkgroup);
Alias toAlias = state.getToTalkgroupAlias();
if(toAlias != null)
{
mToTalkgroupAliasLabel.setText(toAlias.getName());
String icon = toAlias.getIconName();
if(icon != null)
{
mToTalkgroupAliasLabel.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
}
}
break;
default:
break;
}
repaint();
}
} );
});
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_LABEL_DECODER:
mProtocolLabel.setForeground( mColorLabelDecoder );
mFromTalkgroupLabel.setForeground( mColorLabelDecoder );
mFromTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
mToTalkgroupLabel.setForeground( mColorLabelDecoder );
mToTalkgroupAliasLabel.setForeground( mColorLabelDecoder );
break;
case CHANNEL_STATE_LABEL_DETAILS:
mToLabel.setForeground( mColorLabelDetails );
break;
default:
break;
}
}
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting colorSetting = (ColorSetting) setting;
switch(colorSetting.getColorSettingName())
{
case CHANNEL_STATE_LABEL_DECODER:
mProtocolLabel.setForeground(mColorLabelDecoder);
mFromTalkgroupLabel.setForeground(mColorLabelDecoder);
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
mToTalkgroupLabel.setForeground(mColorLabelDecoder);
mToTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
break;
case CHANNEL_STATE_LABEL_DETAILS:
mToLabel.setForeground(mColorLabelDetails);
break;
default:
break;
}
}
}
}

View File

@@ -1,24 +1,24 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.nbfm;
import javax.swing.JLabel;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import module.decode.state.DecoderState;
@@ -28,52 +28,53 @@ import settings.ColorSetting.ColorSettingName;
import settings.Setting;
import settings.SettingsManager;
import javax.swing.*;
public class NBFMDecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private JLabel mProtocol = new JLabel( "NBFM" );
public NBFMDecoderPanel( SettingsManager settingsManager,
DecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
protected void init()
{
super.init();
private JLabel mProtocol = new JLabel("NBFM");
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
add( mProtocol, "wrap" );
}
@Override
public void receive( ChangedAttribute t )
{
/* Not implemented */
}
@Override
public void settingChanged( Setting setting )
public NBFMDecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting color = (ColorSetting)setting;
super(iconManager, settingsManager, decoderState);
if( color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_DECODER )
{
mProtocol.setForeground( color.getColor() );
}
}
init();
}
protected void init()
{
super.init();
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
mProtocol.setFont(mFontDecoder);
mProtocol.setForeground(mColorLabelDecoder);
add(mProtocol, "wrap");
}
@Override
public void receive(ChangedAttribute t)
{
/* Not implemented */
}
@Override
public void settingChanged(Setting setting)
{
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting color = (ColorSetting) setting;
if(color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_DECODER)
{
mProtocol.setForeground(color.getColor());
}
}
}
}

View File

@@ -1,228 +1,226 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.p25;
import java.awt.EventQueue;
import javax.swing.JLabel;
import alias.Alias;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import net.miginfocom.swing.MigLayout;
import settings.ColorSetting;
import settings.Setting;
import settings.SettingsManager;
import alias.Alias;
import javax.swing.*;
import java.awt.*;
public class P25DecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private JLabel mProtocol;
private JLabel mTo = new JLabel( " " );
private JLabel mToAlias = new JLabel( " " );
private JLabel mNAC = new JLabel( "NAC:" );
private JLabel mFrom = new JLabel( " " );
private JLabel mFromAlias = new JLabel( " " );
private JLabel mSystem = new JLabel( "SYS:" );
private JLabel mSite = new JLabel( "Site:" );
private JLabel mSiteAlias = new JLabel( "" );
public P25DecoderPanel( SettingsManager settingsManager,
P25DecoderState decoderState )
{
super( settingsManager, decoderState );
private JLabel mTo = new JLabel(" ");
private JLabel mToAlias = new JLabel(" ");
mProtocol = new JLabel( "P25-1 " + decoderState.getModulation().getShortLabel() );
init();
}
public void init()
{
super.init();
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
private JLabel mNAC = new JLabel("NAC:");
private JLabel mFrom = new JLabel(" ");
private JLabel mFromAlias = new JLabel(" ");
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
private JLabel mSystem = new JLabel("SYS:");
private JLabel mSite = new JLabel("Site:");
private JLabel mSiteAlias = new JLabel("");
mTo.setFont( mFontDecoder );
mTo.setForeground( mColorLabelDecoder );
mToAlias.setFont( mFontDecoder );
mToAlias.setForeground( mColorLabelDecoder );
mNAC.setFont( mFontDetails );
mNAC.setForeground( mColorLabelDecoder );
mFrom.setFont( mFontDecoder );
mFrom.setForeground( mColorLabelDecoder );
mFromAlias.setFont( mFontDecoder );
mFromAlias.setForeground( mColorLabelDecoder );
mSystem.setFont( mFontDetails );
mSystem.setForeground( mColorLabelDecoder );
mSiteAlias.setFont( mFontDecoder );
mSiteAlias.setForeground( mColorLabelDecoder );
mSite.setFont( mFontDetails );
mSite.setForeground( mColorLabelDecoder );
add( mProtocol );
add( mTo );
add( mToAlias, "wrap" );
add( mNAC );
add( mFrom );
add( mFromAlias, "wrap" );
add( mSystem );
add( mSite );
add( mSiteAlias, "wrap" );
}
public P25DecoderState getDecoderState()
{
return (P25DecoderState)super.getDecoderState();
}
@Override
public void receive( final ChangedAttribute changedAttribute )
public P25DecoderPanel(IconManager iconManager, SettingsManager settingsManager, P25DecoderState decoderState)
{
final P25DecoderState state = getDecoderState();
super(iconManager, settingsManager, decoderState);
EventQueue.invokeLater( new Runnable()
{
@Override
mProtocol = new JLabel("P25-1 " + decoderState.getModulation().getShortLabel());
init();
}
public void init()
{
super.init();
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
mProtocol.setFont(mFontDecoder);
mProtocol.setForeground(mColorLabelDecoder);
mTo.setFont(mFontDecoder);
mTo.setForeground(mColorLabelDecoder);
mToAlias.setFont(mFontDecoder);
mToAlias.setForeground(mColorLabelDecoder);
mNAC.setFont(mFontDetails);
mNAC.setForeground(mColorLabelDecoder);
mFrom.setFont(mFontDecoder);
mFrom.setForeground(mColorLabelDecoder);
mFromAlias.setFont(mFontDecoder);
mFromAlias.setForeground(mColorLabelDecoder);
mSystem.setFont(mFontDetails);
mSystem.setForeground(mColorLabelDecoder);
mSiteAlias.setFont(mFontDecoder);
mSiteAlias.setForeground(mColorLabelDecoder);
mSite.setFont(mFontDetails);
mSite.setForeground(mColorLabelDecoder);
add(mProtocol);
add(mTo);
add(mToAlias, "wrap");
add(mNAC);
add(mFrom);
add(mFromAlias, "wrap");
add(mSystem);
add(mSite);
add(mSiteAlias, "wrap");
}
public P25DecoderState getDecoderState()
{
return (P25DecoderState) super.getDecoderState();
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
final P25DecoderState state = getDecoderState();
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
switch( changedAttribute )
{
case NAC:
mNAC.setText( "NAC:" + state.getNAC() );
break;
case SYSTEM:
mSystem.setText( "SYS:" + state.getSystem() );
break;
case SITE:
mSite.setText( "SITE:" + state.getSite() );
break;
case SITE_ALIAS:
mSiteAlias.setText( state.getSiteAlias() );
break;
case FROM_TALKGROUP:
if( state.getFromTalkgroup() == null )
{
mFrom.setText( " " );
}
else
{
mFrom.setText( state.getFromTalkgroup() );
}
break;
case FROM_TALKGROUP_ALIAS:
Alias from = state.getFromAlias();
if( from != null )
{
mFromAlias.setText( from.getName() );
final String icon = from.getIconName();
if( icon != null && mSettingsManager != null )
{
mFromAlias.setIcon( mSettingsManager.getImageIcon(
icon, SettingsManager.DEFAULT_ICON_SIZE ) );
}
}
else
{
mFromAlias.setText( " " );
mFromAlias.setIcon( null );
}
break;
case TO_TALKGROUP:
if( state.getToTalkgroup() == null )
{
mTo.setText( " " );
}
else
{
mTo.setText( state.getToTalkgroup() );
}
break;
case TO_TALKGROUP_ALIAS:
final Alias to = state.getToAlias();
if( to != null )
{
mToAlias.setText( to.getName() );
final String icon = to.getIconName();
if( icon != null && mSettingsManager != null )
{
mToAlias.setIcon( mSettingsManager.getImageIcon(
icon, SettingsManager.DEFAULT_ICON_SIZE ) );
}
}
else
{
mToAlias.setText( " " );
mToAlias.setIcon( null );
}
break;
default:
break;
}
switch(changedAttribute)
{
case NAC:
mNAC.setText("NAC:" + state.getNAC());
break;
case SYSTEM:
mSystem.setText("SYS:" + state.getSystem());
break;
case SITE:
mSite.setText("SITE:" + state.getSite());
break;
case SITE_ALIAS:
mSiteAlias.setText(state.getSiteAlias());
break;
case FROM_TALKGROUP:
if(state.getFromTalkgroup() == null)
{
mFrom.setText(" ");
}
else
{
mFrom.setText(state.getFromTalkgroup());
}
break;
case FROM_TALKGROUP_ALIAS:
Alias from = state.getFromAlias();
repaint();
}
});
if(from != null)
{
mFromAlias.setText(from.getName());
final String icon = from.getIconName();
if(icon != null && mIconManager != null)
{
mFromAlias.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
}
}
else
{
mFromAlias.setText(" ");
mFromAlias.setIcon(null);
}
break;
case TO_TALKGROUP:
if(state.getToTalkgroup() == null)
{
mTo.setText(" ");
}
else
{
mTo.setText(state.getToTalkgroup());
}
break;
case TO_TALKGROUP_ALIAS:
final Alias to = state.getToAlias();
if(to != null)
{
mToAlias.setText(to.getName());
final String icon = to.getIconName();
if(icon != null && mIconManager != null)
{
mToAlias.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
}
}
else
{
mToAlias.setText(" ");
mToAlias.setIcon(null);
}
break;
default:
break;
}
repaint();
}
});
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_LABEL_DECODER:
if( mProtocol != null )
{
mProtocol.setForeground( mColorLabelDecoder );
}
break;
default:
break;
}
}
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting colorSetting = (ColorSetting) setting;
switch(colorSetting.getColorSettingName())
{
case CHANNEL_STATE_LABEL_DECODER:
if(mProtocol != null)
{
mProtocol.setForeground(mColorLabelDecoder);
}
break;
default:
break;
}
}
}
}

View File

@@ -1,226 +1,225 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.passport;
import java.awt.EventQueue;
import javax.swing.JLabel;
import net.miginfocom.swing.MigLayout;
import alias.Alias;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import net.miginfocom.swing.MigLayout;
import settings.ColorSetting;
import settings.Setting;
import settings.SettingsManager;
import alias.Alias;
import javax.swing.*;
import java.awt.*;
public class PassportDecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private JLabel mProtocol = new JLabel( "Passport" );
private JLabel mProtocol = new JLabel("Passport");
private JLabel mToTalkgroup = new JLabel();
private JLabel mToTalkgroupAlias = new JLabel();
private JLabel mSiteAndChannel = new JLabel( "Site:" );
private JLabel mSiteAndChannel = new JLabel("Site:");
private JLabel mFromTalkgroup = new JLabel();
private JLabel mFromTalkgroupAlias = new JLabel();
public PassportDecoderPanel( SettingsManager settingsManager,
PassportDecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
public void dispose()
{
super.dispose();
}
public void init()
{
super.init();
setLayout( new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[]0[]0[]") );
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
mToTalkgroup.setFont( mFontDecoder );
mToTalkgroup.setForeground( mColorLabelDecoder );
mToTalkgroupAlias.setFont( mFontDecoder );
mToTalkgroupAlias.setForeground( mColorLabelDecoder );
mSiteAndChannel.setFont( mFontDecoder );
mSiteAndChannel.setForeground( mColorLabelDecoder );
mFromTalkgroup.setFont( mFontDecoder );
mFromTalkgroup.setForeground( mColorLabelDecoder );
mFromTalkgroupAlias.setFont( mFontDecoder );
mFromTalkgroupAlias.setForeground( mColorLabelDecoder );
add( mProtocol );
add( mToTalkgroup );
add( mToTalkgroupAlias, "wrap" );
add( mSiteAndChannel );
add( mFromTalkgroup );
add( mFromTalkgroupAlias, "wrap" );
}
public PassportDecoderState getDecoderState()
{
return (PassportDecoderState)super.getDecoderState();
}
@Override
public void receive( final ChangedAttribute changedAttribute )
public PassportDecoderPanel(IconManager iconManager, SettingsManager settingsManager, PassportDecoderState decoderState)
{
EventQueue.invokeLater( new Runnable()
{
@Override
super(iconManager, settingsManager, decoderState);
init();
}
public void dispose()
{
super.dispose();
}
public void init()
{
super.init();
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
mProtocol.setFont(mFontDecoder);
mProtocol.setForeground(mColorLabelDecoder);
mToTalkgroup.setFont(mFontDecoder);
mToTalkgroup.setForeground(mColorLabelDecoder);
mToTalkgroupAlias.setFont(mFontDecoder);
mToTalkgroupAlias.setForeground(mColorLabelDecoder);
mSiteAndChannel.setFont(mFontDecoder);
mSiteAndChannel.setForeground(mColorLabelDecoder);
mFromTalkgroup.setFont(mFontDecoder);
mFromTalkgroup.setForeground(mColorLabelDecoder);
mFromTalkgroupAlias.setFont(mFontDecoder);
mFromTalkgroupAlias.setForeground(mColorLabelDecoder);
add(mProtocol);
add(mToTalkgroup);
add(mToTalkgroupAlias, "wrap");
add(mSiteAndChannel);
add(mFromTalkgroup);
add(mFromTalkgroupAlias, "wrap");
}
public PassportDecoderState getDecoderState()
{
return (PassportDecoderState) super.getDecoderState();
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
PassportDecoderState state = getDecoderState();
switch( changedAttribute )
{
case TO_TALKGROUP:
String tg = state.getTalkgroup();
if( tg != null )
{
mToTalkgroup.setText( "TG:" + tg );
}
else
{
mToTalkgroup.setText( null );
}
break;
case TO_TALKGROUP_ALIAS:
Alias toAlias = state.getTalkgroupAlias();
if( toAlias != null )
{
mToTalkgroupAlias.setText( toAlias.getName() );
mToTalkgroupAlias.setIcon( mSettingsManager
.getImageIcon( toAlias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
}
else
{
mToTalkgroupAlias.setText( null );
mToTalkgroupAlias.setIcon( null );
}
break;
case FROM_TALKGROUP:
String mid = state.getMobileID();
if( mid != null )
{
mFromTalkgroup.setText( "MIN:" + mid );
}
else
{
mFromTalkgroup.setText( null );
}
break;
case FROM_TALKGROUP_ALIAS:
Alias fromAlias = state.getMobileIDAlias();
if( fromAlias != null )
{
mFromTalkgroupAlias.setText( fromAlias.getName() );
mFromTalkgroupAlias.setIcon( mSettingsManager
.getImageIcon( fromAlias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
}
else
{
mFromTalkgroupAlias.setText( null );
mFromTalkgroupAlias.setIcon( null );
}
break;
case CHANNEL_NUMBER:
StringBuilder sb = new StringBuilder();
sb.append( "Site: " );
sb.append( state.getSiteNumber() );
sb.append( "/" );
sb.append( state.getChannelNumber() );
mSiteAndChannel.setText( sb.toString() );
break;
default:
break;
}
repaint();
PassportDecoderState state = getDecoderState();
switch(changedAttribute)
{
case TO_TALKGROUP:
String tg = state.getTalkgroup();
if(tg != null)
{
mToTalkgroup.setText("TG:" + tg);
}
else
{
mToTalkgroup.setText(null);
}
break;
case TO_TALKGROUP_ALIAS:
Alias toAlias = state.getTalkgroupAlias();
if(toAlias != null)
{
mToTalkgroupAlias.setText(toAlias.getName());
mToTalkgroupAlias.setIcon(mIconManager.getIcon(toAlias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
}
else
{
mToTalkgroupAlias.setText(null);
mToTalkgroupAlias.setIcon(null);
}
break;
case FROM_TALKGROUP:
String mid = state.getMobileID();
if(mid != null)
{
mFromTalkgroup.setText("MIN:" + mid);
}
else
{
mFromTalkgroup.setText(null);
}
break;
case FROM_TALKGROUP_ALIAS:
Alias fromAlias = state.getMobileIDAlias();
if(fromAlias != null)
{
mFromTalkgroupAlias.setText(fromAlias.getName());
mFromTalkgroupAlias.setIcon(mIconManager
.getIcon(fromAlias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
}
else
{
mFromTalkgroupAlias.setText(null);
mFromTalkgroupAlias.setIcon(null);
}
break;
case CHANNEL_NUMBER:
StringBuilder sb = new StringBuilder();
sb.append("Site: ");
sb.append(state.getSiteNumber());
sb.append("/");
sb.append(state.getChannelNumber());
mSiteAndChannel.setText(sb.toString());
break;
default:
break;
}
repaint();
}
});
});
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_LABEL_DECODER:
if( mColorLabelDecoder != null )
{
if( mProtocol != null )
{
mProtocol.setForeground( mColorLabelDecoder );
}
if( mToTalkgroup != null )
{
mToTalkgroup.setForeground( mColorLabelDecoder );
}
if( mToTalkgroupAlias != null )
{
mToTalkgroupAlias.setForeground( mColorLabelDecoder );
}
if( mSiteAndChannel != null )
{
mSiteAndChannel.setForeground( mColorLabelDecoder );
}
if( mFromTalkgroup != null )
{
mFromTalkgroup.setForeground( mColorLabelDecoder );
}
if( mFromTalkgroupAlias != null )
{
mFromTalkgroupAlias.setForeground( mColorLabelDecoder );
}
}
break;
default:
break;
}
}
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting colorSetting = (ColorSetting) setting;
switch(colorSetting.getColorSettingName())
{
case CHANNEL_STATE_LABEL_DECODER:
if(mColorLabelDecoder != null)
{
if(mProtocol != null)
{
mProtocol.setForeground(mColorLabelDecoder);
}
if(mToTalkgroup != null)
{
mToTalkgroup.setForeground(mColorLabelDecoder);
}
if(mToTalkgroupAlias != null)
{
mToTalkgroupAlias.setForeground(mColorLabelDecoder);
}
if(mSiteAndChannel != null)
{
mSiteAndChannel.setForeground(mColorLabelDecoder);
}
if(mFromTalkgroup != null)
{
mFromTalkgroup.setForeground(mColorLabelDecoder);
}
if(mFromTalkgroupAlias != null)
{
mFromTalkgroupAlias.setForeground(mColorLabelDecoder);
}
}
break;
default:
break;
}
}
}
}

View File

@@ -1,39 +1,23 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.state;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.swing.JMenu;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JSeparator;
import net.miginfocom.swing.MigLayout;
import settings.ColorSetting.ColorSettingName;
import settings.ColorSettingMenuItem;
import settings.ColorSettingResetMenuItem;
import settings.SettingsManager;
import audio.AudioPanel;
import controller.channel.Channel;
import controller.channel.ChannelEvent;
@@ -41,266 +25,293 @@ import controller.channel.ChannelEvent.Event;
import controller.channel.ChannelEventListener;
import controller.channel.ChannelModel;
import controller.channel.ChannelProcessingManager;
import icon.IconManager;
import net.miginfocom.swing.MigLayout;
import settings.ColorSetting.ColorSettingName;
import settings.ColorSettingMenuItem;
import settings.ColorSettingResetMenuItem;
import settings.SettingsManager;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Gui wrapper for the list of currently processing primary channels
* Gui wrapper for the list of currently processing primary channels
*/
public class ChannelList extends JPanel implements ChannelEventListener
{
private static final long serialVersionUID = 1L;
private Map<Channel,ChannelPanel> mDisplayedPanels = new ConcurrentHashMap<>();
private Map<Channel, ChannelPanel> mDisplayedPanels = new ConcurrentHashMap<>();
private ChannelModel mChannelModel;
private ChannelProcessingManager mChannelProcessingManager;
private IconManager mIconManager;
private SettingsManager mSettingsManager;
private AudioPanel mAudioPanel;
public ChannelList( ChannelModel channelModel,
ChannelProcessingManager channelProcessingManager,
SettingsManager settingsManager,
AudioPanel audioPanel )
{
mChannelModel = channelModel;
mChannelProcessingManager = channelProcessingManager;
mSettingsManager = settingsManager;
mAudioPanel = audioPanel;
init();
public ChannelList(ChannelModel channelModel,
ChannelProcessingManager channelProcessingManager,
IconManager iconManager,
SettingsManager settingsManager,
AudioPanel audioPanel)
{
mChannelModel = channelModel;
mChannelProcessingManager = channelProcessingManager;
mIconManager = iconManager;
mSettingsManager = settingsManager;
mAudioPanel = audioPanel;
init();
}
private void init()
{
setLayout( new MigLayout( "insets 0 0 0 0,wrap 1", "[grow,fill]", "[]0[]") );
setBackground( Color.BLACK );
addMouseListener( new ListSelectionListener() );
add( mAudioPanel );
JSeparator separator = new JSeparator( JSeparator.HORIZONTAL );
add( separator );
setLayout(new MigLayout("insets 0 0 0 0,wrap 1", "[grow,fill]", "[]0[]"));
setBackground(Color.BLACK);
addMouseListener(new ListSelectionListener());
add(mAudioPanel);
JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
add(separator);
}
@Override
public void channelChanged( ChannelEvent event )
@Override
public void channelChanged(ChannelEvent event)
{
switch( event.getEvent() )
{
case NOTIFICATION_PROCESSING_START:
addChannelPanel( event.getChannel() );
break;
case NOTIFICATION_PROCESSING_STOP:
removeChannelPanel( event.getChannel() );
break;
default:
break;
}
}
private void addChannelPanel( Channel channel )
{
if( !mDisplayedPanels.containsKey( channel ) )
{
ChannelPanel channelPanel = new ChannelPanel( mChannelModel,
mChannelProcessingManager, mSettingsManager, channel );
add( channelPanel );
mDisplayedPanels.put( channel, channelPanel );
revalidate();
repaint();
}
}
public void removeChannelPanel( Channel channel )
{
if( mDisplayedPanels.containsKey( channel ) )
{
ChannelPanel panel = mDisplayedPanels.remove( channel );
if( panel != null )
{
remove( panel );
panel.dispose();
}
revalidate();
repaint();
}
}
public class ListSelectionListener implements MouseListener
{
@Override
public void mouseClicked( MouseEvent e )
switch(event.getEvent())
{
Component component = getComponentAt( e.getPoint() );
case NOTIFICATION_PROCESSING_START:
addChannelPanel(event.getChannel());
break;
case NOTIFICATION_PROCESSING_STOP:
removeChannelPanel(event.getChannel());
break;
default:
break;
}
}
if( component instanceof ChannelPanel )
{
ChannelPanel panel = (ChannelPanel)component;
private void addChannelPanel(Channel channel)
{
if(!mDisplayedPanels.containsKey(channel))
{
ChannelPanel channelPanel = new ChannelPanel(mChannelModel,
mChannelProcessingManager, mIconManager, mSettingsManager, channel);
Channel channel = panel.getChannel();
add(channelPanel);
if( e.getButton() == MouseEvent.BUTTON1 )
{
if( channel.isSelected() )
{
mChannelModel.broadcast( new ChannelEvent( channel, Event.REQUEST_DESELECT ) );
}
else
{
mChannelModel.broadcast( new ChannelEvent( channel, Event.REQUEST_SELECT ) );
}
}
else if( e.getButton() == MouseEvent.BUTTON3 )
{
JPopupMenu popupMenu = new JPopupMenu();
JMenu menu = panel.getContextMenu();
if( menu != null )
{
popupMenu.add( menu );
}
JMenu colorMenu = new JMenu( "Color" );
popupMenu.add( colorMenu );
mDisplayedPanels.put(channel, channelPanel);
JMenu backgroundMenu = new JMenu( "Background" );
colorMenu.add( backgroundMenu );
backgroundMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_BACKGROUND ) );
backgroundMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_BACKGROUND ) );
JMenu channelsMenu = new JMenu( "Channel State" );
colorMenu.add( channelsMenu );
JMenu callMenu = new JMenu( "Call" );
channelsMenu.add( callMenu );
callMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL ) );
callMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL ) );
callMenu.add( new JSeparator() );
revalidate();
repaint();
}
}
callMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL ) );
callMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL ) );
JMenu controlMenu = new JMenu( "Control" );
channelsMenu.add( controlMenu );
controlMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL ) );
controlMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL ) );
controlMenu.add( new JSeparator() );
controlMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL ) );
controlMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL ) );
JMenu dataMenu = new JMenu( "Data" );
channelsMenu.add( dataMenu );
dataMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA ) );
dataMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA ) );
dataMenu.add( new JSeparator() );
dataMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA ) );
dataMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA ) );
JMenu fadeMenu = new JMenu( "Fade" );
channelsMenu.add( fadeMenu );
fadeMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE ) );
fadeMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE ) );
fadeMenu.add( new JSeparator() );
fadeMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE ) );
fadeMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE ) );
JMenu idleMenu = new JMenu( "Idle" );
channelsMenu.add( idleMenu );
idleMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE ) );
idleMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE ) );
idleMenu.add( new JSeparator() );
idleMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE ) );
idleMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE ) );
JMenu noTunerMenu = new JMenu( "No Tuner" );
channelsMenu.add( noTunerMenu );
noTunerMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER ) );
noTunerMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER ) );
noTunerMenu.add( new JSeparator() );
noTunerMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER ) );
noTunerMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER ) );
JMenu labelMenu = new JMenu( "Labels" );
colorMenu.add( labelMenu );
labelMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER ) );
labelMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER ) );
labelMenu.add( new JSeparator() );
labelMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_DECODER ) );
labelMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_DECODER ) );
labelMenu.add( new JSeparator() );
labelMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS ) );
labelMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS ) );
JMenu selectedMenu = new JMenu( "Selected" );
colorMenu.add( selectedMenu );
selectedMenu.add( new ColorSettingMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL ) );
selectedMenu.add( new ColorSettingResetMenuItem( mSettingsManager,
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL ) );
popupMenu.show( ChannelList.this, e.getX(), e.getY() );
}
}
public void removeChannelPanel(Channel channel)
{
if(mDisplayedPanels.containsKey(channel))
{
ChannelPanel panel = mDisplayedPanels.remove(channel);
if(panel != null)
{
remove(panel);
panel.dispose();
}
revalidate();
repaint();
}
}
public class ListSelectionListener implements MouseListener
{
@Override
public void mouseClicked(MouseEvent e)
{
Component component = getComponentAt(e.getPoint());
if(component instanceof ChannelPanel)
{
ChannelPanel panel = (ChannelPanel) component;
Channel channel = panel.getChannel();
if(e.getButton() == MouseEvent.BUTTON1)
{
if(channel.isSelected())
{
mChannelModel.broadcast(new ChannelEvent(channel, Event.REQUEST_DESELECT));
}
else
{
mChannelModel.broadcast(new ChannelEvent(channel, Event.REQUEST_SELECT));
}
}
else if(e.getButton() == MouseEvent.BUTTON3)
{
JPopupMenu popupMenu = new JPopupMenu();
JMenu menu = panel.getContextMenu();
if(menu != null)
{
popupMenu.add(menu);
}
JMenu colorMenu = new JMenu("Color");
popupMenu.add(colorMenu);
JMenu backgroundMenu = new JMenu("Background");
colorMenu.add(backgroundMenu);
backgroundMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_BACKGROUND));
backgroundMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_BACKGROUND));
JMenu channelsMenu = new JMenu("Channel State");
colorMenu.add(channelsMenu);
JMenu callMenu = new JMenu("Call");
channelsMenu.add(callMenu);
callMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL));
callMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL));
callMenu.add(new JSeparator());
callMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL));
callMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL));
JMenu controlMenu = new JMenu("Control");
channelsMenu.add(controlMenu);
controlMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL));
controlMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL));
controlMenu.add(new JSeparator());
controlMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL));
controlMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL));
JMenu dataMenu = new JMenu("Data");
channelsMenu.add(dataMenu);
dataMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA));
dataMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA));
dataMenu.add(new JSeparator());
dataMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA));
dataMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA));
JMenu fadeMenu = new JMenu("Fade");
channelsMenu.add(fadeMenu);
fadeMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE));
fadeMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE));
fadeMenu.add(new JSeparator());
fadeMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE));
fadeMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE));
JMenu idleMenu = new JMenu("Idle");
channelsMenu.add(idleMenu);
idleMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE));
idleMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE));
idleMenu.add(new JSeparator());
idleMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE));
idleMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE));
JMenu noTunerMenu = new JMenu("No Tuner");
channelsMenu.add(noTunerMenu);
noTunerMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER));
noTunerMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER));
noTunerMenu.add(new JSeparator());
noTunerMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER));
noTunerMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER));
JMenu labelMenu = new JMenu("Labels");
colorMenu.add(labelMenu);
labelMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER));
labelMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER));
labelMenu.add(new JSeparator());
labelMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_DECODER));
labelMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_DECODER));
labelMenu.add(new JSeparator());
labelMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS));
labelMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS));
JMenu selectedMenu = new JMenu("Selected");
colorMenu.add(selectedMenu);
selectedMenu.add(new ColorSettingMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL));
selectedMenu.add(new ColorSettingResetMenuItem(mSettingsManager,
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL));
popupMenu.show(ChannelList.this, e.getX(), e.getY());
}
}
}
public void mousePressed( MouseEvent e ) {}
public void mouseReleased( MouseEvent e ) {}
public void mouseEntered( MouseEvent e ) {}
public void mouseExited( MouseEvent e ) {}
}
public void mousePressed(MouseEvent e)
{
}
public void mouseReleased(MouseEvent e)
{
}
public void mouseEntered(MouseEvent e)
{
}
public void mouseExited(MouseEvent e)
{
}
}
}

View File

@@ -1,26 +1,36 @@
/*******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.state;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JPanel;
import controller.channel.Channel;
import controller.channel.ChannelEvent;
import controller.channel.ChannelEvent.Event;
import controller.channel.ChannelEventListener;
import controller.channel.ChannelModel;
import controller.channel.ChannelProcessingManager;
import controller.channel.ChannelUtils;
import icon.IconManager;
import module.ProcessingChain;
import module.decode.DecoderFactory;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import record.RecorderType;
import record.config.RecordConfiguration;
import sample.Listener;
@@ -29,25 +39,23 @@ import settings.ColorSetting.ColorSettingName;
import settings.Setting;
import settings.SettingChangeListener;
import settings.SettingsManager;
import controller.channel.Channel;
import controller.channel.ChannelEvent;
import controller.channel.ChannelEvent.Event;
import controller.channel.ChannelEventListener;
import controller.channel.ChannelModel;
import controller.channel.ChannelProcessingManager;
import controller.channel.ChannelUtils;
public class ChannelPanel extends JPanel
implements Listener<ChangedAttribute>,
SettingChangeListener,
ChannelEventListener
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class ChannelPanel extends JPanel
implements Listener<ChangedAttribute>,
SettingChangeListener,
ChannelEventListener
{
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private final static Logger mLog = LoggerFactory.getLogger( ChannelPanel.class );
private final static Logger mLog = LoggerFactory.getLogger(ChannelPanel.class);
private Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
private Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
private Font mFontDetails = new Font(Font.MONOSPACED, Font.PLAIN, 12);
private Font mFontDecoder = new Font(Font.MONOSPACED, Font.PLAIN, 12);
protected Color mColorChannelBackground;
protected Color mColorChannelSelected;
@@ -70,383 +78,388 @@ public class ChannelPanel extends JPanel
private JLabel mStateLabel;
private JLabel mSourceLabel;
private JLabel mOptionsLabel;
private JLabel mSystemLabel;
private JLabel mSiteLabel;
private JLabel mChannelLabel;
protected SettingsManager mSettingsManager;
protected SettingsManager mSettingsManager;
protected IconManager mIconManager;
private Channel mChannel;
private ChannelState mChannelState;
private List<DecoderPanel> mDecoderPanels = new ArrayList<>();
private ChannelModel mChannelModel;
private ChannelProcessingManager mChannelProcessingManager;
/**
* Gui component to a channel state. Provides System, Site and channel
* name, source and channel state visualization.
*
* Updates color background according to current channel state.
*/
public ChannelPanel( ChannelModel channelModel,
ChannelProcessingManager channelProcessingManager,
SettingsManager settingsManager,
Channel channel )
{
mChannelModel = channelModel;
mChannelProcessingManager = channelProcessingManager;
mSettingsManager = settingsManager;
mChannel = channel;
ProcessingChain processingChain =
channelProcessingManager.getProcessingChain( mChannel );
private Channel mChannel;
private ChannelState mChannelState;
private List<DecoderPanel> mDecoderPanels = new ArrayList<>();
private ChannelModel mChannelModel;
private ChannelProcessingManager mChannelProcessingManager;
if( processingChain != null )
{
mChannelState = processingChain.getChannelState();
/**
* Gui component to a channel state. Provides System, Site and channel
* name, source and channel state visualization.
*
* Updates color background according to current channel state.
*/
public ChannelPanel(ChannelModel channelModel,
ChannelProcessingManager channelProcessingManager,
IconManager iconManager,
SettingsManager settingsManager,
Channel channel)
{
mChannelModel = channelModel;
mChannelProcessingManager = channelProcessingManager;
mIconManager = iconManager;
mSettingsManager = settingsManager;
mChannel = channel;
init();
ProcessingChain processingChain =
channelProcessingManager.getProcessingChain(mChannel);
for( DecoderState decoderState: processingChain.getDecoderStates() )
{
DecoderPanel panel = DecoderFactory.getDecoderPanel( mSettingsManager, decoderState );
mDecoderPanels.add( panel );
add( panel, "grow,span" );
}
if(processingChain != null)
{
mChannelState = processingChain.getChannelState();
mChannelState.setChangedAttributeListener( this );
mChannelModel.addListener( this );
mSettingsManager.addListener( this );
}
else
{
mLog.error( "Processing Chain was null!" );
}
}
private void init()
{
getColors();
init();
setLayout( new MigLayout( "insets 1 1 1 1", "[grow,fill]", "[]0[]0[]") );
mSystemLabel = new JLabel( mChannel.getSystem() );
mSystemLabel.setFont( mFontDetails );
mSystemLabel.setForeground( mColorLabelDetails );
add( mSystemLabel );
mSiteLabel = new JLabel( mChannel.getSite() );
mSiteLabel.setFont( mFontDetails );
mSiteLabel.setForeground( mColorLabelDetails );
add( mSiteLabel );
for(DecoderState decoderState : processingChain.getDecoderStates())
{
DecoderPanel panel = DecoderFactory.getDecoderPanel(mIconManager, mSettingsManager, decoderState);
mDecoderPanels.add(panel);
add(panel, "grow,span");
}
mChannelLabel = new JLabel( mChannel.getName() );
mChannelLabel.setFont( mFontDetails );
mChannelLabel.setForeground( mColorLabelDetails );
add( mChannelLabel, "wrap" );
mStateLabel = new JLabel( mChannelState.getState().getDisplayValue() );
mStateLabel.setFont( mFontDecoder );
mStateLabel.setForeground( mColorLabelDecoder );
add( mStateLabel );
mSourceLabel = new JLabel( mChannel.getSourceConfiguration().getDescription() );
mSourceLabel.setFont( mFontDetails );
mSourceLabel.setForeground( mColorLabelDetails );
add( mSourceLabel );
StringBuilder sb = new StringBuilder();
mChannelState.setChangedAttributeListener(this);
mChannelModel.addListener(this);
mSettingsManager.addListener(this);
}
else
{
mLog.error("Processing Chain was null!");
}
}
if( !mChannel.getEventLogConfiguration().getLoggers().isEmpty() )
{
sb.append( "LOG " );
}
RecordConfiguration recordConfig = mChannel.getRecordConfiguration();
if( recordConfig.getRecorders().contains( RecorderType.AUDIO ) )
{
sb.append( "AUDIO " );
}
if( recordConfig.getRecorders().contains( RecorderType.BASEBAND ) ||
recordConfig.getRecorders().contains( RecorderType.TRAFFIC_BASEBAND ) )
{
sb.append( "BASEBAND" );
}
mOptionsLabel = new JLabel( sb.toString() );
mOptionsLabel.setFont( mFontDetails );
mOptionsLabel.setForeground( mColorLabelAuxDecoder );
add( mOptionsLabel, "wrap" );
}
public Channel getChannel()
{
return mChannel;
}
public void dispose()
{
mChannelModel.removeListener( this );
mChannelModel = null;
mChannelProcessingManager = null;
private void init()
{
getColors();
mSettingsManager.removeListener( this );
mSettingsManager = null;
mChannelState.removeChangedAttributeListener();
mChannelState = null;
mChannel = null;
for( DecoderPanel panel: mDecoderPanels )
{
panel.dispose();
remove( panel );
}
mDecoderPanels.clear();
}
@Override
public void receive( final ChangedAttribute changedAttribute )
{
EventQueue.invokeLater( new Runnable()
{
@Override
setLayout(new MigLayout("insets 1 1 1 1", "[grow,fill]", "[]0[]0[]"));
mSystemLabel = new JLabel(mChannel.getSystem());
mSystemLabel.setFont(mFontDetails);
mSystemLabel.setForeground(mColorLabelDetails);
add(mSystemLabel);
mSiteLabel = new JLabel(mChannel.getSite());
mSiteLabel.setFont(mFontDetails);
mSiteLabel.setForeground(mColorLabelDetails);
add(mSiteLabel);
mChannelLabel = new JLabel(mChannel.getName());
mChannelLabel.setFont(mFontDetails);
mChannelLabel.setForeground(mColorLabelDetails);
add(mChannelLabel, "wrap");
mStateLabel = new JLabel(mChannelState.getState().getDisplayValue());
mStateLabel.setFont(mFontDecoder);
mStateLabel.setForeground(mColorLabelDecoder);
add(mStateLabel);
mSourceLabel = new JLabel(mChannel.getSourceConfiguration().getDescription());
mSourceLabel.setFont(mFontDetails);
mSourceLabel.setForeground(mColorLabelDetails);
add(mSourceLabel);
StringBuilder sb = new StringBuilder();
if(!mChannel.getEventLogConfiguration().getLoggers().isEmpty())
{
sb.append("LOG ");
}
RecordConfiguration recordConfig = mChannel.getRecordConfiguration();
if(recordConfig.getRecorders().contains(RecorderType.AUDIO))
{
sb.append("AUDIO ");
}
if(recordConfig.getRecorders().contains(RecorderType.BASEBAND) ||
recordConfig.getRecorders().contains(RecorderType.TRAFFIC_BASEBAND))
{
sb.append("BASEBAND");
}
mOptionsLabel = new JLabel(sb.toString());
mOptionsLabel.setFont(mFontDetails);
mOptionsLabel.setForeground(mColorLabelAuxDecoder);
add(mOptionsLabel, "wrap");
}
public Channel getChannel()
{
return mChannel;
}
public void dispose()
{
mChannelModel.removeListener(this);
mChannelModel = null;
mChannelProcessingManager = null;
mSettingsManager.removeListener(this);
mSettingsManager = null;
mChannelState.removeChangedAttributeListener();
mChannelState = null;
mChannel = null;
for(DecoderPanel panel : mDecoderPanels)
{
panel.dispose();
remove(panel);
}
mDecoderPanels.clear();
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
switch( changedAttribute )
{
case CHANNEL_STATE:
if( mChannelState != null && mChannelState.getState() != null )
{
mStateLabel.setText( mChannelState.getState().getDisplayValue() );
}
break;
case SOURCE:
mSourceLabel.setText( mChannel.getSourceConfiguration()
.getDescription() );
break;
case CHANNEL_NAME:
case SITE_NAME:
case SYSTEM_NAME:
mChannelLabel.setText( mChannel.toString() );
break;
default:
break;
}
switch(changedAttribute)
{
case CHANNEL_STATE:
if(mChannelState != null && mChannelState.getState() != null)
{
mStateLabel.setText(mChannelState.getState().getDisplayValue());
}
break;
case SOURCE:
mSourceLabel.setText(mChannel.getSourceConfiguration()
.getDescription());
break;
case CHANNEL_NAME:
case SITE_NAME:
case SYSTEM_NAME:
mChannelLabel.setText(mChannel.toString());
break;
default:
break;
}
repaint();
repaint();
}
});
}
});
}
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent( g );
setBackground( mColorChannelBackground );
Graphics2D g2 = (Graphics2D)g.create();
super.paintComponent(g);
setBackground(mColorChannelBackground);
Graphics2D g2 = (Graphics2D) g.create();
Paint p = null;
final Channel channel = mChannel;
if( mChannelState != null )
if(mChannelState != null)
{
switch( mChannelState.getState() )
switch(mChannelState.getState())
{
case CALL:
p = getGradient( mColorTopCall, mColorMiddleCall );
break;
case CONTROL:
p = getGradient( mColorTopControl, mColorMiddleControl );
break;
case DATA:
p = getGradient( mColorTopData, mColorMiddleData );
break;
case FADE:
p = getGradient( mColorTopFade, mColorMiddleFade );
break;
case IDLE:
default:
p = getGradient( mColorTopIdle, mColorMiddleIdle );
break;
}
case CALL:
p = getGradient(mColorTopCall, mColorMiddleCall);
break;
case CONTROL:
p = getGradient(mColorTopControl, mColorMiddleControl);
break;
case DATA:
p = getGradient(mColorTopData, mColorMiddleData);
break;
case FADE:
p = getGradient(mColorTopFade, mColorMiddleFade);
break;
case IDLE:
default:
p = getGradient(mColorTopIdle, mColorMiddleIdle);
break;
}
}
if( p == null )
if(p == null)
{
p = getGradient( mColorTopIdle, mColorMiddleIdle );
p = getGradient(mColorTopIdle, mColorMiddleIdle);
}
g2.setPaint( p );
g2.fillRect( 0, 0, getWidth(), getHeight() );
g2.setPaint(p);
g2.fillRect(0, 0, getWidth(), getHeight());
/* Draw bottom separator line */
g2.setColor( Color.LIGHT_GRAY );
g2.drawLine( 0, getHeight() - 1, getWidth(), getHeight() - 1 );
g2.setColor(Color.LIGHT_GRAY);
g2.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
/* Draw channel selected box */
if( getChannel() != null && getChannel().isSelected() )
if(getChannel() != null && getChannel().isSelected())
{
g2.setColor( mColorChannelSelected );
g2.drawRect( 1, 1, getWidth() - 2, getHeight() - 2 );
g2.setColor(mColorChannelSelected);
g2.drawRect(1, 1, getWidth() - 2, getHeight() - 2);
}
g2.dispose();
}
private void getColors()
{
mColorChannelBackground = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_BACKGROUND ).getColor();
mColorChannelSelected = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL ).getColor();
mColorTopCall = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL ).getColor();
mColorMiddleCall = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL ).getColor();
mColorTopControl = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL ).getColor();
mColorMiddleControl = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL ).getColor();
mColorTopData = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA ).getColor();
mColorMiddleData = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA ).getColor();
mColorTopFade = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE ).getColor();
mColorMiddleFade = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE ).getColor();
mColorTopIdle = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE ).getColor();
mColorMiddleIdle = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE ).getColor();
mColorTopNoTuner = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER ).getColor();
mColorMiddleNoTuner = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER ).getColor();
mColorChannelBackground = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_BACKGROUND).getColor();
mColorChannelSelected = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_SELECTED_CHANNEL).getColor();
mColorTopCall = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CALL).getColor();
mColorMiddleCall = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CALL).getColor();
mColorTopControl = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_CONTROL).getColor();
mColorMiddleControl = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL).getColor();
mColorTopData = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_DATA).getColor();
mColorMiddleData = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_DATA).getColor();
mColorTopFade = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_FADE).getColor();
mColorMiddleFade = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_FADE).getColor();
mColorTopIdle = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_IDLE).getColor();
mColorMiddleIdle = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_IDLE).getColor();
mColorTopNoTuner = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_TOP_NO_TUNER).getColor();
mColorMiddleNoTuner = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER).getColor();
mColorLabelDetails = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS ).getColor();
mColorLabelDecoder = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_DECODER ).getColor();
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER ).getColor();
mColorLabelDetails = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS).getColor();
mColorLabelDecoder = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_DECODER).getColor();
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER).getColor();
}
private GradientPaint getGradient( Color top, Color middle )
private GradientPaint getGradient(Color top, Color middle)
{
return new GradientPaint( 0f, -50.0f, top,
0f, (float)getHeight() / 2.2f, middle, true );
return new GradientPaint(0f, -50.0f, top,
0f, (float) getHeight() / 2.2f, middle, true);
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
if(setting instanceof ColorSetting)
{
ColorSetting colorSetting = (ColorSetting) setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_BACKGROUND:
mColorChannelBackground = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_CALL:
mColorMiddleCall = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_CALL:
mColorTopCall = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL:
mColorMiddleControl = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_CONTROL:
mColorTopControl = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_DATA:
mColorMiddleData = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_DATA:
mColorTopData = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_FADE:
mColorMiddleFade = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_FADE:
mColorTopFade = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_IDLE:
mColorMiddleIdle = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_IDLE:
mColorTopIdle = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER:
mColorMiddleNoTuner = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_NO_TUNER:
mColorTopNoTuner = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_AUX_DECODER:
mColorLabelAuxDecoder = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_DECODER:
mColorLabelDecoder = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_DETAILS:
mColorLabelDetails = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_SELECTED_CHANNEL:
mColorChannelSelected = colorSetting.getColor();
repaint();
break;
default:
break;
}
}
switch(colorSetting.getColorSettingName())
{
case CHANNEL_STATE_BACKGROUND:
mColorChannelBackground = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_CALL:
mColorMiddleCall = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_CALL:
mColorTopCall = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL:
mColorMiddleControl = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_CONTROL:
mColorTopControl = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_DATA:
mColorMiddleData = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_DATA:
mColorTopData = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_FADE:
mColorMiddleFade = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_FADE:
mColorTopFade = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_IDLE:
mColorMiddleIdle = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_IDLE:
mColorTopIdle = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER:
mColorMiddleNoTuner = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_GRADIENT_TOP_NO_TUNER:
mColorTopNoTuner = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_AUX_DECODER:
mColorLabelAuxDecoder = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_DECODER:
mColorLabelDecoder = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_DETAILS:
mColorLabelDetails = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_SELECTED_CHANNEL:
mColorChannelSelected = colorSetting.getColor();
repaint();
break;
default:
break;
}
}
}
@Override
public void settingDeleted( Setting setting ) {}
@Override
public void settingDeleted(Setting setting)
{
}
public JMenu getContextMenu()
{
return ChannelUtils.getContextMenu( mChannelModel, mChannelProcessingManager,
mChannel, ChannelPanel.this );
}
public JMenu getContextMenu()
{
return ChannelUtils.getContextMenu(mChannelModel, mChannelProcessingManager,
mChannel, ChannelPanel.this);
}
@Override
public void channelChanged( ChannelEvent event )
{
if( event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
event.getChannel() == mChannel )
{
repaint();
}
}
@Override
public void channelChanged(ChannelEvent event)
{
if(event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
event.getChannel() == mChannel)
{
repaint();
}
}
}

View File

@@ -1,160 +1,162 @@
/*******************************************************************************
* 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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.state;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JPanel;
import alias.Alias;
import icon.IconManager;
import sample.Listener;
import settings.ColorSetting;
import settings.ColorSetting.ColorSettingName;
import settings.Setting;
import settings.SettingChangeListener;
import settings.SettingsManager;
import alias.Alias;
public abstract class DecoderPanel extends JPanel
implements Listener<ChangedAttribute>, SettingChangeListener
import javax.swing.*;
import java.awt.*;
public abstract class DecoderPanel extends JPanel
implements Listener<ChangedAttribute>, SettingChangeListener
{
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
protected Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
protected Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
protected Font mFontAuxDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 10 );
protected Font mFontDetails = new Font(Font.MONOSPACED, Font.PLAIN, 12);
protected Font mFontDecoder = new Font(Font.MONOSPACED, Font.PLAIN, 12);
protected Font mFontAuxDecoder = new Font(Font.MONOSPACED, Font.PLAIN, 10);
public static final int ICON_SIZE = 12;
protected Color mColorLabelDetails;
protected Color mColorLabelDecoder;
protected Color mColorLabelAuxDecoder;
protected SettingsManager mSettingsManager;
protected IconManager mIconManager;
protected SettingsManager mSettingsManager;
protected DecoderState mDecoderState;
public DecoderPanel( SettingsManager settingsManager, DecoderState decoderState )
{
mSettingsManager = settingsManager;
mSettingsManager.addListener( this );
mDecoderState = decoderState;
mDecoderState.setChangedAttributeListener( this );
}
public void dispose()
{
mSettingsManager.removeListener( this );
mSettingsManager = null;
mDecoderState.removeChangedAttributeListener();
mDecoderState = null;
}
public DecoderState getDecoderState()
{
return mDecoderState;
}
protected void init()
{
getColors();
setOpaque( false ); //Use the parent panel's background color
}
public DecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
{
mIconManager = iconManager;
mSettingsManager = settingsManager;
mSettingsManager.addListener(this);
mDecoderState = decoderState;
mDecoderState.setChangedAttributeListener(this);
}
public void dispose()
{
mSettingsManager.removeListener(this);
mSettingsManager = null;
mDecoderState.removeChangedAttributeListener();
mDecoderState = null;
}
public DecoderState getDecoderState()
{
return mDecoderState;
}
protected void init()
{
getColors();
setOpaque(false); //Use the parent panel's background color
}
private void getColors()
{
mColorLabelDetails = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS ).getColor();
mColorLabelDecoder = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_DECODER ).getColor();
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER ).getColor();
mColorLabelDetails = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_DETAILS).getColor();
mColorLabelDecoder = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_DECODER).getColor();
mColorLabelAuxDecoder = mSettingsManager.getColorSetting(
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER).getColor();
}
@Override
public void settingChanged( Setting setting )
@Override
public void settingChanged(Setting setting)
{
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
if(setting instanceof ColorSetting)
{
ColorSetting colorSetting = (ColorSetting) setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_LABEL_AUX_DECODER:
mColorLabelAuxDecoder = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_DECODER:
mColorLabelDecoder = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_DETAILS:
mColorLabelDetails = colorSetting.getColor();
repaint();
break;
default:
break;
}
}
switch(colorSetting.getColorSettingName())
{
case CHANNEL_STATE_LABEL_AUX_DECODER:
mColorLabelAuxDecoder = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_DECODER:
mColorLabelDecoder = colorSetting.getColor();
repaint();
break;
case CHANNEL_STATE_LABEL_DETAILS:
mColorLabelDetails = colorSetting.getColor();
repaint();
break;
default:
break;
}
}
}
@Override
public void settingDeleted( Setting setting ) {}
protected void setAliasLabel( final JLabel label, final Alias alias )
{
setAliasLabel( label, alias, true );
}
protected void setAliasLabel( final JLabel label, final Alias alias, boolean includeIcon )
{
if( alias != null )
{
label.setText( alias.getName() );
@Override
public void settingDeleted(Setting setting)
{
}
protected void setAliasLabel(final JLabel label, final Alias alias)
{
setAliasLabel(label, alias, true);
}
protected void setAliasLabel(final JLabel label, final Alias alias, boolean includeIcon)
{
if(alias != null)
{
label.setText(alias.getName());
if(includeIcon)
{
String iconName = alias.getIconName();
if(iconName != null)
{
label.setIcon(mIconManager.getIcon(iconName, IconManager.DEFAULT_ICON_SIZE));
}
else
{
label.setIcon(null);
}
}
else
{
label.setIcon(null);
}
}
else
{
label.setText("");
label.setIcon(null);
}
}
if( includeIcon )
{
String iconName = alias.getIconName();
if( iconName != null )
{
label.setIcon( mSettingsManager
.getImageIcon( iconName, SettingsManager.DEFAULT_ICON_SIZE ) );
}
else
{
label.setIcon( null );
}
}
else
{
label.setIcon( null );
}
}
else
{
label.setText( "" );
label.setIcon( null );
}
}
}

View File

@@ -1,27 +1,25 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,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/>
* sdrtrunk
* Copyright (C) 2014-2017 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 module.decode.tait;
import java.awt.EventQueue;
import javax.swing.JLabel;
import alias.Alias;
import icon.IconManager;
import module.decode.state.ChangedAttribute;
import module.decode.state.DecoderPanel;
import net.miginfocom.swing.MigLayout;
@@ -30,151 +28,153 @@ import settings.ColorSetting.ColorSettingName;
import settings.Setting;
import settings.SettingsManager;
import javax.swing.*;
import java.awt.*;
public class Tait1200DecoderPanel extends DecoderPanel
{
private static final long serialVersionUID = 1L;
private static final String PROTOCOL = "TAIT-1200";
private JLabel mFromLabel = new JLabel( " " );
private JLabel mFromLabel = new JLabel(" ");
private JLabel mFrom = new JLabel();
private JLabel mFromAlias = new JLabel();
private JLabel mToLabel = new JLabel();
private JLabel mTo = new JLabel( " " );
private JLabel mTo = new JLabel(" ");
private JLabel mToAlias = new JLabel();
private JLabel mProtocol = new JLabel( PROTOCOL );
private JLabel mProtocol = new JLabel(PROTOCOL);
private JLabel mMessage = new JLabel();
private JLabel mMessageType = new JLabel();
public Tait1200DecoderPanel( SettingsManager settingsManager,
Tait1200DecoderState decoderState )
{
super( settingsManager, decoderState );
init();
}
public void dispose()
{
super.dispose();
}
public Tait1200DecoderState getDecoderState()
{
return (Tait1200DecoderState)super.getDecoderState();
}
protected void init()
{
/* Calling super init will get and broadcast color settings to properly
* setup the jlabel colors */
super.init();
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "[]0[]0[]") );
private JLabel mMessageType = new JLabel();
add( mFromLabel );
add( mFrom );
add( mFromAlias, "wrap" );
add( mToLabel );
add( mTo );
add( mToAlias, "wrap" );
add( mProtocol );
add( mMessageType );
add( mMessage, "wrap" );
}
@Override
public void receive( final ChangedAttribute changedAttribute )
public Tait1200DecoderPanel(IconManager iconManager, SettingsManager settingsManager, Tait1200DecoderState decoderState)
{
EventQueue.invokeLater( new Runnable()
{
@Override
super(iconManager, settingsManager, decoderState);
init();
}
public void dispose()
{
super.dispose();
}
public Tait1200DecoderState getDecoderState()
{
return (Tait1200DecoderState) super.getDecoderState();
}
protected void init()
{
/* Calling super init will get and broadcast color settings to properly
* setup the jlabel colors */
super.init();
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
add(mFromLabel);
add(mFrom);
add(mFromAlias, "wrap");
add(mToLabel);
add(mTo);
add(mToAlias, "wrap");
add(mProtocol);
add(mMessageType);
add(mMessage, "wrap");
}
@Override
public void receive(final ChangedAttribute changedAttribute)
{
EventQueue.invokeLater(new Runnable()
{
@Override
public void run()
{
switch( changedAttribute )
{
case FROM_TALKGROUP:
String from = getDecoderState().getFromID();
if( from != null )
{
mFromLabel.setText( "FM:" );
}
else
{
mFromLabel.setText( " " );
}
mFrom.setText( from );
break;
case FROM_TALKGROUP_ALIAS:
Alias fromAlias = getDecoderState().getFromIDAlias();
if( fromAlias != null )
{
mFromAlias.setText( fromAlias.getName() );
}
break;
case TO_TALKGROUP:
String to = getDecoderState().getToID();
if( to != null )
{
mToLabel.setText( "TO:" );
}
else
{
mToLabel.setText( " " );
}
mTo.setText( to );
break;
case TO_TALKGROUP_ALIAS:
Alias toAlias = getDecoderState().getToIDAlias();
if( toAlias != null )
{
mToAlias.setText( toAlias.getName() );
}
break;
case MESSAGE:
mMessage.setText( getDecoderState().getMessage() );
break;
case MESSAGE_TYPE:
mMessageType.setText( getDecoderState().getMessageType() );
break;
default:
break;
}
repaint();
}
} );
}
@Override
public void settingChanged( Setting setting )
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting color = (ColorSetting)setting;
switch(changedAttribute)
{
case FROM_TALKGROUP:
String from = getDecoderState().getFromID();
if( color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER )
{
mFromLabel.setForeground( color.getColor() );
mFrom.setForeground( color.getColor() );
mFromAlias.setForeground( color.getColor() );
mToLabel.setForeground( color.getColor() );
mTo.setForeground( color.getColor() );
mToAlias.setForeground( color.getColor() );
mProtocol.setForeground( color.getColor() );
mMessageType.setForeground( color.getColor() );
mMessage.setForeground( color.getColor() );
}
}
if(from != null)
{
mFromLabel.setText("FM:");
}
else
{
mFromLabel.setText(" ");
}
mFrom.setText(from);
break;
case FROM_TALKGROUP_ALIAS:
Alias fromAlias = getDecoderState().getFromIDAlias();
if(fromAlias != null)
{
mFromAlias.setText(fromAlias.getName());
}
break;
case TO_TALKGROUP:
String to = getDecoderState().getToID();
if(to != null)
{
mToLabel.setText("TO:");
}
else
{
mToLabel.setText(" ");
}
mTo.setText(to);
break;
case TO_TALKGROUP_ALIAS:
Alias toAlias = getDecoderState().getToIDAlias();
if(toAlias != null)
{
mToAlias.setText(toAlias.getName());
}
break;
case MESSAGE:
mMessage.setText(getDecoderState().getMessage());
break;
case MESSAGE_TYPE:
mMessageType.setText(getDecoderState().getMessageType());
break;
default:
break;
}
repaint();
}
});
}
@Override
public void settingChanged(Setting setting)
{
super.settingChanged(setting);
if(setting instanceof ColorSetting)
{
ColorSetting color = (ColorSetting) setting;
if(color.getColorSettingName() ==
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
{
mFromLabel.setForeground(color.getColor());
mFrom.setForeground(color.getColor());
mFromAlias.setForeground(color.getColor());
mToLabel.setForeground(color.getColor());
mTo.setForeground(color.getColor());
mToAlias.setForeground(color.getColor());
mProtocol.setForeground(color.getColor());
mMessageType.setForeground(color.getColor());
mMessage.setForeground(color.getColor());
}
}
}
}