From 7805122c0665d4154cbf4415fb590e426e051416 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Sun, 31 Mar 2019 14:26:05 +0200 Subject: [PATCH] ADD::added 'extra' section to calculator added checkboxes to add extra activities --- .../controller/CalculatorController.java | 46 ++++++++++-- .../src/main/resources/fxml/calculator.fxml | 66 +++++++++++++++--- .../src/main/resources/fxml/dashboard.fxml | 13 +++- .../icons/icons8-potted-plant-100.png | Bin 0 -> 10450 bytes .../icons/icons8-potted-plant-50.png | Bin 0 -> 1304 bytes .../resources/stylesheets/calculatorStyle.css | 16 +++++ .../resources/stylesheets/dashboardStyle.css | 8 ++- 7 files changed, 127 insertions(+), 22 deletions(-) create mode 100644 src/Client/src/main/resources/icons/icons8-potted-plant-100.png create mode 100644 src/Client/src/main/resources/icons/icons8-potted-plant-50.png diff --git a/src/Client/src/main/java/greenify/client/controller/CalculatorController.java b/src/Client/src/main/java/greenify/client/controller/CalculatorController.java index b7105c3..62929fb 100644 --- a/src/Client/src/main/java/greenify/client/controller/CalculatorController.java +++ b/src/Client/src/main/java/greenify/client/controller/CalculatorController.java @@ -10,11 +10,7 @@ import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Node; -import javafx.scene.control.Button; -import javafx.scene.control.Label; -import javafx.scene.control.ScrollPane; -import javafx.scene.control.Slider; -import javafx.scene.control.TextField; +import javafx.scene.control.*; import javafx.scene.layout.AnchorPane; import javafx.scene.text.Text; import javafx.stage.Stage; @@ -135,6 +131,18 @@ public class CalculatorController { @FXML private Label servicesLabel; + //extra pane + @FXML + private AnchorPane extraPane; + @FXML + private CheckBox localProduceCheckbox; + @FXML + private CheckBox bikeCheckbox; + @FXML + private CheckBox temperatureCheckbox; + @FXML + private CheckBox solarPanelsCheckbox; + /** * initializes the window, performs some actions before loading all other things. * it sets the sliders to snap to the ticks. @@ -243,12 +251,14 @@ public class CalculatorController { * Activated when the designated button (navigation button) is clicked * @param event the click of the button */ + @SuppressWarnings("Duplicates") public void displayGetStarted(ActionEvent event) { getStartedPane.setVisible(true); travelPane.setVisible(false); homePane.setVisible(false); foodPane.setVisible(false); shoppingPane.setVisible(false); + extraPane.setVisible(false); } @@ -257,6 +267,7 @@ public class CalculatorController { * Activated when the designated button (navigation button) is clicked * @param event the click of the button */ + @SuppressWarnings("Duplicates") public void displayTravel(ActionEvent event) { addSlideInAnimation(travelPane); getStartedPane.setVisible(false); @@ -264,7 +275,7 @@ public class CalculatorController { homePane.setVisible(false); foodPane.setVisible(false); shoppingPane.setVisible(false); - + extraPane.setVisible(false); } @@ -273,12 +284,14 @@ public class CalculatorController { * Activated when the designated button (navigation button) is clicked * @param event the click of the button */ + @SuppressWarnings("Duplicates") public void displayHome(ActionEvent event) { getStartedPane.setVisible(false); travelPane.setVisible(false); homePane.setVisible(true); foodPane.setVisible(false); shoppingPane.setVisible(false); + extraPane.setVisible(false); } /** @@ -286,12 +299,14 @@ public class CalculatorController { * Activated when the designated button (navigation button) is clicked * @param event the click of the button */ + @SuppressWarnings("Duplicates") public void displayFood(ActionEvent event) { getStartedPane.setVisible(false); travelPane.setVisible(false); homePane.setVisible(false); foodPane.setVisible(true); shoppingPane.setVisible(false); + extraPane.setVisible(false); } /** @@ -299,18 +314,37 @@ public class CalculatorController { * Activated when the designated button (navigation button) is clicked * @param event the click of the button */ + @SuppressWarnings("Duplicates") public void displayShopping(ActionEvent event) { getStartedPane.setVisible(false); travelPane.setVisible(false); homePane.setVisible(false); foodPane.setVisible(false); shoppingPane.setVisible(true); + extraPane.setVisible(false); + } + + /** + * displays the 'Extra' section of the calculator. + * Activated when the designated button (navigation button) is clicked + * @param event the click of the designated button + */ + @SuppressWarnings("Duplicates") + public void displayExtra(ActionEvent event) { + getStartedPane.setVisible(false); + travelPane.setVisible(false); + homePane.setVisible(false); + foodPane.setVisible(false); + shoppingPane.setVisible(false); + extraPane.setVisible(true); + } /** * The method saves the calculation. * @param event user clicks to button */ + @SuppressWarnings("Duplicates") public void saveCalc(ActionEvent event) throws InterruptedException { getStartedPane.setVisible(false); travelPane.setVisible(false); diff --git a/src/Client/src/main/resources/fxml/calculator.fxml b/src/Client/src/main/resources/fxml/calculator.fxml index 8543d3f..c6527f2 100644 --- a/src/Client/src/main/resources/fxml/calculator.fxml +++ b/src/Client/src/main/resources/fxml/calculator.fxml @@ -1,5 +1,11 @@ + + + + + + @@ -17,7 +23,7 @@ - - - - - - + @@ -525,9 +543,9 @@ - + - + @@ -572,8 +590,36 @@ +