Merge pull request #1728 from DSheirer/1619-javafx-windows-reappear-iconified

#1619 JavaFX Windows Restore to Previous Size/Location On View Request
This commit is contained in:
Denny Sheirer
2023-11-11 06:47:27 -05:00
committed by GitHub

View File

@@ -244,9 +244,7 @@ public class JavaFxWindowManager extends Application
else else
{ {
execute(() -> { execute(() -> {
getJmbeEditorStage().show(); restoreStage(getJmbeEditorStage());
getJmbeEditorStage().requestFocus();
getJmbeEditorStage().toFront();
getJmbeEditor().process(request); getJmbeEditor().process(request);
}); });
} }
@@ -317,9 +315,7 @@ public class JavaFxWindowManager extends Application
execute(() -> { execute(() -> {
try try
{ {
getPlaylistStage().show(); restoreStage(getPlaylistStage());
getPlaylistStage().requestFocus();
getPlaylistStage().toFront();
getPlaylistEditor().process(request); getPlaylistEditor().process(request);
} }
catch(Throwable t) catch(Throwable t)
@@ -367,9 +363,7 @@ public class JavaFxWindowManager extends Application
public void process(final ViewUserPreferenceEditorRequest request) public void process(final ViewUserPreferenceEditorRequest request)
{ {
execute(() -> { execute(() -> {
getUserPreferencesStage().show(); restoreStage(getUserPreferencesStage());
getUserPreferencesStage().requestFocus();
getUserPreferencesStage().toFront();
getUserPreferencesEditor().process(request); getUserPreferencesEditor().process(request);
}); });
} }
@@ -408,11 +402,7 @@ public class JavaFxWindowManager extends Application
@Subscribe @Subscribe
public void process(final ViewIconManagerRequest request) public void process(final ViewIconManagerRequest request)
{ {
execute(() -> { execute(() -> restoreStage(getIconManagerStage()));
getIconManagerStage().show();
getIconManagerStage().requestFocus();
getIconManagerStage().toFront();
});
} }
/** /**
@@ -422,9 +412,7 @@ public class JavaFxWindowManager extends Application
public void process(final ViewChannelMapEditorRequest request) public void process(final ViewChannelMapEditorRequest request)
{ {
execute(() -> { execute(() -> {
getChannelMapStage().show(); restoreStage(getChannelMapStage());
getChannelMapStage().requestFocus();
getChannelMapStage().toFront();
getChannelMapEditor().process(request); getChannelMapEditor().process(request);
}); });
} }
@@ -435,11 +423,19 @@ public class JavaFxWindowManager extends Application
@Subscribe @Subscribe
public void process(final ViewRecordingViewerRequest request) public void process(final ViewRecordingViewerRequest request)
{ {
execute(() -> { execute(() -> restoreStage(getRecordingViewerStage()));
getRecordingViewerStage().show(); }
getRecordingViewerStage().requestFocus();
getRecordingViewerStage().toFront(); /**
}); * Restores the stage to previous size and location.
* @param stage to restore.
*/
private void restoreStage(Stage stage)
{
stage.setIconified(false);
stage.show();
stage.requestFocus();
stage.toFront();
} }
@Override @Override