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; 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> * Project: <strong>envoy-client</strong><br>
* File: <strong>SceneContext.java</strong><br> * File: <strong>SceneContext.java</strong><br>
* Created: <strong>06.06.2020</strong><br> * Created: <strong>06.06.2020</strong><br>
@ -75,8 +79,10 @@ public final class SceneContext {
*/ */
public void pop() { public void pop() {
sceneStack.pop(); sceneStack.pop();
if (!sceneStack.isEmpty()) {
stage.setScene(sceneStack.peek()); stage.setScene(sceneStack.peek());
applyCSS(); applyCSS();
}
stage.show(); stage.show();
} }

View File

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