ADD::added 'extra' section to calculator
added checkboxes to add extra activities
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
@@ -17,7 +23,7 @@
|
||||
<children>
|
||||
<AnchorPane fx:id="calculatorTabs" prefHeight="92.0" prefWidth="820.0" style="-fx-background-color: #677069;">
|
||||
<children>
|
||||
<Button fx:id="calculatorGetStartedButton" contentDisplay="TOP" layoutX="188.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayGetStarted" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Get started" textFill="#d4ddd6" AnchorPane.leftAnchor="188.0">
|
||||
<Button fx:id="calculatorGetStartedButton" contentDisplay="TOP" layoutX="147.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayGetStarted" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Get started" textFill="#d4ddd6" AnchorPane.leftAnchor="147.0">
|
||||
<font>
|
||||
<Font name="Corbel Bold" size="16.0" />
|
||||
</font>
|
||||
@@ -33,7 +39,7 @@
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="calculatorTravelButton" contentDisplay="TOP" layoutX="273.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayTravel" prefWidth="79.0" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Travel" textFill="#d4ddd6" AnchorPane.leftAnchor="273.0">
|
||||
<Button fx:id="calculatorTravelButton" contentDisplay="TOP" layoutX="232.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayTravel" prefWidth="79.0" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Travel" textFill="#d4ddd6" AnchorPane.leftAnchor="232.0">
|
||||
<font>
|
||||
<Font name="Corbel Bold" size="16.0" />
|
||||
</font>
|
||||
@@ -50,7 +56,7 @@
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="calculatorHomeButton" contentDisplay="TOP" layoutX="358.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayHome" prefWidth="79.0" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Home" textFill="#d4ddd6" AnchorPane.leftAnchor="358.0">
|
||||
<Button fx:id="calculatorHomeButton" contentDisplay="TOP" layoutX="317.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayHome" prefWidth="79.0" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Home" textFill="#d4ddd6" AnchorPane.leftAnchor="317.0">
|
||||
<font>
|
||||
<Font name="Corbel Bold" size="16.0" />
|
||||
</font>
|
||||
@@ -67,7 +73,7 @@
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="calculatorFoodButton" contentDisplay="TOP" layoutX="443.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayFood" prefWidth="79.0" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Food" textFill="#d4ddd6" AnchorPane.leftAnchor="443.0">
|
||||
<Button fx:id="calculatorFoodButton" contentDisplay="TOP" layoutX="402.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayFood" prefWidth="79.0" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Food" textFill="#d4ddd6" AnchorPane.leftAnchor="402.0">
|
||||
<font>
|
||||
<Font name="Corbel Bold" size="16.0" />
|
||||
</font>
|
||||
@@ -84,7 +90,7 @@
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="calculatorShoppingButton" contentDisplay="TOP" layoutX="528.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayShopping" prefHeight="81.0" prefWidth="79.0" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Shopping" textFill="#d4ddd6" AnchorPane.leftAnchor="528.0">
|
||||
<Button fx:id="calculatorShoppingButton" contentDisplay="TOP" layoutX="487.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayShopping" prefHeight="81.0" prefWidth="79.0" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Shopping" textFill="#d4ddd6" AnchorPane.leftAnchor="487.0">
|
||||
<font>
|
||||
<Font name="Corbel Bold" size="16.0" />
|
||||
</font>
|
||||
@@ -101,10 +107,22 @@
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
<Button fx:id="saveButton" layoutX="702.0" layoutY="24.0" onAction="#saveCalc" mnemonicParsing="false" text="Save">
|
||||
<Button fx:id="saveButton" layoutX="702.0" layoutY="24.0" mnemonicParsing="false" onAction="#saveCalc" text="Save">
|
||||
<font>
|
||||
<Font size="17.0" />
|
||||
</font></Button>
|
||||
<Button fx:id="calculatorExtraButton" contentDisplay="TOP" layoutX="497.0" layoutY="5.0" mnemonicParsing="false" onAction="#displayExtra" prefHeight="81.0" prefWidth="79.0" style="-fx-padding: 0px 0px 0px 0px;" styleClass="navButton" text="Extra" textFill="#d4ddd6" AnchorPane.leftAnchor="572.0">
|
||||
<font>
|
||||
<Font name="Corbel Bold" size="16.0" />
|
||||
</font>
|
||||
<graphic>
|
||||
<ImageView fitHeight="60.0" fitWidth="52.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../icons/icons8-potted-plant-100.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane fx:id="getStartedPane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" AnchorPane.leftAnchor="0.0">
|
||||
@@ -525,9 +543,9 @@
|
||||
</AnchorPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<AnchorPane fx:id="shoppingPane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" visible="false">
|
||||
<AnchorPane fx:id="shoppingPane" layoutY="92.0" prefHeight="611.0" prefWidth="820.0" visible="false">
|
||||
<children>
|
||||
<Text layoutX="133.0" layoutY="50.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How much do you spend on each of the following?">
|
||||
<Text layoutX="185.0" layoutY="36.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How much do you spend on each of the following?">
|
||||
<font>
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
@@ -572,8 +590,36 @@
|
||||
</children>
|
||||
</HBox>
|
||||
<Slider fx:id="servicesSlider" blockIncrement="3428.0" layoutX="133.0" layoutY="418.0" majorTickUnit="3428.0" max="10284.0" minorTickCount="0" prefHeight="24.0" prefWidth="554.0" showTickLabels="true" showTickMarks="true" />
|
||||
<Button layoutX="383.0" layoutY="547.0" mnemonicParsing="false" onAction="#displayExtra" styleClass="nextButton" text="Next" />
|
||||
</children></AnchorPane>
|
||||
<AnchorPane fx:id="extraPane" layoutY="92.0" prefHeight="611.0" prefWidth="820.0" visible="false">
|
||||
<children>
|
||||
<Text layoutX="199.0" layoutY="36.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Have you done any extra activities to save CO2?">
|
||||
<font>
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
</Text>
|
||||
<CheckBox fx:id="localProduceCheckbox" layoutX="233.0" layoutY="189.0" mnemonicParsing="false" styleClass="extraCheckBox" text="Buying local produce" textFill="#727272">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</CheckBox>
|
||||
<CheckBox fx:id="bikeCheckbox" layoutX="233.0" layoutY="235.0" mnemonicParsing="false" styleClass="extraCheckBox" text="Using your bike instead of your car" textFill="#727272">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</CheckBox>
|
||||
<CheckBox fx:id="temperatureCheckbox" layoutX="233.0" layoutY="281.0" mnemonicParsing="false" styleClass="extraCheckBox" text="Lowering the temperature of your home" textFill="#727272">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</CheckBox>
|
||||
<CheckBox fx:id="solarPanelsCheckbox" layoutX="233.0" layoutY="327.0" mnemonicParsing="false" styleClass="extraCheckBox" text="Installing solar panels" textFill="#727272">
|
||||
<font>
|
||||
<Font size="18.0" />
|
||||
</font>
|
||||
</CheckBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.chart.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.shape.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.scene.chart.PieChart?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
@@ -14,7 +21,7 @@
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<AnchorPane prefHeight="702.0" prefWidth="1032.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.DashBoardController">
|
||||
<AnchorPane prefHeight="702.0" prefWidth="1032.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.DashBoardController">
|
||||
<children>
|
||||
<AnchorPane fx:id="menuBar" prefHeight="703.0" prefWidth="216.0" style="-fx-background-color: #5a635c;">
|
||||
<children>
|
||||
@@ -270,13 +277,13 @@
|
||||
<TableView fx:id="globalLeaderboard" layoutX="56.0" layoutY="220.0" prefHeight="333.0" prefWidth="200.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="globalUser" prefWidth="75.0" text="User" />
|
||||
<TableColumn fx:id="globalScore" prefWidth="75.0" text="Score" />
|
||||
<TableColumn fx:id="globalScore" prefWidth="124.0" text="Score" />
|
||||
</columns>
|
||||
</TableView>
|
||||
<TableView fx:id="friendLeaderboard" layoutX="302.0" layoutY="220.0" prefHeight="333.0" prefWidth="200.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="friendUser" prefWidth="75.0" text="User" />
|
||||
<TableColumn fx:id="friendScore" prefWidth="75.0" text="Score" />
|
||||
<TableColumn fx:id="friendScore" prefWidth="124.0" text="Score" />
|
||||
</columns>
|
||||
</TableView>
|
||||
<Label layoutX="69.0" layoutY="177.0" prefHeight="46.0" prefWidth="187.0" text="Global Leaderboard" textAlignment="CENTER" textFill="#5f1616">
|
||||
|
||||
BIN
src/Client/src/main/resources/icons/icons8-potted-plant-100.png
Normal file
BIN
src/Client/src/main/resources/icons/icons8-potted-plant-100.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
src/Client/src/main/resources/icons/icons8-potted-plant-50.png
Normal file
BIN
src/Client/src/main/resources/icons/icons8-potted-plant-50.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -55,6 +55,22 @@
|
||||
-fx-padding: 12;
|
||||
}
|
||||
|
||||
.check-box .box {
|
||||
-fx-background-color: #d7d8d6;
|
||||
-fx-border-color: transparent;
|
||||
-fx-border-radius: 6px;
|
||||
}
|
||||
|
||||
.check-box:selected .mark {
|
||||
-fx-background-color: #ebedea;
|
||||
}
|
||||
|
||||
.check-box:selected .box {
|
||||
-fx-background-color: #91ad83;
|
||||
-fx-border-radius: 6px;
|
||||
-fx-border-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -58,18 +58,18 @@
|
||||
}
|
||||
|
||||
/*friends table*/
|
||||
#friendsTable .column-header {
|
||||
.table-view .column-header {
|
||||
/*-fx-background-color: linear-gradient(#4b7a3d, #588c58);*/
|
||||
-fx-background-color: #5a635c;
|
||||
|
||||
|
||||
}
|
||||
#friendsTable .column-header .label {
|
||||
.table-view .column-header .label {
|
||||
-fx-text-fill: #d4d6d4;
|
||||
-fx-font-size: 18px;
|
||||
}
|
||||
|
||||
#friendsTable .table-cell {
|
||||
.table-view .table-cell {
|
||||
-fx-font-size: 17px;
|
||||
}
|
||||
|
||||
@@ -83,3 +83,5 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user