mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
513 persist application layout across restarts (#514)
* Stores minimal main application window location and size/layout settings to allow application to be restored to the same size/location on restart. * Adds column width monitor to all tables in application that stores the column width settings in the user preferences so that on restarting the application the table column widths are restored to the previous widths.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/*******************************************************************************
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
* Copyright (C) 2014-2019 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
|
||||
@@ -14,8 +15,8 @@
|
||||
*
|
||||
* 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;
|
||||
|
||||
import com.jidesoft.swing.JideTabbedPane;
|
||||
@@ -25,7 +26,7 @@ import io.github.dsheirer.audio.broadcast.BroadcastModel;
|
||||
import io.github.dsheirer.audio.broadcast.BroadcastPanel;
|
||||
import io.github.dsheirer.audio.playback.AudioPanel;
|
||||
import io.github.dsheirer.audio.playback.AudioPlaybackManager;
|
||||
import io.github.dsheirer.channel.metadata.ChannelMetadataViewer;
|
||||
import io.github.dsheirer.channel.metadata.NowPlayingPanel;
|
||||
import io.github.dsheirer.controller.channel.ChannelController;
|
||||
import io.github.dsheirer.controller.channel.ChannelModel;
|
||||
import io.github.dsheirer.controller.channel.ChannelProcessingManager;
|
||||
@@ -41,7 +42,6 @@ import io.github.dsheirer.source.tuner.TunerViewPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTable;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
|
||||
@@ -53,27 +53,18 @@ public class ControllerPanel extends JPanel
|
||||
private AudioPanel mAudioPanel;
|
||||
private BroadcastPanel mBroadcastPanel;
|
||||
private ChannelController mChannelController;
|
||||
private ChannelMetadataViewer mChannelMetadataViewer;
|
||||
private NowPlayingPanel mNowPlayingPanel;
|
||||
private ChannelModel mChannelModel;
|
||||
private MapPanel mMapPanel;
|
||||
private TunerViewPanel mTunerManagerPanel;
|
||||
private BroadcastModel mBroadcastModel;
|
||||
|
||||
private JideTabbedPane mTabbedPane;
|
||||
protected JTable mChannelActivityTable = new JTable();
|
||||
|
||||
public ControllerPanel(AudioPlaybackManager audioPlaybackManager,
|
||||
AliasModel aliasModel,
|
||||
BroadcastModel broadcastModel,
|
||||
ChannelModel channelModel,
|
||||
ChannelMapModel channelMapModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
IconManager iconManager,
|
||||
MapService mapService,
|
||||
SettingsManager settingsManager,
|
||||
SourceManager sourceManager,
|
||||
TunerModel tunerModel,
|
||||
UserPreferences userPreferences)
|
||||
public ControllerPanel(AudioPlaybackManager audioPlaybackManager, AliasModel aliasModel, BroadcastModel broadcastModel,
|
||||
ChannelModel channelModel, ChannelMapModel channelMapModel, ChannelProcessingManager channelProcessingManager,
|
||||
IconManager iconManager, MapService mapService, SettingsManager settingsManager,
|
||||
SourceManager sourceManager, TunerModel tunerModel, UserPreferences userPreferences)
|
||||
{
|
||||
mBroadcastModel = broadcastModel;
|
||||
mChannelModel = channelModel;
|
||||
@@ -81,19 +72,19 @@ public class ControllerPanel extends JPanel
|
||||
mAudioPanel = new AudioPanel(iconManager, userPreferences, settingsManager, sourceManager, audioPlaybackManager,
|
||||
aliasModel);
|
||||
|
||||
mChannelMetadataViewer = new ChannelMetadataViewer(channelModel, channelProcessingManager, iconManager,
|
||||
mNowPlayingPanel = new NowPlayingPanel(channelModel, channelProcessingManager, iconManager,
|
||||
aliasModel, userPreferences);
|
||||
|
||||
mMapPanel = new MapPanel(mapService, aliasModel, iconManager, settingsManager);
|
||||
|
||||
mBroadcastPanel = new BroadcastPanel(broadcastModel, aliasModel, iconManager);
|
||||
mBroadcastPanel = new BroadcastPanel(broadcastModel, aliasModel, iconManager, userPreferences);
|
||||
|
||||
mChannelController = new ChannelController(channelModel, channelProcessingManager, channelMapModel,
|
||||
sourceManager, aliasModel);
|
||||
sourceManager, aliasModel, userPreferences);
|
||||
|
||||
mAliasController = new AliasController(aliasModel, broadcastModel, iconManager);
|
||||
mAliasController = new AliasController(aliasModel, broadcastModel, iconManager, userPreferences);
|
||||
|
||||
mTunerManagerPanel = new TunerViewPanel(tunerModel);
|
||||
mTunerManagerPanel = new TunerViewPanel(tunerModel, userPreferences);
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -108,7 +99,7 @@ public class ControllerPanel extends JPanel
|
||||
mTabbedPane = new JideTabbedPane();
|
||||
mTabbedPane.setFont(this.getFont());
|
||||
mTabbedPane.setForeground(Color.BLACK);
|
||||
mTabbedPane.addTab("Now Playing", mChannelMetadataViewer);
|
||||
mTabbedPane.addTab("Now Playing", mNowPlayingPanel);
|
||||
mTabbedPane.addTab("Aliases", mAliasController);
|
||||
mTabbedPane.addTab("Channels", mChannelController);
|
||||
mTabbedPane.addTab("Map", mMapPanel);
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* sdr-trunk
|
||||
* Copyright (C) 2014-2018 Dennis Sheirer
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2019 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 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.
|
||||
* 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/>
|
||||
*
|
||||
******************************************************************************/
|
||||
* 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 com.jidesoft.swing.JideSplitPane;
|
||||
import io.github.dsheirer.alias.AliasModel;
|
||||
import io.github.dsheirer.controller.channel.map.ChannelMapModel;
|
||||
import io.github.dsheirer.preference.UserPreferences;
|
||||
import io.github.dsheirer.preference.swing.JTableColumnWidthMonitor;
|
||||
import io.github.dsheirer.source.SourceManager;
|
||||
import net.coderazzi.filters.gui.AutoChoices;
|
||||
import net.coderazzi.filters.gui.TableFilterHeader;
|
||||
@@ -43,11 +49,14 @@ public class ChannelController extends JPanel implements ActionListener, ListSel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final String TABLE_PREFERENCE_KEY = "channel.controller";
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private JTable mChannelTable;
|
||||
private JTableColumnWidthMonitor mColumnWidthMonitor;
|
||||
private TableFilterHeader mTableFilterHeader;
|
||||
private ChannelEditor mEditor;
|
||||
private UserPreferences mUserPreferences;
|
||||
|
||||
private static final String NEW_CHANNEL = "New";
|
||||
private static final String COPY_CHANNEL = "Copy";
|
||||
@@ -57,17 +66,16 @@ public class ChannelController extends JPanel implements ActionListener, ListSel
|
||||
private JButton mCopyChannelButton = new JButton(COPY_CHANNEL);
|
||||
private JButton mDeleteChannelButton = new JButton(DELETE_CHANNEL);
|
||||
|
||||
public ChannelController(ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
ChannelMapModel channelMapModel,
|
||||
SourceManager sourceManager,
|
||||
AliasModel aliasModel)
|
||||
public ChannelController(ChannelModel channelModel, ChannelProcessingManager channelProcessingManager,
|
||||
ChannelMapModel channelMapModel, SourceManager sourceManager, AliasModel aliasModel,
|
||||
UserPreferences userPreferences)
|
||||
{
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mEditor = new ChannelEditor(channelModel, channelProcessingManager, channelMapModel, sourceManager, aliasModel);
|
||||
mChannelModel.addListener(mEditor);
|
||||
mChannelProcessingManager.addChannelEventListener(mEditor);
|
||||
mUserPreferences = userPreferences;
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -82,6 +90,7 @@ public class ChannelController extends JPanel implements ActionListener, ListSel
|
||||
mChannelTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
mChannelTable.getSelectionModel().addListSelectionListener(this);
|
||||
mChannelTable.setAutoCreateRowSorter(true);
|
||||
mColumnWidthMonitor = new JTableColumnWidthMonitor(mUserPreferences, mChannelTable, TABLE_PREFERENCE_KEY);
|
||||
|
||||
mTableFilterHeader = new TableFilterHeader(mChannelTable, AutoChoices.ENABLED);
|
||||
mTableFilterHeader.setFilterOnUpdates(true);
|
||||
|
||||
Reference in New Issue
Block a user