Log navigation to catch bugs

This commit is contained in:
huanghongxun
2018-10-14 12:39:22 +08:00
parent 2a44167c22
commit 004c3c588a

View File

@@ -30,6 +30,7 @@ import javafx.scene.layout.StackPane;
import org.jackhuang.hmcl.ui.FXUtils;
import org.jackhuang.hmcl.ui.animation.ContainerAnimations;
import org.jackhuang.hmcl.ui.animation.TransitionHandler;
import org.jackhuang.hmcl.util.Logging;
import java.util.Optional;
import java.util.Stack;
@@ -56,6 +57,8 @@ public class Navigator extends StackPane {
if (from == node)
return;
Logging.LOG.info("Navigate to " + node);
stack.push(node);
fireEvent(new NavigationEvent(this, from, NavigationEvent.NAVIGATING));
setContent(node);
@@ -79,6 +82,8 @@ public class Navigator extends StackPane {
public void close(Node from) {
FXUtils.checkFxUserThread();
Logging.LOG.info("Closed page " + from);
if (stack.peek() != from)
throw new IllegalStateException();
stack.pop();