Fix minor error when popping the last scene

This commit is contained in:
Kai S. K. Engelbart 2020-06-08 08:45:15 +02:00
parent 63dc01534d
commit 0ba46f6d46
2 changed files with 10 additions and 3 deletions

View File

@ -13,6 +13,10 @@ import envoy.client.event.ThemeChangeEvent;
import envoy.event.EventBus;
/**
* Manages a stack of scenes. The most recently added scene is displayed inside
* a stage. When a scene is removed from the stack, its predecessor is
* displayed.<br>
* <br>
* Project: <strong>envoy-client</strong><br>
* File: <strong>SceneContext.java</strong><br>
* Created: <strong>06.06.2020</strong><br>
@ -75,8 +79,10 @@ public final class SceneContext {
*/
public void pop() {
sceneStack.pop();
stage.setScene(sceneStack.peek());
applyCSS();
if (!sceneStack.isEmpty()) {
stage.setScene(sceneStack.peek());
applyCSS();
}
stage.show();
}

View File

@ -123,6 +123,7 @@ public final class Startup extends Application {
final var sceneContext = new SceneContext(stage);
sceneContext.load(SceneContext.SceneInfo.CHAT_SCENE);
sceneContext.<ChatSceneController>getController().initializeData(sceneContext, localDB, client, writeProxy);
stage.setTitle("Envoy");
stage.setMinHeight(400);
stage.setMinWidth(350);
@ -137,7 +138,7 @@ public final class Startup extends Application {
* {@inheritDoc}
*/
@Override
public void stop() throws Exception {
public void stop() {
try {
// Save Settings and PersistentLocalDB on shutdown
logger.info("Closing connection...");