mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
ordering to each channel configuration to provide the user with greater control over initial application startup configuration. Adds new dialog window that displays on startup that allows the user to invoke/cancel auto-start, or simply allow the timer to expire whereby the channels will be auto-started. Updates channel table model to include an auto-start column and relabels the 'Enabled' column to read 'Playing'. Updates channel editor to change the 'Enable/Disable' button to read 'Start/Stop'. Changes the 'enabled' property of the channel configuration to indicate the current 'processing' status - isProcessing(). Channel's XML configuration re-purposes the 'enabled' property to indicate auto-start and adds a new (optional) auto-start 'order' attribute.
106 lines
3.0 KiB
Java
106 lines
3.0 KiB
Java
/*******************************************************************************
|
|
* sdr-trunk
|
|
* Copyright (C) 2014-2018 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 io.github.dsheirer.controller.channel;
|
|
|
|
import javax.swing.table.AbstractTableModel;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Auto-Start Channel Model
|
|
*/
|
|
public class AutoStartChannelModel extends AbstractTableModel
|
|
{
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
public static final int COLUMN_ORDER = 0;
|
|
public static final int COLUMN_SYSTEM = 1;
|
|
public static final int COLUMN_SITE = 2;
|
|
public static final int COLUMN_NAME = 3;
|
|
public static final int COLUMN_DECODER = 4;
|
|
|
|
private static final String[] COLUMN_NAMES = new String[] {"Order", "System", "Site", "Name", "Decoder"};
|
|
|
|
private List<Channel> mChannels;
|
|
|
|
public AutoStartChannelModel(List<Channel> autoStartChannels)
|
|
{
|
|
mChannels = autoStartChannels;
|
|
}
|
|
|
|
@Override
|
|
public int getRowCount()
|
|
{
|
|
return mChannels.size();
|
|
}
|
|
|
|
@Override
|
|
public int getColumnCount()
|
|
{
|
|
return COLUMN_NAMES.length;
|
|
}
|
|
|
|
@Override
|
|
public String getColumnName(int columnIndex)
|
|
{
|
|
if(columnIndex < COLUMN_NAMES.length)
|
|
{
|
|
return COLUMN_NAMES[columnIndex];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public Class<?> getColumnClass(int columnIndex)
|
|
{
|
|
return String.class;
|
|
}
|
|
|
|
@Override
|
|
public boolean isCellEditable(int rowIndex, int columnIndex)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public Object getValueAt(int rowIndex, int columnIndex)
|
|
{
|
|
Channel channel = mChannels.get(rowIndex);
|
|
|
|
switch(columnIndex)
|
|
{
|
|
case COLUMN_ORDER:
|
|
return channel.getAutoStartOrder();
|
|
case COLUMN_SYSTEM:
|
|
return channel.getSystem();
|
|
case COLUMN_SITE:
|
|
return channel.getSite();
|
|
case COLUMN_NAME:
|
|
return channel.getName();
|
|
case COLUMN_DECODER:
|
|
return channel.getDecodeConfiguration().getDecoderType().getShortDisplayString();
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
|
|
{
|
|
throw new IllegalArgumentException("Not yet implemented");
|
|
}
|
|
}
|