Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1619 JavaFX Windows Show Minimized #1719

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions src/main/java/io/github/dsheirer/gui/JavaFxWindowManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,27 +164,7 @@ private void createJFXPanel()
public void shutdown()
{
MyEventBus.getGlobalEventBus().unregister(this);

if(mChannelMapStage != null)
{
mUserPreferences.getJavaFxPreferences().unmonitor(mChannelMapStage);
}

if(mIconManagerStage != null)
{
mUserPreferences.getJavaFxPreferences().unmonitor(mIconManagerStage);
}

if(mPlaylistStage != null)
{
mUserPreferences.getJavaFxPreferences().unmonitor(mPlaylistStage);
}

if(mUserPreferencesStage != null)
{
mUserPreferences.getJavaFxPreferences().unmonitor(mUserPreferencesStage);
}

mUserPreferences.getJavaFxPreferences().clearStageMonitors();
Platform.exit();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2020 Dennis Sheirer
* Copyright (C) 2014-2023 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
Expand All @@ -20,6 +20,10 @@
package io.github.dsheirer.preference.javafx;

import io.github.dsheirer.preference.decoder.JmbeLibraryPreference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.prefs.Preferences;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
Expand All @@ -28,11 +32,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.prefs.Preferences;

/**
* Manages user preferences for JavaFX elements (e.g. stages).
*/
Expand All @@ -59,7 +58,7 @@ public JavaFxPreferences()
*/
public void monitor(Stage stage, String key)
{
mStageMonitors.remove(new StageMonitor(stage, key));
mStageMonitors.add(new StageMonitor(stage, key));
}

/**
Expand All @@ -81,6 +80,21 @@ public void unmonitor(Stage stage)
}
}

/**
* Removes all stage monitors and prepares for shutdown.
*/
public void clearStageMonitors()
{
Iterator<StageMonitor> it = mStageMonitors.iterator();

while(it.hasNext())
{
StageMonitor next = it.next();
it.remove();
next.dispose();
}
}

/**
* Monitors a stage's coordinates and stores location. On construction, applies stored coordinates to the stage.
*/
Expand Down