From 582e4e066c8a300fed4f7a807d4795c689531b6c Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Mon, 7 Aug 2017 10:39:50 -0700 Subject: [PATCH] Remove output. --- .../org/nwapw/abacus/fx/AbacusApplication.java | 14 +++++++++++++- .../java/org/nwapw/abacus/fx/AbacusController.java | 11 +++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/nwapw/abacus/fx/AbacusApplication.java b/src/main/java/org/nwapw/abacus/fx/AbacusApplication.java index 82d31fb..e02ed8e 100644 --- a/src/main/java/org/nwapw/abacus/fx/AbacusApplication.java +++ b/src/main/java/org/nwapw/abacus/fx/AbacusApplication.java @@ -12,13 +12,25 @@ import javafx.stage.Stage; */ public class AbacusApplication extends Application { + /** + * The controller currently managing the application. + */ + private AbacusController controller; + @Override public void start(Stage primaryStage) throws Exception { - Parent parent = FXMLLoader.load(getClass().getResource("/abacus.fxml")); + FXMLLoader loader = new FXMLLoader(getClass().getResource("/abacus.fxml")); + Parent parent = loader.load(); + controller = loader.getController(); Scene mainScene = new Scene(parent, 320, 480); primaryStage.setScene(mainScene); primaryStage.setTitle("Abacus"); primaryStage.show(); } + @Override + public void stop() throws Exception { + super.stop(); + controller.performStop(); + } } diff --git a/src/main/java/org/nwapw/abacus/fx/AbacusController.java b/src/main/java/org/nwapw/abacus/fx/AbacusController.java index f3f2acc..bc5ea8e 100644 --- a/src/main/java/org/nwapw/abacus/fx/AbacusController.java +++ b/src/main/java/org/nwapw/abacus/fx/AbacusController.java @@ -259,7 +259,7 @@ public class AbacusController implements PluginListener { } @FXML - private void performCalculation() { + public void performCalculation() { inputButton.setDisable(true); stopButton.setDisable(false); calculationThread = new Thread(CALCULATION_RUNNABLE); @@ -269,7 +269,7 @@ public class AbacusController implements PluginListener { } @FXML - private void performStop(){ + public void performStop(){ if(calculationThread != null) { calculationThread.interrupt(); calculationThread = null; @@ -281,7 +281,7 @@ public class AbacusController implements PluginListener { } @FXML - private void performSaveAndReload() { + public void performSaveAndReload() { performSave(); performReload(); changesMade = false; @@ -289,13 +289,13 @@ public class AbacusController implements PluginListener { } @FXML - private void performReload() { + public void performReload() { alertIfApplyNeeded(true); abacus.getPluginManager().reload(); } @FXML - private void performSave() { + public void performSave() { Configuration configuration = abacus.getConfiguration(); configuration.setNumberImplementation(numberImplementationBox.getSelectionModel().getSelectedItem()); Set disabledPlugins = configuration.getDisabledPlugins(); @@ -305,7 +305,6 @@ public class AbacusController implements PluginListener { } if(computationLimitField.getText().matches("\\d*(\\.\\d+)?") && computationLimitField.getText().length() != 0) configuration.setComputationDelay(Double.parseDouble(computationLimitField.getText())); - System.out.println(configuration.getComputationDelay()); configuration.saveTo(CONFIG_FILE); changesMade = false; reloadAlertShown = false;