Skip to content

Commit

Permalink
#1619 JavaFX windows restore to previous size on view.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Sheirer committed Nov 11, 2023
1 parent 672207c commit ec7ee1c
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions src/main/java/io/github/dsheirer/gui/JavaFxWindowManager.java
Expand Up @@ -244,9 +244,7 @@ public void process(final JmbeEditorRequest request)
else
{
execute(() -> {
getJmbeEditorStage().show();
getJmbeEditorStage().requestFocus();
getJmbeEditorStage().toFront();
restoreStage(getJmbeEditorStage());
getJmbeEditor().process(request);
});
}
Expand Down Expand Up @@ -317,9 +315,7 @@ public void process(PlaylistEditorRequest request)
execute(() -> {
try
{
getPlaylistStage().show();
getPlaylistStage().requestFocus();
getPlaylistStage().toFront();
restoreStage(getPlaylistStage());
getPlaylistEditor().process(request);
}
catch(Throwable t)
Expand Down Expand Up @@ -367,9 +363,7 @@ private Stage getUserPreferencesStage()
public void process(final ViewUserPreferenceEditorRequest request)
{
execute(() -> {
getUserPreferencesStage().show();
getUserPreferencesStage().requestFocus();
getUserPreferencesStage().toFront();
restoreStage(getUserPreferencesStage());
getUserPreferencesEditor().process(request);
});
}
Expand Down Expand Up @@ -408,11 +402,7 @@ private Stage getChannelMapStage()
@Subscribe
public void process(final ViewIconManagerRequest request)
{
execute(() -> {
getIconManagerStage().show();
getIconManagerStage().requestFocus();
getIconManagerStage().toFront();
});
execute(() -> restoreStage(getIconManagerStage()));
}

/**
Expand All @@ -422,9 +412,7 @@ public void process(final ViewIconManagerRequest request)
public void process(final ViewChannelMapEditorRequest request)
{
execute(() -> {
getChannelMapStage().show();
getChannelMapStage().requestFocus();
getChannelMapStage().toFront();
restoreStage(getChannelMapStage());
getChannelMapEditor().process(request);
});
}
Expand All @@ -435,11 +423,19 @@ public void process(final ViewChannelMapEditorRequest request)
@Subscribe
public void process(final ViewRecordingViewerRequest request)
{
execute(() -> {
getRecordingViewerStage().show();
getRecordingViewerStage().requestFocus();
getRecordingViewerStage().toFront();
});
execute(() -> restoreStage(getRecordingViewerStage()));
}

/**
* 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
Expand Down

0 comments on commit ec7ee1c

Please sign in to comment.