diff --git a/src/Client/src/main/java/greenify/client/controller/ExtraActivityController.java b/src/Client/src/main/java/greenify/client/controller/ExtraActivityController.java index c918a97..f84dff5 100644 --- a/src/Client/src/main/java/greenify/client/controller/ExtraActivityController.java +++ b/src/Client/src/main/java/greenify/client/controller/ExtraActivityController.java @@ -39,6 +39,10 @@ public class ExtraActivityController { @FXML private AnchorPane solarPanelPane; @FXML + private AnchorPane localProducePane; + @FXML + private AnchorPane publicTransportPane; + @FXML private Button displayVeganMealButton; @FXML private Button displayBikeButton; @@ -46,6 +50,10 @@ public class ExtraActivityController { private Button displayTemperatureButton; @FXML private Button displaySolarPanelButton; + @FXML + private Button displayLocalProduceButton; + @FXML + private Button displayPublicTransportButton; @FXML private Button addVeganMealButton; @@ -56,6 +64,10 @@ public class ExtraActivityController { @FXML private Button addSolarPanelsButton; @FXML + private Button addLocalProduceButton; + @FXML + private Button addPublicTransportButton; + @FXML private Slider bikeSlider; @FXML private Label bikeLabel; @@ -68,8 +80,13 @@ public class ExtraActivityController { @FXML private Label solarPanelsLabel; @FXML + private Label publicTransportLabel; + @FXML + private Slider publicTransportSlider; + @FXML private Button saveButton; + /** * initializes the sliders and labels before loading. * sets the labels to display the outputs of the designated sliders. @@ -78,16 +95,22 @@ public class ExtraActivityController { coupleSliderToLabel(bikeSlider, bikeLabel, " km", false); coupleSliderToLabel(temperatureSlider, temperatureLabel, " Degrees", true); coupleSliderToLabel(solarPanelsSlider, solarPanelsLabel, "", true); + coupleSliderToLabel(publicTransportSlider, publicTransportLabel, " km", false); addVeganMealButton.setSkin(new ActivityButtonSkin(addVeganMealButton)); addBikeButton.setSkin(new ActivityButtonSkin(addBikeButton)); addTemperatureButton.setSkin(new ActivityButtonSkin(addTemperatureButton)); addSolarPanelsButton.setSkin(new ActivityButtonSkin(addSolarPanelsButton)); + addLocalProduceButton.setSkin(new ActivityButtonSkin(addLocalProduceButton)); + addPublicTransportButton.setSkin(new ActivityButtonSkin(addPublicTransportButton)); displayVeganMealButton.setSkin(new TranslateButtonSkin(displayVeganMealButton)); displayBikeButton.setSkin(new TranslateButtonSkin(displayBikeButton)); displayTemperatureButton.setSkin(new TranslateButtonSkin(displayTemperatureButton)); displaySolarPanelButton.setSkin(new TranslateButtonSkin(displaySolarPanelButton)); + displayLocalProduceButton.setSkin(new TranslateButtonSkin(displayLocalProduceButton)); + displayPublicTransportButton.setSkin(new TranslateButtonSkin(displayPublicTransportButton)); + } /** @@ -99,7 +122,7 @@ public class ExtraActivityController { * @param string the string to be placed after the outputted value of the slider * @param snapToTicks whether the slider should snap to ticks or not */ - public void coupleSliderToLabel(Slider slider, Label label, String string, + private void coupleSliderToLabel(Slider slider, Label label, String string, boolean snapToTicks) { slider.setSnapToTicks(snapToTicks); slider.valueProperty().addListener(new ChangeListener() { @@ -121,6 +144,8 @@ public class ExtraActivityController { bikePane.setVisible(false); temperaturePane.setVisible(false); solarPanelPane.setVisible(false); + localProducePane.setVisible(false); + publicTransportPane.setVisible(false); } /** @@ -133,6 +158,8 @@ public class ExtraActivityController { bikePane.setVisible(true); temperaturePane.setVisible(false); solarPanelPane.setVisible(false); + localProducePane.setVisible(false); + publicTransportPane.setVisible(false); } /** @@ -145,6 +172,8 @@ public class ExtraActivityController { bikePane.setVisible(false); temperaturePane.setVisible(true); solarPanelPane.setVisible(false); + localProducePane.setVisible(false); + publicTransportPane.setVisible(false); } /** @@ -157,10 +186,40 @@ public class ExtraActivityController { bikePane.setVisible(false); temperaturePane.setVisible(false); solarPanelPane.setVisible(true); + localProducePane.setVisible(false); + publicTransportPane.setVisible(false); } /** - * The method updates the values + * displays the local produce section. + * @param event the click of the designated button + */ + public void displayLocalProduce(ActionEvent event) { + veganMealPane.setVisible(false); + bikePane.setVisible(false); + temperaturePane.setVisible(false); + solarPanelPane.setVisible(false); + localProducePane.setVisible(true); + publicTransportPane.setVisible(false); + } + + /** + * displays the public transport section. + * @param event the click of the designated button + */ + public void displayPublicTransport(ActionEvent event) { + veganMealPane.setVisible(false); + bikePane.setVisible(false); + temperaturePane.setVisible(false); + solarPanelPane.setVisible(false); + localProducePane.setVisible(false); + publicTransportPane.setVisible(true); + } + + + + /** + * The method updates the values. */ @SuppressWarnings("Duplicates") public void save(ActionEvent event) throws InterruptedException { @@ -204,7 +263,7 @@ public class ExtraActivityController { * button skin that sets a translate animation on entering and exiting the button. * @param button the button to set the animation for */ - public TranslateButtonSkin(Button button) { + private TranslateButtonSkin(Button button) { super(button); TranslateTransition transEnter = new TranslateTransition(Duration.millis(50)); @@ -224,7 +283,7 @@ public class ExtraActivityController { private class ActivityButtonSkin extends ButtonSkin { /** * button skin for the 'add activity' buttons. - * adds scale animations on entering, clicking and extiting the button + * adds scale animations on entering, clicking and exiting the button * @param button the button to set the skin of */ private ActivityButtonSkin(Button button) { diff --git a/src/Client/src/main/resources/fxml/extraActivities.fxml b/src/Client/src/main/resources/fxml/extraActivities.fxml index 02bf5c6..657395e 100644 --- a/src/Client/src/main/resources/fxml/extraActivities.fxml +++ b/src/Client/src/main/resources/fxml/extraActivities.fxml @@ -1,5 +1,11 @@ + + + + + + @@ -11,11 +17,11 @@ - + - + - - + + - + @@ -148,7 +172,7 @@ - + @@ -185,6 +209,64 @@ - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Client/src/main/resources/icons/localProduce.png b/src/Client/src/main/resources/icons/localProduce.png new file mode 100644 index 0000000..9383430 Binary files /dev/null and b/src/Client/src/main/resources/icons/localProduce.png differ diff --git a/src/Client/src/main/resources/icons/publicTransport.png b/src/Client/src/main/resources/icons/publicTransport.png new file mode 100644 index 0000000..a86415f Binary files /dev/null and b/src/Client/src/main/resources/icons/publicTransport.png differ