#849 Resolves issue with frequency table column not updating after saving new channel configuration. (#850)

Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
Denny Sheirer
2020-06-10 05:34:21 -04:00
committed by GitHub
parent 421abe5768
commit 74adb6f30c
2 changed files with 51 additions and 18 deletions

View File

@@ -28,11 +28,10 @@ import io.github.dsheirer.module.decode.DecoderFactory;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.playlist.PlaylistManager;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.source.config.SourceConfigTuner;
import io.github.dsheirer.source.config.SourceConfigTunerMultipleFrequency;
import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.collections.transformation.SortedList;
import javafx.geometry.Insets;
@@ -642,6 +641,7 @@ public class ChannelEditor extends SplitPane
}
}
/**
* Channel tuner channel source frequencies value factory
*/
@@ -653,26 +653,17 @@ public class ChannelEditor extends SplitPane
@Override
public ObservableValue<String> call(TableColumn.CellDataFeatures<Channel, String> param)
{
Channel channel = param.getValue();
ObservableList<Long> frequencies = param.getValue().getFrequencyList();
if(channel != null)
if(frequencies != null)
{
if(channel.getSourceConfiguration() instanceof SourceConfigTuner)
List<String> freqsMHz = new ArrayList<>();
for(Long frequency: frequencies)
{
long frequency = ((SourceConfigTuner)channel.getSourceConfiguration()).getFrequency();
mFrequency.set(String.valueOf(frequency / 1E6));
freqsMHz.add(String.valueOf(frequency / 1E6));
}
else if(channel.getSourceConfiguration() instanceof SourceConfigTunerMultipleFrequency)
{
List<Long> frequencies = ((SourceConfigTunerMultipleFrequency)channel.getSourceConfiguration()).getFrequencies();
List<String> formatted = new ArrayList<>();
for(Long frequency: frequencies)
{
formatted.add(String.valueOf(frequency / 1E6));
}
mFrequency.set(Joiner.on(",").join(formatted));
}
mFrequency.set(Joiner.on(", ").join(freqsMHz));
}
else
{