From 5ff494605e23701f9992e88f3309724f360a3db6 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 3 Aug 2017 18:16:48 -0700 Subject: [PATCH] Add the apply warnings when switching tabs. --- src/main/java/org/nwapw/abacus/fx/AbacusController.java | 9 +++++++++ src/main/resources/abacus.fxml | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/nwapw/abacus/fx/AbacusController.java b/src/main/java/org/nwapw/abacus/fx/AbacusController.java index 6e5332a..bbf5bc6 100644 --- a/src/main/java/org/nwapw/abacus/fx/AbacusController.java +++ b/src/main/java/org/nwapw/abacus/fx/AbacusController.java @@ -46,6 +46,12 @@ public class AbacusController implements PluginListener { */ private static final String ERR_EVAL = "Evaluation Error"; + @FXML + private TabPane coreTabPane; + @FXML + private Tab calculateTab; + @FXML + private Tab settingsTab; @FXML private TableView historyTable; @FXML @@ -143,6 +149,9 @@ public class AbacusController implements PluginListener { parsedColumn.setCellValueFactory(cell -> cell.getValue().parsedProperty()); outputColumn.setCellFactory(cellFactory); outputColumn.setCellValueFactory(cell -> cell.getValue().outputProperty()); + coreTabPane.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { + if(oldValue.equals(settingsTab)) alertIfApplyNeeded(true); + }); abacus = new Abacus(); abacus.getPluginManager().addListener(this); diff --git a/src/main/resources/abacus.fxml b/src/main/resources/abacus.fxml index 8d8567c..9cc8e70 100644 --- a/src/main/resources/abacus.fxml +++ b/src/main/resources/abacus.fxml @@ -11,8 +11,8 @@ xmlns:fx="http://javafx.com/fxml" fx:controller="org.nwapw.abacus.fx.AbacusController">
- - + +
@@ -41,7 +41,7 @@ - +