Skip to content

Commit

Permalink
Merge pull request #1728 from DSheirer/1619-javafx-windows-reappear-i…
Browse files Browse the repository at this point in the history
…conified

#1619 JavaFX Windows Restore to Previous Size/Location On View Request
  • Loading branch information
DSheirer authored Nov 11, 2023
2 parents 672207c + ec7ee1c commit e79f2af
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
Original file line number Diff line number Diff line change
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 e79f2af

Please sign in to comment.