Make resizability a property of SceneInfo

This removes a check hard coded into SceneContext that sets LoginScene
to not resizable.
This commit is contained in:
Kai S. K. Engelbart 2020-11-06 09:21:59 +01:00
parent 0ce8b0c89d
commit 4d4865570d
Signed by: kske
GPG Key ID: 8BEB13EC5DF7EF13
2 changed files with 12 additions and 5 deletions

View File

@ -77,11 +77,8 @@ public final class SceneContext implements EventListener {
scene.getAccelerators()
.putAll(((KeyboardMapping) controller).getKeyboardShortcuts());
// The LoginScene is the only scene not intended to be resized
// As strange as it seems, this is needed as otherwise the LoginScene won't be
// displayed on some OS (...Debian...)
Platform.runLater(() -> stage.setResizable(sceneInfo.resizable));
stage.sizeToScene();
Platform.runLater(() -> stage.setResizable(sceneInfo != SceneInfo.LOGIN_SCENE));
applyCSS();
stage.show();
} catch (final IOException e) {

View File

@ -27,14 +27,24 @@ public enum SceneInfo {
*
* @since Envoy Client v0.1-beta
*/
LOGIN_SCENE("/fxml/LoginScene.fxml");
LOGIN_SCENE("/fxml/LoginScene.fxml", false);
/**
* The path to the FXML resource.
*/
public final String path;
/**
* Whether the scene should be resizable.
*/
public final boolean resizable;
SceneInfo(String path) {
this(path, true);
}
SceneInfo(String path, boolean resizable) {
this.path = path;
this.resizable = resizable;
}
}