Merge branch 'master' into 'Feature/achievements'

# Conflicts:
#   src/Client/src/main/java/greenify/client/Friend.java
#   src/Client/src/main/java/greenify/client/Hints.java
#   src/Client/src/main/java/greenify/client/controller/DashBoardController.java
#   src/Client/src/main/java/greenify/client/rest/UserService.java
#   src/Client/src/main/resources/fxml/dashboard.fxml
#   src/Client/src/test/java/UserServiceTest.java
#   src/Server/src/main/java/greenify/server/data/model/User.java
#   src/Server/src/main/java/greenify/server/rest/UserController.java
#   src/Server/src/main/java/greenify/server/service/UserService.java
#   src/Server/src/test/java/greenify/server/rest/UserControllerTest.java
#   src/Server/src/test/java/greenify/server/service/UserServiceTest.java
This commit is contained in:
Mika Wauben
2019-04-04 05:45:17 +00:00
40 changed files with 2644 additions and 102 deletions

108
README.md
View File

@@ -1,15 +1,47 @@
## Getting your weekly reports
# Greenify
The easiest way to save CO2 and help the environment! Enter your activities and find out your carbon footprint.
**Jacoco**:
Run `maven install` ([Intellij](https://www.jetbrains.com/help/idea/2016.3/getting-started-with-maven.html#execute_maven_goal)/[Eclipse](http://imgur.com/a/6q7pV))
## Getting started
You can install greenify with gradle, if you already have gradle on your machine, run:
**Checkstyle**:
Run `maven site`
```
gradle install something tralala
```
# Merel Steenbergen (masteenbergen)
![Picture:](https://gitlab.ewi.tudelft.nl/cse1105/2018-2019/oopp-group-43/template/blob/master/Pictures%20Group%20Members/Merel_Steenbergen.jpg)
Do you not have gradle on your machine, run:
## Personal Development Plan
```
./gradlew install something tralala
```
With the following you can start the application
```
gradle greenify bootrun
```
or without gradle on your device:
```
./gradlew greenify bootrun
```
## Running the tests
The tests cover all non-GUI code:
```
gradle check
```
## Licence
GNU General Public License v3.0
## Contributors
### Merel Steenbergen (masteenbergen)
<img src="https://user-images.githubusercontent.com/47633984/55274602-13cc1200-52da-11e9-9bd7-686d84929b83.jpg" width="100"/>
#### Personal Development Plan
My strong points:
1. Im a natural leader. I like to know how everyone is doing, if
@@ -20,36 +52,36 @@ What are two of your weaker points?
1. Im a bit of a control freak. Sometimes I find it hard to let other people do things and to mind my own business.
2. Im competitive. This can be a good thing, because Im very passionate and really give it 100% if I like something, but it can also lead to hurt feelings when Im not paying attention.
![Core quadrant:](https://gitlab.ewi.tudelft.nl/cse1105/2018-2019/oopp-group-43/template/blob/master/Pictures%20Group%20Members/Core_quadrant_Merel.png)
<img src="https://user-images.githubusercontent.com/47633984/55274622-2d6d5980-52da-11e9-8be0-ac1ef545f7d9.png" width="700"/>
### G - Goal
##### G - Goal
I want to improve on letting other people handle things that I actually want to do myself. I also want to improve my programming and am aiming to not make it a competition, but to really make it a group project. This is important, because you almost never work alone in software developing, which is what I want to do after the studies.
### R - Reality (Your current situation)
##### R - Reality (Your current situation)
Ive already been working on my teamwork skills since high school. I had a subject that had only projects. Ive also worked with Scrum before, which really helps you focus on your development without letting your project out of sight. Im better at working together and listening to tips than I was before.
### O - Options (Look at possible options)
##### O - Options (Look at possible options)
Actively watching myself and letting my teammates know that they need to be clear with me if they dont like something I say or do are the best ways for me to improve. I would rather improve by myself, but for my goals it is better to let my team guide me. Its about teamwork after all.
### W - Will (Motivation, plan of action)
##### W - Will (Motivation, plan of action)
Im just going to keep working on myself and hope my teammates will work with me. It also helps to work in different teams to get a much more diverse experience. Every team is different, so Im just going to wait what this team will bring me and how I will have to adjust myself to make the team efficient.
# Sem van der Hoeven (4896726, semvanderhoeve)
![Picture location](https://gitlab.ewi.tudelft.nl/cse1105/2018-2019/oopp-group-43/template/blob/master/doc/Pictures%20Group%20Members/sem_van_der_hoeven.jpg)
### Sem van der Hoeven (4896726, semvanderhoeve)
<img src="https://user-images.githubusercontent.com/47633984/55274658-d6b44f80-52da-11e9-9404-a4ae9a210b72.jpg" width="100"/>
## Personal development plan
![Core quadrant location](https://gitlab.ewi.tudelft.nl/cse1105/2018-2019/oopp-group-43/template/blob/master/doc/Pictures%20Group%20Members/sem_van_der_hoeven_core_quadrant.png)
#### Personal development plan
<img src="https://user-images.githubusercontent.com/47633984/55274673-0a8f7500-52db-11e9-8d83-e1acbf22aeed.png" width="700"/>
### G - Goal
##### G - Goal
My goal with this project is most of all to be able to efficiently work with a group of people. This is important to me because I have not worked on a (development) project with a (big) group of people before. I believe I have succeeded in this goal when our project is finished and we have got a passing grade.
### R - Reality
##### R - Reality
With this project I am already setting the first step towards reaching my goal, as we have already started working as a group.
### O - Options
##### O - Options
The options I have to reach my goal are basically this project, as this is the only big project we will be doing as a team in this year. I want to obviously try to learn as much as I can during this project, especially abour working in a group. The only thing I think would be stopping this is if members of the group had different opinions on how things should be done. but so far everyone is on the same track :D.
### W - Will
##### W - Will
I am going to try my hardest to follow the rules we have set up, and to deliver everything I am supposed to. I will try to do this everytime I get the chance to do so. Right now the first step I can take is to work on this personal development plan, so that I already have my part of what we needed to do finished. My teammates can help me achieve this goal by helping if I have questions or don't understand something/am getting stuck with something.
action plan:
⋅⋅* finish my part of the readme that we have to finish
@@ -57,13 +89,11 @@ action plan:
⋅⋅* don't be hesitant on asking people for help
⋅⋅* deliver things I need to do on time
# Ceren Ugurlu (4851609, cugurlu)
### Ceren Ugurlu (4851609, cugurlu)
<img src="https://user-images.githubusercontent.com/47633984/55274734-10398a80-52dc-11e9-9fce-5059ac2b3f3b.jpeg" width="100"/>
![My Picture](https://gitlab.ewi.tudelft.nl/cse1105/2018-2019/oopp-group-43/template/blob/master/Pictures%20Group%20Members/ceren_ugurlu.jpeg)
## Personal Development Plan:
- This is my core quadrant: ![My Core Quadrant](https://gitlab.ewi.tudelft.nl/cse1105/2018-2019/oopp-group-43/template/blob/master/Pictures%20Group%20Members/Ceren_Ugurlu_Core_Quadrant.png)
#### Personal Development Plan:
<img src="https://user-images.githubusercontent.com/47633984/55274694-4296b800-52db-11e9-9cee-b8d1d5c58e6f.png" width="700"/>
My strong points:
- I am an ambitious person in order to achieve my goal I can study a lot
@@ -73,7 +103,7 @@ My strong points:
My weaker points:
- Sometimes I can be a stressed and anxious person. If we have a difficulty about time management etc. I can get stressed. But if we work efficiently as a team, I do not think this is going to be a problem
### G Goal
##### G Goal
My goals in this project:
- Developing my Java skills
- Learning how to work effectively as a team
@@ -81,13 +111,13 @@ My goals in this project:
I am aiming to successfully finish the parts that belong to me in our project. To achieve this, I should develop my Java skills. I want to contribute to my group and to learn new things from my teammates. When we finish our project, I will be achieved my goal.
### R Reality
##### R Reality
This is my first team project. I have never experienced this before. I have done some similar programs in different languages but this is the first one in Java. This is both exciting and hard. There are many things I need to do but I like to study and develop myself.
### O Options
##### O Options
There are two options to achieve and not to achieve but I do not want to count the second one as an option because we are a team. And teamwork means that many different perspectives and a lot of human power. Therefore, I can say that there is not any reason for an unsuccessful result. If it happens, it is also not a problem. It shows that I need to develop myself. I would try to learn new things from my mistakes.
### W Will
##### W Will
I will try to do my best to be successful in our project and I am going to start right now for this. The first step I can take is creating a plan with my group mates and to start our project according to this plan.
Action Plan:
@@ -97,11 +127,11 @@ Action Plan:
- Starting to code (informing each other about the steps we have took)
- While everyone is working on their part, to inform each other about the progress is very important because some parts can be connected. When two people's parts are connected they should act according to that otherwise it can lead problems or a non-compiling code)
# Mika Wauben (4834739, mlwauben)
![My picture](https://gitlab.ewi.tudelft.nl/cse1105/2018-2019/oopp-group-43/template/blob/master/Pictures%20Group%20Members/mlwaubenpic.jpg)
### Mika Wauben (4834739, mlwauben)
<img src="https://user-images.githubusercontent.com/47633984/55274742-29423b80-52dc-11e9-804d-69feec6d28e0.jpg" width="100"/>
## Personal Development Plan
![My core quadrant](https://gitlab.ewi.tudelft.nl/cse1105/2018-2019/oopp-group-43/template/blob/master/Pictures%20Group%20Members/mlwaubenCoreQuadrant.jpg)
#### Personal Development Plan
<img src="https://user-images.githubusercontent.com/47633984/55274719-c18bf080-52db-11e9-9d3f-018ba68dd1f0.jpg" width="700"/>
My strong points:
1. I am observing and think before I speak.
@@ -111,14 +141,14 @@ Action Plan:
1. I like to do things alone. I rather figure something out myself instead of asking for help, even if this takes way too long.
2. I tend to stay quiet if I'm not absolutely sure my contribution is right or useful.
### G - Goal
##### G - Goal
My goal during this course is getting more experienced in working with things like github, libraries, scrumboard, etc. and asking for help if I need it, since being stuck on something isnt going to help my groupmates.
### R - Reality
##### R - Reality
Every minute that were working on the project, Im also actively working on my goal.
### O - Options
##### O - Options
By working on the project with the chosen programs, Ill get more experienced in using them. Using those programs for other projects as well will only improve my knowledge. By being active in the groupchat and during the meetings, asking stuff will be easier.
### W - Will
##### W - Will
I will reach my goal by working actively together with my teammates using lots of the useful programs given.

View File

@@ -0,0 +1,47 @@
# Meeting 7
## Opening
> Check if everyone is present:
- ~~Nivard Jansen~~
- ~~Kristin Peneva~~
- ~~Daan Sneep~~
- [x] Merel SteenBergen
- [x] Ceren Ugurlu
- [x] Mika Wauben
- [x] Sem van der Hoeven
- Chair: Mika Wauben
- Secretary: Ceren Ugurlu
## Points of action
- First of all, discuss problems we have faced and if somebody is halted because of a problem
- if so, try to work out the problem
### pre/during meeting
- Discuss what we did last week (see scrumboard)
- Does anyone have blocking issues?
- Gitlab
- CI
- Coverage reports
- Checkstyle reports
- Show demo 3 to the TA
- Discuss about the presentation
- Discuss about final things that need to be done
### post meeting
- Focus on the presentation
- Focus on the final report
- Focus on things we get points for according to the rubric
## Any other business
> If anybody has something that should be discussed but came up with that after the agenda was finalized, he/she should bring that up now so that it can be discussed after all.
## Question round
- Questions for the TA
- questions that were already present
- Ask about custom CI (do we have it already?)
- questions that rose during the meeting
## Closing
> We're almost finished!

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

View File

@@ -0,0 +1,14 @@
# Sprint Review
## Main problems Encountered
### Problem 1: We had some bugs
because of some bugs in the server, things did not work as intended. Ceren fixed it.
## Adjustments from previous sprints
Write all we still need to do down, even if the things are not necessarily assigned to a specific person yet.
## Adjustments for next sprint
- Write down all other necessary tasks.

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

View File

Binary file not shown.

View File

@@ -1,3 +0,0 @@
<module name="SuppressionFilter">
<property name="file" value="quality/checkstyle/suppressions.xml" />
</module>

View File

@@ -52,11 +52,11 @@ public class Hints {
+ "utensils and napkins, it saves plastic and paper.");
hints.add("It takes about 66 days to form a new habit, keep going!");
hints.add("Get yourself a nice reusable water bottle! It's cheaper and better for "
+ "the environment to refill than to buy a new one every time it's empty.");
+ "the environment to refill than to buy a new one every time it's empty.");
}
/**
* This method gets a random hint from the list of hints.
* This method returns a random hint from the list of hints.
* @return the random hint.
*/
public String randomHint() {

View File

@@ -1,33 +1,42 @@
package greenify.client.controller;
import greenify.client.Application;
import greenify.client.rest.UserService;
import javafx.animation.Interpolator;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.value.ChangeListener;
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.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Slider;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Duration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.io.IOException;
import java.text.DecimalFormat;
@Controller
public class CalculatorController {
@Autowired
UserService userService;
@FXML
private Button calculatorGetStartedButton;
@FXML
private Button calculatorTravelButton;
@FXML
private Button calculatorHomeButton;
@FXML
private Button calculatorFoodButton;
@FXML
private Button calculatorShoppingButton;
@Autowired
DashBoardController controller;
//navigation panes
@FXML
private AnchorPane getStartedPane;
@FXML
@@ -35,9 +44,11 @@ public class CalculatorController {
@FXML
private AnchorPane homePane;
@FXML
private AnchorPane foodPane;
private ScrollPane foodPane;
@FXML
private AnchorPane shoppingPane;
//'get started' pane
@FXML
private Slider peopleInHouseholdSlider;
@FXML
@@ -48,19 +59,106 @@ public class CalculatorController {
private Label annualIncomeLabel;
@FXML
private Button saveButton;
//travel pane
@FXML
private TextField publicTransitField;
@FXML
private TextField airplaneTravelField;
@FXML
private TextField carTravelGasolineField;
@FXML
private Slider carTravelGasolineSlider;
@FXML
private Label carTravelGasolineLabel;
@FXML
private TextField carTravelDieselField;
@FXML
private Slider carTravelDieselSlider;
@FXML
private Label carTravelDieselLabel;
@FXML
private TextField carTravelElectricField;
@FXML
private Slider carTravelElectricSlider;
@FXML
private Label carTravelElectricLabel;
//home pane
@FXML
private TextField electricityField;
@FXML
private Slider cleanEnergyPurchasedSlider;
@FXML
private Label cleanEnergyPurchasedLabel;
@FXML
private TextField naturalGasField;
@FXML
private TextField heatingOilField;
@FXML
private TextField livingSpaceField;
@FXML
private Slider waterUsageSlider;
@FXML
private Label waterUsageLabel;
//food pane
@FXML
private Slider meatFishEggsSlider;
@FXML
private Label meatFishEggsLabel;
@FXML
private Slider grainsBakedGoodsSlider;
@FXML
private Label grainsBakedGoodsLabel;
@FXML
private Slider dairySlider;
@FXML
private Label dairyLabel;
@FXML
private Slider fruitsVegetablesSlider;
@FXML
private Label fruitsVegetablesLabel;
@FXML
private Slider snacksDrinksSlider;
@FXML
private Label snacksDrinksLabel;
//shopping pane
@FXML
private Text goodsField;
@FXML
private Text servicesField;
@FXML
private Slider goodsSlider;
@FXML
private Label goodsLabel;
@FXML
private Slider servicesSlider;
@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
* it adds listeners to all the sliders for updating the label next to them
* it sets the sliders to snap to the ticks.
* it adds listeners to all the sliders for updating the label they are associated with.
*/
@SuppressWarnings("Duplicates")
public void initialize() {
peopleInHouseholdSlider.setSnapToTicks(true);
annualIncomeSlider.setSnapToTicks(true);
//add listener to slider for amount of people in household
peopleInHouseholdSlider.valueProperty().addListener(new ChangeListener<Number>() {
@@ -78,6 +176,80 @@ public class CalculatorController {
annualIncomeLabel.setText("" + (newValue.intValue() * 1000));
}
});
addSliderListenerCarUsage(carTravelGasolineSlider, carTravelGasolineLabel, " km/L");
addSliderListenerCarUsage(carTravelDieselSlider, carTravelDieselLabel, " km/L");
addSliderListenerCarUsage(carTravelElectricSlider, carTravelElectricLabel, " km/Le");
cleanEnergyPurchasedSlider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
cleanEnergyPurchasedLabel.setText(newValue.intValue() + " %");
}
});
waterUsageSlider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
waterUsageLabel.setText(newValue.intValue() + "% of similar households");
}
});
addSliderListenerDailyServing(meatFishEggsSlider, meatFishEggsLabel);
addSliderListenerDailyServing(grainsBakedGoodsSlider, grainsBakedGoodsLabel);
addSliderListenerDailyServing(dairySlider, dairyLabel);
addSliderListenerDailyServing(fruitsVegetablesSlider, fruitsVegetablesLabel);
addSliderListenerDailyServing(snacksDrinksSlider, snacksDrinksLabel);
addSliderListenerGoodsServices(goodsSlider, goodsLabel);
addSliderListenerGoodsServices(servicesSlider, servicesLabel);
}
/**
* adds the listener to the given slider and displays it's output on a given label.
* @param slider the slider to attach the listener to.
* @param label the label to display the slider output on.
*/
private void addSliderListenerCarUsage(Slider slider, Label label, String unit) {
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
label.setText(newValue.intValue() + unit);
}
});
}
@SuppressWarnings("Duplicates")
private void addSliderListenerDailyServing(Slider slider, Label label) {
DecimalFormat df = new DecimalFormat("0.0");
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
label.setText(df.format(newValue.doubleValue()) + " daily servings per person");
}
});
}
private void addSliderListenerGoodsServices(Slider slider, Label label) {
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
label.setText(newValue.intValue() + "€ / month");
}
});
}
private void addSlideInAnimation(Node node) {
Timeline timeline = new Timeline();
KeyValue keyValue = new KeyValue(node.translateXProperty(), 0, Interpolator.EASE_OUT);
KeyFrame keyFrame = new KeyFrame(Duration.millis(600), keyValue);
timeline.getKeyFrames().add(keyFrame);
timeline.play();
}
/**
@@ -85,12 +257,15 @@ 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);
}
@@ -99,12 +274,16 @@ 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) {
getStartedPane.setVisible(false);
travelPane.setVisible(true);
homePane.setVisible(false);
foodPane.setVisible(false);
shoppingPane.setVisible(false);
extraPane.setVisible(false);
}
/**
@@ -112,12 +291,15 @@ 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);
}
/**
@@ -125,12 +307,15 @@ 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);
}
/**
@@ -138,36 +323,186 @@ 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) throws IOException {
extraPane.getChildren().setAll((Node) Application.load(this.getClass()
.getClassLoader().getResource("fxml/extraActivities.fxml")));
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
*/
public void saveCalculation(ActionEvent event) {
@SuppressWarnings("Duplicates")
public void saveCalc(ActionEvent event) throws InterruptedException {
getStartedPane.setVisible(false);
travelPane.setVisible(false);
homePane.setVisible(false);
foodPane.setVisible(false);
shoppingPane.setVisible(false);
if (!annualIncomeLabel.getText().equals(null)) {
if (!annualIncomeLabel.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(), "input_income",
annualIncomeLabel.getText());
}
if (!peopleInHouseHoldLabel.getText().equals(null)) {
userService.updateInput(userService.currentUser.getName(), "input_population",
if (!peopleInHouseHoldLabel.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(), "input_size",
peopleInHouseHoldLabel.getText());
}
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_naturalgas_cuft", "0");
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_miles1", "0");
if (!publicTransitField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_publictrans",
publicTransitField.getText());
}
if (!airplaneTravelField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_airtotal",
airplaneTravelField.getText());
}
if (!carTravelGasolineField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_miles1",
carTravelGasolineField.getText());
}
if (!carTravelGasolineLabel.getText().replace(" mpg", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_mpg1",
carTravelGasolineLabel.getText().replace(" mpg", ""));
}
if (!carTravelDieselField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_miles2",
carTravelDieselField.getText());
}
if (!carTravelDieselLabel.getText().replace(" mpg", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_mpg2",
carTravelDieselLabel.getText().replace(" mpg", ""));
}
if (!carTravelElectricField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_miles3",
carTravelElectricField.getText());
}
if (!carTravelElectricLabel.getText().replace(" mpge", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_mpg3",
carTravelElectricLabel.getText().replace(" mpge", ""));
}
if (!electricityField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_electricity_dollars",
electricityField.getText());
}
if (!cleanEnergyPurchasedLabel.getText().replace(" %", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_gco2_per_kwh",
cleanEnergyPurchasedLabel.getText().replace(" %", ""));
}
if (!naturalGasField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_naturalgas_dollars",
naturalGasField.getText());
}
if (!heatingOilField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_heatingoil_dollars",
heatingOilField.getText());
}
if (!livingSpaceField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_squarefeet",
livingSpaceField.getText());
}
if (!waterUsageLabel.getText().replace("% of similar households", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_watersewage",
waterUsageLabel.getText().replace("% of similar households", ""));
}
if (!meatFishEggsLabel.getText().replace(" daily servings per person", "").equals("2.6")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_meatfisheggs",
meatFishEggsLabel.getText().replace(" daily servings per person", ""));
}
if (!grainsBakedGoodsLabel.getText()
.replace(" daily servings per person", "").equals("4.4")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_cereals",
grainsBakedGoodsLabel.getText().replace(" daily servings per person", ""));
}
if (!dairyLabel.getText().replace(" daily servings per person", "").equals("2.4")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_dairy",
dairyLabel.getText().replace(" daily servings per person", ""));
}
if (!fruitsVegetablesLabel.getText()
.replace(" daily servings per person", "").equals("3.9")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_fruitvegetables",
fruitsVegetablesLabel.getText().replace(" daily servings per person", ""));
}
if (!snacksDrinksLabel.getText().replace(" daily servings per person", "").equals("3.7")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_otherfood",
snacksDrinksLabel.getText().replace(" daily servings per person", ""));
}
if (!goodsLabel.getText().replace(" € / month", "").equals("1520")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_goods_total",
goodsLabel.getText().replace("€ / month", ""));
}
if (!servicesLabel.getText().replace(" € / month", "").equals("3428")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_services_total",
servicesLabel.getText().replace("€ / month", ""));
}
if (localProduceCheckbox.isSelected()) {
localProduceCheckbox.setSelected(true);
userService.updateExtraInput(userService.currentUser.getName(),
"local_produce", true);
}
if (bikeCheckbox.isSelected()) {
bikeCheckbox.setSelected(true);
userService.updateExtraInput(userService.currentUser.getName(),
"bike", true);
}
if (temperatureCheckbox.isSelected()) {
temperatureCheckbox.setSelected(true);
userService.updateExtraInput(userService.currentUser.getName(),
"temperature", true);
}
if (solarPanelsCheckbox.isSelected()) {
solarPanelsCheckbox.setSelected(true);
userService.updateExtraInput(userService.currentUser.getName(),
"solar_panels", true);
}
Float footprint = userService.saveFootprint(userService.currentUser.getName());
Window owner = saveButton.getScene().getWindow();
Stage current = (Stage) owner;
current.close();
controller.updateLeaderboard();
}
}

View File

@@ -418,10 +418,11 @@ public class DashBoardController {
extraStage.setScene(scene);
extraStage.setTitle("Add extra activity - " + userService.currentUser.getName());
extraStage.show();
}
/**
* method opens addFriend scene.
* method opend addFriend scene.
* @throws IOException when file is not found
*/
public void openAddFriend() throws IOException {
@@ -526,4 +527,5 @@ public class DashBoardController {
button.setOnMouseExited(e -> scaleDown.playFromStart());
}
}
}

View File

@@ -0,0 +1,138 @@
package greenify.client.controller;
import greenify.client.rest.UserService;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Slider;
import javafx.scene.layout.AnchorPane;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@Controller
public class ExtraActivityController {
@Autowired
UserService userService;
@FXML
private AnchorPane veganMealPane;
@FXML
private AnchorPane bikePane;
@FXML
private AnchorPane temperaturePane;
@FXML
private AnchorPane solarPanelPane;
@FXML
private Button displayVeganMealButton;
@FXML
private Button displayBikeButton;
@FXML
private Button displayTemperatureButton;
@FXML
private Button displaySolarPanelButton;
@FXML
private Button addVeganMealButton;
@FXML
private Button addBikeButton;
@FXML
private Button addTemperatureButton;
@FXML
private Button addSolarPanelsButton;
@FXML
private Slider bikeSlider;
@FXML
private Label bikeLabel;
@FXML
private Slider temperatureSlider;
@FXML
private Label temperatureLabel;
@FXML
private Slider solarPanelsSlider;
@FXML
private Label solarPanelsLabel;
/**
* initializes the sliders and labels before loading.
* sets the labels to display the outputs of the designated sliders.
*/
public void initialize() {
coupleSliderToLabel(bikeSlider, bikeLabel, " km", false);
coupleSliderToLabel(temperatureSlider, temperatureLabel, " Degrees", true);
coupleSliderToLabel(solarPanelsSlider, solarPanelsLabel, "", true);
}
/**
* Sets the label to display the value of the designated slider.
* sets the text to be displayed after the value of the slider.
* sets whether the slider should snap to ticks
* @param slider the slider to read the value from
* @param label the label to display the value of the slider
* @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,
boolean snapToTicks) {
slider.setSnapToTicks(snapToTicks);
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
label.setText(newValue.intValue() + string);
}
});
}
/**
* displays the vegetarian meal section.
* @param event the click of the designated button
*/
public void displayVeganMeal(ActionEvent event) {
// System.out.println("display vm");
veganMealPane.setVisible(true);
bikePane.setVisible(false);
temperaturePane.setVisible(false);
solarPanelPane.setVisible(false);
}
/**
* displays the bike section.
* @param event the click of the designated button
*/
public void displayBike(ActionEvent event) {
// System.out.println("display b");
veganMealPane.setVisible(false);
bikePane.setVisible(true);
temperaturePane.setVisible(false);
solarPanelPane.setVisible(false);
}
/**
* displays the temperature section.
* @param event the click of the designated button
*/
public void displayTemperature(ActionEvent event) {
// System.out.println("display t");
veganMealPane.setVisible(false);
bikePane.setVisible(false);
temperaturePane.setVisible(true);
solarPanelPane.setVisible(false);
}
/**
* displays the solar panels section.
* @param event the click of the designated button
*/
public void displaySolarPanel(ActionEvent event) {
// System.out.println("display sp");
veganMealPane.setVisible(false);
bikePane.setVisible(false);
temperaturePane.setVisible(false);
solarPanelPane.setVisible(true);
}
}

View File

@@ -0,0 +1,58 @@
package greenify.client.controller;
import greenify.client.rest.UserService;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import javafx.stage.Window;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@Controller
public class FriendController {
@Autowired
UserService userService;
@FXML
private Button addButton;
@FXML
private TextField userNameText;
/**
* Signs up the user.
* @param event the click of the sign up button
*/
@FXML
public void addFriend(ActionEvent event) throws InterruptedException {
//set the window to the current window (for displaying the alerts)
Window owner = addButton.getScene().getWindow();
//check if the username field is empty
if (userNameText.getText().isEmpty()) {
//if so, display an alert
UserController.AlertHelper.showAlert(Alert.AlertType.ERROR, owner, "Username Error!",
"Please enter a username!");
return;
} else if (userNameText.getText().equals(userService.currentUser.getName())) {
UserController.AlertHelper.showAlert(Alert.AlertType.ERROR, owner, "Error!",
"Cannot add yourself as a friend!");
return;
} else if (userService.getFriendNames(userService.currentUser.getName())
.contains(userNameText.getText())) {
UserController.AlertHelper.showAlert(Alert.AlertType.ERROR, owner, "Error!",
"Cannot add a friend twice!");
return;
} else if (!userService.getAllUsers().contains(userNameText.getText())) {
UserController.AlertHelper.showAlert(Alert.AlertType.ERROR, owner, "Error!",
"The user does not exist!");
return;
}
//add friend to the current user
userService.addFriend(userService.currentUser.getName(), userNameText.getText());
//close the register window after the user has entered all the credentials
Stage current = (Stage) owner;
current.close();
}
}

View File

@@ -1,20 +1,37 @@
package greenify.client.controller;
import greenify.client.Application;
import greenify.client.rest.UserService;
import javafx.animation.Interpolator;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.animation.TranslateTransition;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Slider;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Duration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.concurrent.TimeUnit;
/**
@@ -26,6 +43,123 @@ public class RegisterWindowController {
@Autowired
UserService userService;
@Autowired
DashBoardController controller;
//navigation panes
@FXML
private AnchorPane getStartedPane;
@FXML
private AnchorPane travelPane;
@FXML
private AnchorPane homePane;
@FXML
private ScrollPane foodPane;
@FXML
private AnchorPane shoppingPane;
//'get started' pane
@FXML
private Slider peopleInHouseholdSlider;
@FXML
private Label peopleInHouseHoldLabel;
@FXML
private Slider annualIncomeSlider;
@FXML
private Label annualIncomeLabel;
@FXML
private Button saveButton;
//travel pane
@FXML
private TextField publicTransitField;
@FXML
private TextField airplaneTravelField;
@FXML
private TextField carTravelGasolineField;
@FXML
private Slider carTravelGasolineSlider;
@FXML
private Label carTravelGasolineLabel;
@FXML
private TextField carTravelDieselField;
@FXML
private Slider carTravelDieselSlider;
@FXML
private Label carTravelDieselLabel;
@FXML
private TextField carTravelElectricField;
@FXML
private Slider carTravelElectricSlider;
@FXML
private Label carTravelElectricLabel;
//home pane
@FXML
private TextField electricityField;
@FXML
private Slider cleanEnergyPurchasedSlider;
@FXML
private Label cleanEnergyPurchasedLabel;
@FXML
private TextField naturalGasField;
@FXML
private TextField heatingOilField;
@FXML
private TextField livingSpaceField;
@FXML
private Slider waterUsageSlider;
@FXML
private Label waterUsageLabel;
//food pane
@FXML
private Slider meatFishEggsSlider;
@FXML
private Label meatFishEggsLabel;
@FXML
private Slider grainsBakedGoodsSlider;
@FXML
private Label grainsBakedGoodsLabel;
@FXML
private Slider dairySlider;
@FXML
private Label dairyLabel;
@FXML
private Slider fruitsVegetablesSlider;
@FXML
private Label fruitsVegetablesLabel;
@FXML
private Slider snacksDrinksSlider;
@FXML
private Label snacksDrinksLabel;
//shopping pane
@FXML
private Text goodsField;
@FXML
private Text servicesField;
@FXML
private Slider goodsSlider;
@FXML
private Label goodsLabel;
@FXML
private Slider servicesSlider;
@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;
@FXML
private TextField userNameText;
@FXML
@@ -42,14 +176,10 @@ public class RegisterWindowController {
* @throws InterruptedException exception when interrupted
*/
public void initialize() throws InterruptedException {
// PathTransition pathTransUName = new PathTransition(Duration.millis(1100),
// uNamePathLine, userNameText);
// pathTransUName.play();
addSlideAnimation(1100, userNameText, -300);
addSlideAnimation(1100, passwordField, 300);
TimeUnit.MILLISECONDS.sleep(300);
addSlideAnimation(1100, passwordField2, -420);
}
/**
@@ -70,7 +200,7 @@ public class RegisterWindowController {
* @param event the click of the sign up button
*/
@FXML
public void handleSignUpButton(ActionEvent event) {
public void handleSignUpButton(ActionEvent event) throws IOException {
//set the window to the current window (for displaying the alerts)
Window owner = signUpButton.getScene().getWindow();
//check if the username field is empty
@@ -99,9 +229,353 @@ public class RegisterWindowController {
//register the user with the provided username and password
userService.registerUser(userNameText.getText(), passwordField.getText());
//close the register window after the user has entered all the credentials
Stage current = (Stage) owner;
current.close();
Parent calc = Application.load(this.getClass().getClassLoader()
.getResource("fxml/FirstCalculator.fxml"));
Scene scene = new Scene(calc);
scene.getStylesheets().add(getClass().getClassLoader()
.getResource("stylesheets/calculatorStyle.css").toExternalForm());
Stage calcStage = new Stage();
calcStage.setScene(scene);
calcStage.setTitle("Calculate CO2 footprint - " + userService.currentUser.getName());
calcStage.show();
peopleInHouseholdSlider.setSnapToTicks(true);
//add listener to slider for amount of people in household
peopleInHouseholdSlider.valueProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
peopleInHouseHoldLabel.setText("" + newValue.intValue());
}
});
//add listener to slider for annual income
annualIncomeSlider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
annualIncomeLabel.setText("" + (newValue.intValue() * 1000));
}
});
addSliderListenerCarUsage(carTravelGasolineSlider, carTravelGasolineLabel, " mpg");
addSliderListenerCarUsage(carTravelDieselSlider, carTravelDieselLabel, " mpg");
addSliderListenerCarUsage(carTravelElectricSlider, carTravelElectricLabel, " mpge");
cleanEnergyPurchasedSlider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
cleanEnergyPurchasedLabel.setText(newValue.intValue() + " %");
}
});
waterUsageSlider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
waterUsageLabel.setText(newValue.intValue() + "% of similar households");
}
});
addSliderListenerDailyServing(meatFishEggsSlider, meatFishEggsLabel);
addSliderListenerDailyServing(grainsBakedGoodsSlider, grainsBakedGoodsLabel);
addSliderListenerDailyServing(dairySlider, dairyLabel);
addSliderListenerDailyServing(fruitsVegetablesSlider, fruitsVegetablesLabel);
addSliderListenerDailyServing(snacksDrinksSlider, snacksDrinksLabel);
addSliderListenerGoodsServices(goodsSlider, goodsLabel);
addSliderListenerGoodsServices(servicesSlider, servicesLabel);
}
/**
* adds the listener to the given slider and displays it's output on a given label.
* @param slider the slider to attach the listener to.
* @param label the label to display the slider output on.
*/
private void addSliderListenerCarUsage(Slider slider, Label label, String unit) {
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
label.setText(newValue.intValue() + unit);
}
});
}
private void addSliderListenerDailyServing(Slider slider, Label label) {
DecimalFormat df = new DecimalFormat("0.0");
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
label.setText(df.format(newValue.doubleValue()) + " daily servings per person");
}
});
}
private void addSliderListenerGoodsServices(Slider slider, Label label) {
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
label.setText(newValue.intValue() + "€ / month");
}
});
}
private void addSlideInAnimation(Node node) {
Timeline timeline = new Timeline();
KeyValue keyValue = new KeyValue(node.translateXProperty(), 0, Interpolator.EASE_OUT);
KeyFrame keyFrame = new KeyFrame(Duration.millis(600), keyValue);
timeline.getKeyFrames().add(keyFrame);
timeline.play();
}
/**
* displays the 'get started' section of the calculator.
* 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);
}
/**
* displays the 'travel' section of the calculator.
* 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);
travelPane.setVisible(true);
homePane.setVisible(false);
foodPane.setVisible(false);
shoppingPane.setVisible(false);
extraPane.setVisible(false);
}
/**
* displays the 'home' section of the calculator.
* 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);
}
/**
* displays the 'food' section of the calculator.
* 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);
}
/**
* displays the 'shopping' section of the calculator.
* 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);
homePane.setVisible(false);
foodPane.setVisible(false);
shoppingPane.setVisible(false);
if (!annualIncomeLabel.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(), "input_income",
annualIncomeLabel.getText());
}
if (!peopleInHouseHoldLabel.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(), "input_size",
peopleInHouseHoldLabel.getText());
}
if (!publicTransitField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_publictrans",
publicTransitField.getText());
}
if (!airplaneTravelField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_airtotal",
airplaneTravelField.getText());
}
if (!carTravelGasolineField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_miles1",
carTravelGasolineField.getText());
}
if (!carTravelGasolineLabel.getText().replace(" mpg", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_mpg1",
carTravelGasolineLabel.getText().replace(" mpg", ""));
}
if (!carTravelDieselField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_miles2",
carTravelDieselField.getText());
}
if (!carTravelDieselLabel.getText().replace(" mpg", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_mpg2",
carTravelDieselLabel.getText().replace(" mpg", ""));
}
if (!carTravelElectricField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_miles3",
carTravelElectricField.getText());
}
if (!carTravelElectricLabel.getText().replace(" mpge", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_transportation_mpg3",
carTravelElectricLabel.getText().replace(" mpge", ""));
}
if (!electricityField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_electricity_dollars",
electricityField.getText());
}
if (!cleanEnergyPurchasedLabel.getText().replace(" %", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_gco2_per_kwh",
cleanEnergyPurchasedLabel.getText().replace(" %", ""));
}
if (!naturalGasField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_naturalgas_dollars",
naturalGasField.getText());
}
if (!heatingOilField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_heatingoil_dollars",
heatingOilField.getText());
}
if (!livingSpaceField.getText().equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_squarefeet",
livingSpaceField.getText());
}
if (!waterUsageLabel.getText().replace("% of similar households", "").equals("0")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_housing_watersewage",
waterUsageLabel.getText().replace("% of similar households", ""));
}
if (!meatFishEggsLabel.getText().replace(" daily servings per person", "").equals("2.6")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_meatfisheggs",
meatFishEggsLabel.getText().replace(" daily servings per person", ""));
}
if (!grainsBakedGoodsLabel.getText()
.replace(" daily servings per person", "").equals("4.4")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_cereals",
grainsBakedGoodsLabel.getText().replace(" daily servings per person", ""));
}
if (!dairyLabel.getText().replace(" daily servings per person", "").equals("2.4")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_dairy",
dairyLabel.getText().replace(" daily servings per person", ""));
}
if (!fruitsVegetablesLabel.getText()
.replace(" daily servings per person", "").equals("3.9")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_fruitvegetables",
fruitsVegetablesLabel.getText().replace(" daily servings per person", ""));
}
if (!snacksDrinksLabel.getText().replace(" daily servings per person", "").equals("3.7")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_food_otherfood",
snacksDrinksLabel.getText().replace(" daily servings per person", ""));
}
if (!goodsLabel.getText().replace(" € / month", "").equals("1520")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_goods_total",
goodsLabel.getText().replace("€ / month", ""));
}
if (!servicesLabel.getText().replace(" € / month", "").equals("3428")) {
userService.updateInput(userService.currentUser.getName(),
"input_footprint_shopping_services_total",
servicesLabel.getText().replace("€ / month", ""));
}
if (localProduceCheckbox.isSelected()) {
userService.updateExtraInput(userService.currentUser.getName(),
"local_produce", true);
}
if (bikeCheckbox.isSelected()) {
userService.updateExtraInput(userService.currentUser.getName(),
"bike", true);
}
if (temperatureCheckbox.isSelected()) {
userService.updateExtraInput(userService.currentUser.getName(),
"temperature", true);
}
if (solarPanelsCheckbox.isSelected()) {
userService.updateExtraInput(userService.currentUser.getName(),
"solar_panels", true);
}
Float firstFootprint = userService.saveFirstFootprint(userService.currentUser.getName());
Float footprint = userService.saveFootprint(userService.currentUser.getName());
Window owner = saveButton.getScene().getWindow();
Stage current = (Stage) owner;
current.close();
}
}

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane prefHeight="287.0" prefWidth="187.0" style="-fx-background-color: #e2f0c8;" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.FriendController">
<children>
<Text fill="#00650d" layoutX="114.0" layoutY="64.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Add Friend" textAlignment="CENTER" wrappingWidth="234.96600341796875">
<font>
<Font size="36.0" />
</font>
</Text>
<TextField fx:id="userNameText" layoutX="140.0" layoutY="100.0" prefHeight="35.0" prefWidth="183.0" promptText="Username">
<font>
<Font size="13.0" />
</font>
</TextField>
<Button fx:id="addButton" layoutX="206.0" layoutY="154.0" mnemonicParsing="false" onAction="#addFriend" style="-fx-background-color: #005e07;" text="Add!" textFill="#c4eec9">
<font>
<Font name="Corbel Bold" size="14.0" />
</font>
</Button>
<ImageView fitHeight="80.0" fitWidth="349.0" layoutY="211.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/grass.png"/>
</image>
</ImageView>
<ImageView fitHeight="150.0" fitWidth="200.0" layoutY="43.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/friends.png" />
</image>
</ImageView>
</children>
</AnchorPane>

View File

@@ -0,0 +1,632 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.shape.*?>
<?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?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Slider?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane prefHeight="703.0" prefWidth="820.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.RegisterWindowController">
<children>
<AnchorPane fx:id="calculatorTabs" prefHeight="92.0" prefWidth="820.0" style="-fx-background-color: #677069;">
<children>
<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>
<graphic>
<ImageView fitHeight="60.0" fitWidth="52.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/cloud.png" />
<!--image credits:-->
<!--image made by Smashicons https://www.flaticon.com/authors/smashicons-->
<!--from https://www.flaticon.com/
flaticon is licenced by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0-->
</image>
</ImageView>
</graphic>
</Button>
<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>
<graphic>
<ImageView fitHeight="60.0" fitWidth="52.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/world.png" />
<!--image credits:
made by prettycons https://www.flaticon.com/authors/prettycons
from https://www.flaticon.com/
flaticon is licenced by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0
-->
</image>
</ImageView>
</graphic>
</Button>
<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>
<graphic>
<ImageView fitHeight="60.0" fitWidth="52.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/home.png" />
<!--image credits:
made by Smashicons https://www.flaticon.com/authors/smashicons
from https://www.flaticon.com/
flaticon is licenced by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0
-->
</image>
</ImageView>
</graphic>
</Button>
<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>
<graphic>
<ImageView fitHeight="60.0" fitWidth="52.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/coffee-cup.png" />
<!--image credits:
made by pixel-perfect https://www.flaticon.com/authors/pixel-perfect
from https://www.flaticon.com/
flaticon is licenced by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0
-->
</image>
</ImageView>
</graphic>
</Button>
<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>
<graphic>
<ImageView fitHeight="60.0" fitWidth="52.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/shopping-cart.png" />
<!--image credits:
made by Gregor Cresnar https://www.flaticon.com/authors/gregor-cresnar
from https://www.flaticon.com/
flaticon is licenced by http://creativecommons.org/licenses/by/3.0/ Creative Commons BY 3.0
-->
</image>
</ImageView>
</graphic>
</Button>
<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">
<children>
<Text layoutX="224.0" layoutY="96.0" strokeType="OUTSIDE" strokeWidth="0.0" text="1. How many people live in your household?">
<font>
<Font size="19.0" />
</font>
</Text>
<Slider fx:id="peopleInHouseholdSlider" blockIncrement="1.0" layoutX="260.0" layoutY="147.0" majorTickUnit="1.0" max="6.0" min="1.0" minorTickCount="0" prefHeight="38.0" prefWidth="300.0" showTickLabels="true" showTickMarks="true" snapToTicks="true" styleClass="slidertje" />
<Label fx:id="peopleInHouseHoldLabel" alignment="CENTER" contentDisplay="CENTER" layoutX="612.0" layoutY="70.0" prefHeight="38.0" prefWidth="44.0" text="0">
<font>
<Font size="20.0" />
</font></Label>
<Text layoutX="207.0" layoutY="254.0" strokeType="OUTSIDE" strokeWidth="0.0" text="2. What is your gross annual household income?">
<font>
<Font size="19.0" />
</font>
</Text>
<Slider fx:id="annualIncomeSlider" layoutX="224.0" layoutY="302.0" majorTickUnit="10.0" minorTickCount="0" prefHeight="38.0" prefWidth="388.0" showTickLabels="true" showTickMarks="true" />
<Text fill="#757575" layoutX="373.0" layoutY="277.0" strokeType="OUTSIDE" strokeWidth="0.0" text="in 1000 euros">
<font>
<Font size="15.0" />
</font>
</Text>
<Label fx:id="annualIncomeLabel" layoutX="634.0" layoutY="232.0" prefHeight="30.0" prefWidth="150.0" text="0">
<font>
<Font size="20.0" />
</font>
<opaqueInsets>
<Insets />
</opaqueInsets>
</Label>
<Button fx:id="getStartedNextButton" layoutX="383.0" layoutY="406.0" mnemonicParsing="false" onAction="#displayTravel" styleClass="nextButton" text="Next" />
<Line endX="79.0" layoutX="147.0" layoutY="14.0" stroke="#545b54" />
</children></AnchorPane>
<AnchorPane fx:id="travelPane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" visible="false">
<children>
<ScrollPane layoutX="158.0" layoutY="109.0" prefHeight="215.0" prefWidth="499.0">
<content>
<AnchorPane prefHeight="505.0" prefWidth="497.0">
<children>
<Text fill="#505050" layoutX="14.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Gasoline">
<font>
<Font size="16.0" />
</font>
</Text>
<TextField fx:id="carTravelGasolineField" layoutX="14.0" layoutY="38.0" prefHeight="31.0" prefWidth="405.0" promptText="16.400" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="419.0" layoutY="38.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="mi/year" wrappingWidth="49.0">
<font>
<Font size="13.0" />
</font>
</Text>
</children>
</HBox>
<Slider fx:id="carTravelGasolineSlider" layoutX="14.0" layoutY="122.0" majorTickUnit="15.0" max="115.0" min="10.0" minorTickCount="0" prefHeight="14.0" prefWidth="453.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="204.0" layoutY="77.0" prefHeight="31.0" prefWidth="89.0" styleClass="km-indicator">
<children>
<Label fx:id="carTravelGasolineLabel" alignment="TOP_CENTER" contentDisplay="CENTER" text="0 mpg">
<font>
<Font size="13.0" />
</font>
</Label>
</children>
</HBox>
<HBox alignment="CENTER" layoutX="204.0" layoutY="239.0" prefHeight="31.0" prefWidth="89.0" styleClass="km-indicator">
<children>
<Label fx:id="carTravelDieselLabel" alignment="TOP_CENTER" contentDisplay="CENTER" text="0 mpg">
<font>
<Font size="13.0" />
</font>
</Label>
</children>
</HBox>
<Slider fx:id="carTravelDieselSlider" layoutX="14.0" layoutY="285.0" majorTickUnit="15.0" max="115.0" min="10.0" minorTickCount="0" prefHeight="14.0" prefWidth="453.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER_LEFT" layoutX="419.0" layoutY="200.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="mi/year" wrappingWidth="49.0">
<font>
<Font size="13.0" />
</font>
</Text>
</children>
</HBox>
<TextField fx:id="carTravelDieselField" layoutX="14.0" layoutY="200.0" prefHeight="31.0" prefWidth="405.0" promptText="15.400" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<Text fill="#505050" layoutX="14.0" layoutY="189.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Diesel">
<font>
<Font size="16.0" />
</font>
</Text>
<Text fill="#505050" layoutX="14.0" layoutY="354.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Electric">
<font>
<Font size="16.0" />
</font>
</Text>
<TextField fx:id="carTravelElectricField" layoutX="14.0" layoutY="365.0" prefHeight="31.0" prefWidth="405.0" promptText="14.900" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="419.0" layoutY="365.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="mi/year" wrappingWidth="49.0">
<font>
<Font size="13.0" />
</font>
</Text>
</children>
</HBox>
<Slider fx:id="carTravelElectricSlider" layoutX="14.0" layoutY="450.0" majorTickUnit="15.0" max="115.0" min="10.0" minorTickCount="0" prefHeight="14.0" prefWidth="453.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="204.0" layoutY="404.0" prefHeight="31.0" prefWidth="89.0" styleClass="km-indicator">
<children>
<Label fx:id="carTravelElectricLabel" alignment="TOP_CENTER" contentDisplay="CENTER" text="0 mpge">
<font>
<Font size="13.0" />
</font>
</Label>
</children>
</HBox>
</children>
</AnchorPane>
</content></ScrollPane>
<Text layoutX="300.0" layoutY="36.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How do you get around?">
<font>
<Font size="20.0" />
</font></Text>
<Text fill="#727272" layoutX="370.0" layoutY="103.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Car travel">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="355.0" layoutY="374.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Public Transit">
<font>
<Font size="18.0" />
</font>
</Text>
<TextField fx:id="publicTransitField" alignment="CENTER_RIGHT" layoutX="158.0" layoutY="394.0" prefHeight="31.0" prefWidth="499.0" promptText="0" text="0">
<font>
<Font size="18.0" />
</font></TextField>
<Text fill="#727272" layoutX="350.0" layoutY="476.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Airplane travel">
<font>
<Font size="18.0" />
</font>
</Text>
<TextField fx:id="airplaneTravelField" alignment="CENTER_RIGHT" layoutX="158.0" layoutY="495.0" prefHeight="31.0" prefWidth="499.0" promptText="0" text="0">
<font>
<Font size="18.0" />
</font></TextField>
<HBox alignment="CENTER_LEFT" layoutX="659.0" layoutY="398.0" prefHeight="31.0" prefWidth="62.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="mi/year" wrappingWidth="63.0">
<font>
<Font size="16.0" />
</font>
</Text>
</children>
</HBox>
<HBox alignment="CENTER_LEFT" layoutX="659.0" layoutY="499.0" prefHeight="31.0" prefWidth="62.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="mi/year" wrappingWidth="63.0">
<font>
<Font size="16.0" />
</font>
</Text>
</children>
</HBox>
<Button fx:id="travelNextButton" layoutX="383.0" layoutY="559.0" mnemonicParsing="false" onAction="#displayHome" styleClass="nextButton" text="Next" />
<Line endX="79.0" layoutX="232.0" layoutY="14.0" stroke="#545b54" />
</children>
</AnchorPane>
<AnchorPane fx:id="homePane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" visible="false">
<children>
<Text layoutX="245.0" layoutY="36.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How much do you use in your home?">
<font>
<Font size="20.0" />
</font>
</Text>
<Text fill="#727272" layoutX="177.0" layoutY="85.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Electricity">
<font>
<Font size="18.0" />
</font>
</Text>
<TextField fx:id="electricityField" layoutX="177.0" layoutY="105.0" prefHeight="31.0" prefWidth="434.0" promptText="1,570" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="616.0" layoutY="105.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="€/year" wrappingWidth="41.0">
<font>
<Font size="13.0" />
</font>
<HBox.margin>
<Insets left="3.0" />
</HBox.margin>
</Text>
</children>
</HBox>
<Slider fx:id="waterUsageSlider" blockIncrement="100.0" layoutX="177.0" layoutY="509.0" majorTickUnit="100.0" max="300.0" minorTickCount="0" prefHeight="24.0" prefWidth="499.0" showTickLabels="true" showTickMarks="true" />
<Slider fx:id="cleanEnergyPurchasedSlider" blockIncrement="25.0" layoutX="177.0" layoutY="188.0" minorTickCount="0" prefHeight="24.0" prefWidth="499.0" showTickLabels="true" showTickMarks="true" />
<Text fill="#6f6f6f" layoutX="238.0" layoutY="165.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Percent purchased from clean energy program:">
<font>
<Font size="15.0" />
</font>
</Text>
<HBox alignment="CENTER" layoutX="553.0" layoutY="146.0" prefHeight="27.0" prefWidth="55.0" styleClass="km-indicator">
<children>
<Label fx:id="cleanEnergyPurchasedLabel" text="0 %">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Button layoutX="400.0" layoutY="547.0" mnemonicParsing="false" onAction="#displayFood" styleClass="nextButton" text="Next" />
<Text fill="#727272" layoutX="177.0" layoutY="255.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Natural gas">
<font>
<Font size="18.0" />
</font>
</Text>
<HBox alignment="CENTER_LEFT" layoutX="616.0" layoutY="262.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="€/year" wrappingWidth="41.0">
<font>
<Font size="13.0" />
</font>
<HBox.margin>
<Insets left="3.0" />
</HBox.margin>
</Text>
</children>
</HBox>
<TextField fx:id="naturalGasField" layoutX="177.0" layoutY="262.0" prefHeight="31.0" prefWidth="434.0" promptText="2,000" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="616.0" layoutY="325.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="€/year" wrappingWidth="41.0">
<font>
<Font size="13.0" />
</font>
<HBox.margin>
<Insets left="3.0" />
</HBox.margin>
</Text>
</children>
</HBox>
<TextField fx:id="heatingOilField" layoutX="177.0" layoutY="325.0" prefHeight="31.0" prefWidth="434.0" promptText="3,100" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<Text fill="#727272" layoutX="177.0" layoutY="316.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Heating oil &amp; other fuels">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="177.0" layoutY="383.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Living space area">
<font>
<Font size="18.0" />
</font>
</Text>
<TextField fx:id="livingSpaceField" layoutX="177.0" layoutY="390.0" prefHeight="31.0" prefWidth="434.0" promptText="1,570" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="616.0" layoutY="390.0" prefHeight="31.0" prefWidth="0.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="m²" textAlignment="CENTER" wrappingWidth="41.0">
<font>
<Font size="19.0" />
</font>
<HBox.margin>
<Insets left="3.0" />
</HBox.margin>
</Text>
</children>
</HBox>
<Text fill="#727272" layoutX="177.0" layoutY="454.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Water usage">
<font>
<Font size="18.0" />
</font>
</Text>
<HBox alignment="CENTER" layoutX="298.0" layoutY="459.0" prefHeight="27.0" prefWidth="258.0" styleClass="km-indicator">
<children>
<Label fx:id="waterUsageLabel" text="0% of similar households">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Line endX="79.0" layoutX="317.0" layoutY="14.0" stroke="#545b54" />
</children></AnchorPane>
<ScrollPane fx:id="foodPane" layoutY="92.0" prefHeight="611.0" prefWidth="820.0" visible="false">
<content>
<AnchorPane prefHeight="1000.0" prefWidth="817.0">
<children>
<Text layoutX="146.0" layoutY="36.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How much does the average person in your household eat?">
<font>
<Font size="20.0" />
</font>
</Text>
<Text fill="#727272" layoutX="146.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Meat, fish, eggs">
<font>
<Font size="18.0" />
</font>
</Text>
<Slider fx:id="meatFishEggsSlider" blockIncrement="2.5" layoutX="146.0" layoutY="205.0" majorTickUnit="2.5" max="7.5" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="299.0" layoutY="149.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="meatFishEggsLabel" text="2.6 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Text fill="#727272" layoutX="519.0" layoutY="115.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 2,6">
<font>
<Font size="15.0" />
</font>
</Text>
<Text fill="#727272" layoutX="519.0" layoutY="276.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 4,4">
<font>
<Font size="15.0" />
</font>
</Text>
<HBox alignment="CENTER" layoutX="299.0" layoutY="310.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="grainsBakedGoodsLabel" text="4.4 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Slider fx:id="grainsBakedGoodsSlider" blockIncrement="4.5" layoutX="146.0" layoutY="366.0" majorTickUnit="4.5" max="13.5" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<Text fill="#727272" layoutX="146.0" layoutY="278.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Grains &amp; baked goods">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="146.0" layoutY="439.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Dairy">
<font>
<Font size="18.0" />
</font>
</Text>
<Slider fx:id="dairySlider" blockIncrement="2.5" layoutX="146.0" layoutY="527.0" majorTickUnit="2.5" max="7.5" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="299.0" layoutY="471.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="dairyLabel" text="2.4 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Text fill="#727272" layoutX="519.0" layoutY="437.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 2,4">
<font>
<Font size="15.0" />
</font>
</Text>
<Text fill="#727272" layoutX="524.0" layoutY="776.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 3,7">
<font>
<Font size="15.0" />
</font>
</Text>
<HBox alignment="CENTER" layoutX="304.0" layoutY="810.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="snacksDrinksLabel" text="3.7 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Slider fx:id="snacksDrinksSlider" blockIncrement="3.7" layoutX="151.0" layoutY="866.0" majorTickUnit="3.7" max="11.0" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<Text fill="#727272" layoutX="151.0" layoutY="778.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Snacks, drinks etc.">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="151.0" layoutY="617.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Fruits &amp; vegetables">
<font>
<Font size="18.0" />
</font>
</Text>
<Slider fx:id="fruitsVegetablesSlider" blockIncrement="3.9" layoutX="151.0" layoutY="705.0" majorTickUnit="3.9" max="11.6" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="304.0" layoutY="649.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="fruitsVegetablesLabel" text="3.9 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Text fill="#727272" layoutX="524.0" layoutY="615.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 3,9">
<font>
<Font size="15.0" />
</font>
</Text>
<Button layoutX="378.0" layoutY="926.0" mnemonicParsing="false" onAction="#displayShopping" styleClass="nextButton" text="Next" />
<Line endX="79.0" layoutX="402.0" layoutY="7.0" stroke="#545b54" />
</children>
</AnchorPane>
</content>
</ScrollPane>
<AnchorPane fx:id="shoppingPane" layoutY="92.0" prefHeight="611.0" prefWidth="820.0" visible="false">
<children>
<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>
</Text>
<Text fill="#727272" layoutX="133.0" layoutY="119.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Goods">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="133.0" layoutY="310.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Services">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="518.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 1.520 € / month">
<font>
<Font size="15.0" />
</font>
</Text>
<Text fill="#727272" layoutX="518.0" layoutY="309.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 3.428 € / month">
<font>
<Font size="15.0" />
</font>
</Text>
<Slider fx:id="goodsSlider" blockIncrement="1520.0" layoutX="133.0" layoutY="209.0" majorTickUnit="1520.0" max="4560.0" minorTickCount="0" prefHeight="24.0" prefWidth="554.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="335.0" layoutY="145.0" prefHeight="31.0" prefWidth="150.0" styleClass="km-indicator">
<children>
<Label fx:id="goodsLabel" text="1520 € / month">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<HBox alignment="CENTER" layoutX="335.0" layoutY="348.0" prefHeight="31.0" prefWidth="150.0" styleClass="km-indicator">
<children>
<Label fx:id="servicesLabel" text="3428 € / month">
<font>
<Font size="15.0" />
</font>
</Label>
</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" />
<Line endX="79.0" layoutX="487.0" layoutY="7.0" stroke="#545b54" />
</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>
<Line endX="79.0" layoutX="572.0" layoutY="7.0" stroke="#545b54" />
</children>
</AnchorPane>
</children>
</AnchorPane>

View File

@@ -1,16 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.shape.*?>
<?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?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Slider?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane prefHeight="703.0" prefWidth="820.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.CalculatorController">
<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>
@@ -26,7 +40,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>
@@ -43,7 +57,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>
@@ -60,7 +74,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>
@@ -77,7 +91,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>
@@ -94,20 +108,32 @@
</ImageView>
</graphic>
</Button>
<Button fx:id="saveButton" layoutX="702.0" layoutY="24.0" onAction="#saveCalculation" 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" visible="false" AnchorPane.leftAnchor="0.0">
<AnchorPane fx:id="getStartedPane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" AnchorPane.leftAnchor="0.0">
<children>
<Text layoutX="224.0" layoutY="96.0" strokeType="OUTSIDE" strokeWidth="0.0" text="1. How many people live in your household?">
<font>
<Font size="19.0" />
</font>
</Text>
<Slider fx:id="peopleInHouseholdSlider" blockIncrement="1.0" layoutX="260.0" layoutY="147.0" majorTickUnit="1.0" max="6.0" min="1.0" minorTickCount="0" prefHeight="38.0" prefWidth="300.0" showTickLabels="true" showTickMarks="true" snapToTicks="true" />
<Slider fx:id="peopleInHouseholdSlider" blockIncrement="1.0" layoutX="260.0" layoutY="147.0" majorTickUnit="1.0" max="6.0" min="1.0" minorTickCount="0" prefHeight="38.0" prefWidth="300.0" showTickLabels="true" showTickMarks="true" snapToTicks="true" styleClass="slidertje" />
<Label fx:id="peopleInHouseHoldLabel" alignment="CENTER" contentDisplay="CENTER" layoutX="612.0" layoutY="70.0" prefHeight="38.0" prefWidth="44.0" text="0">
<font>
<Font size="20.0" />
@@ -132,12 +158,103 @@
</opaqueInsets>
</Label>
<Button fx:id="getStartedNextButton" layoutX="383.0" layoutY="406.0" mnemonicParsing="false" onAction="#displayTravel" styleClass="nextButton" text="Next" />
<Line endX="79.0" layoutX="147.0" layoutY="14.0" stroke="#545b54" />
</children></AnchorPane>
<AnchorPane fx:id="travelPane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0">
<AnchorPane fx:id="travelPane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" visible="false">
<children>
<ScrollPane layoutX="158.0" layoutY="109.0" prefHeight="215.0" prefWidth="499.0">
<content>
<TextField prefHeight="33.0" prefWidth="497.0" />
<AnchorPane prefHeight="505.0" prefWidth="497.0">
<children>
<Text fill="#505050" layoutX="14.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Gasoline">
<font>
<Font size="16.0" />
</font>
</Text>
<TextField fx:id="carTravelGasolineField" layoutX="14.0" layoutY="38.0" prefHeight="31.0" prefWidth="405.0" promptText="16.400" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="419.0" layoutY="38.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="km/year" wrappingWidth="49.0">
<font>
<Font size="13.0" />
</font>
</Text>
</children>
</HBox>
<Slider fx:id="carTravelGasolineSlider" layoutX="14.0" layoutY="122.0" majorTickUnit="15.0" max="115.0" min="10.0" minorTickCount="0" prefHeight="14.0" prefWidth="453.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="204.0" layoutY="77.0" prefHeight="31.0" prefWidth="89.0" styleClass="km-indicator">
<children>
<Label fx:id="carTravelGasolineLabel" alignment="TOP_CENTER" contentDisplay="CENTER" text="0 km/L">
<font>
<Font size="13.0" />
</font>
</Label>
</children>
</HBox>
<HBox alignment="CENTER" layoutX="204.0" layoutY="239.0" prefHeight="31.0" prefWidth="89.0" styleClass="km-indicator">
<children>
<Label fx:id="carTravelDieselLabel" alignment="TOP_CENTER" contentDisplay="CENTER" text="0 km/L">
<font>
<Font size="13.0" />
</font>
</Label>
</children>
</HBox>
<Slider fx:id="carTravelDieselSlider" layoutX="14.0" layoutY="285.0" majorTickUnit="15.0" max="115.0" min="10.0" minorTickCount="0" prefHeight="14.0" prefWidth="453.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER_LEFT" layoutX="419.0" layoutY="200.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="km/year" wrappingWidth="49.0">
<font>
<Font size="13.0" />
</font>
</Text>
</children>
</HBox>
<TextField fx:id="carTravelDieselField" layoutX="14.0" layoutY="200.0" prefHeight="31.0" prefWidth="405.0" promptText="15.400" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<Text fill="#505050" layoutX="14.0" layoutY="189.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Diesel">
<font>
<Font size="16.0" />
</font>
</Text>
<Text fill="#505050" layoutX="14.0" layoutY="354.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Electric">
<font>
<Font size="16.0" />
</font>
</Text>
<TextField fx:id="carTravelElectricField" layoutX="14.0" layoutY="365.0" prefHeight="31.0" prefWidth="405.0" promptText="14.900" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="419.0" layoutY="365.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="km/year" wrappingWidth="49.0">
<font>
<Font size="13.0" />
</font>
</Text>
</children>
</HBox>
<Slider fx:id="carTravelElectricSlider" layoutX="14.0" layoutY="450.0" majorTickUnit="15.0" max="115.0" min="10.0" minorTickCount="0" prefHeight="14.0" prefWidth="453.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="204.0" layoutY="404.0" prefHeight="31.0" prefWidth="89.0" styleClass="km-indicator">
<children>
<Label fx:id="carTravelElectricLabel" alignment="TOP_CENTER" contentDisplay="CENTER" text="0 km/Le">
<font>
<Font size="13.0" />
</font>
</Label>
</children>
</HBox>
</children>
</AnchorPane>
</content></ScrollPane>
<Text layoutX="300.0" layoutY="36.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How do you get around?">
<font>
@@ -153,14 +270,20 @@
<Font size="18.0" />
</font>
</Text>
<TextField fx:id="publicTransitField" alignment="CENTER_RIGHT" layoutX="158.0" layoutY="394.0" prefHeight="31.0" prefWidth="499.0" promptText="0" />
<TextField fx:id="publicTransitField" alignment="CENTER_RIGHT" layoutX="158.0" layoutY="394.0" prefHeight="31.0" prefWidth="499.0" promptText="0" text="0">
<font>
<Font size="18.0" />
</font></TextField>
<Text fill="#727272" layoutX="350.0" layoutY="476.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Airplane travel">
<font>
<Font size="18.0" />
</font>
</Text>
<TextField fx:id="airplaneTravelField" alignment="CENTER_RIGHT" layoutX="158.0" layoutY="495.0" prefHeight="31.0" prefWidth="499.0" promptText="0" />
<HBox alignment="CENTER_LEFT" layoutX="659.0" layoutY="394.0" prefHeight="31.0" prefWidth="62.0" styleClass="km-yearBox">
<TextField fx:id="airplaneTravelField" alignment="CENTER_RIGHT" layoutX="158.0" layoutY="495.0" prefHeight="31.0" prefWidth="499.0" promptText="0" text="0">
<font>
<Font size="18.0" />
</font></TextField>
<HBox alignment="CENTER_LEFT" layoutX="659.0" layoutY="398.0" prefHeight="31.0" prefWidth="62.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="km/year" wrappingWidth="63.0">
<font>
@@ -169,7 +292,7 @@
</Text>
</children>
</HBox>
<HBox alignment="CENTER_LEFT" layoutX="659.0" layoutY="495.0" prefHeight="31.0" prefWidth="62.0" styleClass="km-yearBox">
<HBox alignment="CENTER_LEFT" layoutX="659.0" layoutY="499.0" prefHeight="31.0" prefWidth="62.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="km/year" wrappingWidth="63.0">
<font>
@@ -179,11 +302,331 @@
</children>
</HBox>
<Button fx:id="travelNextButton" layoutX="383.0" layoutY="559.0" mnemonicParsing="false" onAction="#displayHome" styleClass="nextButton" text="Next" />
<Line endX="79.0" layoutX="232.0" layoutY="14.0" stroke="#545b54" />
</children>
</AnchorPane>
<AnchorPane fx:id="homePane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" visible="false">
<children>
<Text layoutX="245.0" layoutY="36.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How much do you use in your home?">
<font>
<Font size="20.0" />
</font>
</Text>
<Text fill="#727272" layoutX="177.0" layoutY="85.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Electricity">
<font>
<Font size="18.0" />
</font>
</Text>
<TextField fx:id="electricityField" layoutX="177.0" layoutY="105.0" prefHeight="31.0" prefWidth="434.0" promptText="1,570" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="616.0" layoutY="105.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="€/year" wrappingWidth="41.0">
<font>
<Font size="13.0" />
</font>
<HBox.margin>
<Insets left="3.0" />
</HBox.margin>
</Text>
</children>
</HBox>
<Slider fx:id="waterUsageSlider" blockIncrement="100.0" layoutX="177.0" layoutY="509.0" majorTickUnit="100.0" max="300.0" minorTickCount="0" prefHeight="24.0" prefWidth="499.0" showTickLabels="true" showTickMarks="true" />
<Slider fx:id="cleanEnergyPurchasedSlider" blockIncrement="25.0" layoutX="177.0" layoutY="188.0" minorTickCount="0" prefHeight="24.0" prefWidth="499.0" showTickLabels="true" showTickMarks="true" />
<Text fill="#6f6f6f" layoutX="238.0" layoutY="165.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Percent purchased from clean energy program:">
<font>
<Font size="15.0" />
</font>
</Text>
<HBox alignment="CENTER" layoutX="553.0" layoutY="146.0" prefHeight="27.0" prefWidth="55.0" styleClass="km-indicator">
<children>
<Label fx:id="cleanEnergyPurchasedLabel" text="0 %">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Button layoutX="400.0" layoutY="547.0" mnemonicParsing="false" onAction="#displayFood" styleClass="nextButton" text="Next" />
<Text fill="#727272" layoutX="177.0" layoutY="255.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Natural gas">
<font>
<Font size="18.0" />
</font>
</Text>
<HBox alignment="CENTER_LEFT" layoutX="616.0" layoutY="262.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="€/year" wrappingWidth="41.0">
<font>
<Font size="13.0" />
</font>
<HBox.margin>
<Insets left="3.0" />
</HBox.margin>
</Text>
</children>
</HBox>
<TextField fx:id="naturalGasField" layoutX="177.0" layoutY="262.0" prefHeight="31.0" prefWidth="434.0" promptText="2,000" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="616.0" layoutY="325.0" prefHeight="31.0" prefWidth="54.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="€/year" wrappingWidth="41.0">
<font>
<Font size="13.0" />
</font>
<HBox.margin>
<Insets left="3.0" />
</HBox.margin>
</Text>
</children>
</HBox>
<TextField fx:id="heatingOilField" layoutX="177.0" layoutY="325.0" prefHeight="31.0" prefWidth="434.0" promptText="3,100" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<Text fill="#727272" layoutX="177.0" layoutY="316.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Heating oil &amp; other fuels">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="177.0" layoutY="383.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Living space area">
<font>
<Font size="18.0" />
</font>
</Text>
<TextField fx:id="livingSpaceField" layoutX="177.0" layoutY="390.0" prefHeight="31.0" prefWidth="434.0" promptText="1,570" text="0">
<font>
<Font size="15.0" />
</font>
</TextField>
<HBox alignment="CENTER_LEFT" layoutX="616.0" layoutY="390.0" prefHeight="31.0" prefWidth="0.0" styleClass="km-yearBox">
<children>
<Text layoutY="3.0" strokeType="OUTSIDE" strokeWidth="0.0" text="m²" textAlignment="CENTER" wrappingWidth="41.0">
<font>
<Font size="19.0" />
</font>
<HBox.margin>
<Insets left="3.0" />
</HBox.margin>
</Text>
</children>
</HBox>
<Text fill="#727272" layoutX="177.0" layoutY="454.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Water usage">
<font>
<Font size="18.0" />
</font>
</Text>
<HBox alignment="CENTER" layoutX="298.0" layoutY="459.0" prefHeight="27.0" prefWidth="258.0" styleClass="km-indicator">
<children>
<Label fx:id="waterUsageLabel" text="0% of similar households">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Line endX="79.0" layoutX="317.0" layoutY="14.0" stroke="#545b54" />
</children></AnchorPane>
<ScrollPane fx:id="foodPane" layoutY="92.0" prefHeight="611.0" prefWidth="820.0" visible="false">
<content>
<AnchorPane prefHeight="1000.0" prefWidth="817.0">
<children>
<Text layoutX="146.0" layoutY="36.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How much does the average person in your household eat?">
<font>
<Font size="20.0" />
</font>
</Text>
<Text fill="#727272" layoutX="146.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Meat, fish, eggs">
<font>
<Font size="18.0" />
</font>
</Text>
<Slider fx:id="meatFishEggsSlider" blockIncrement="2.5" layoutX="146.0" layoutY="205.0" majorTickUnit="2.5" max="7.5" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="299.0" layoutY="149.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="meatFishEggsLabel" text="2.6 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Text fill="#727272" layoutX="519.0" layoutY="115.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 2,6">
<font>
<Font size="15.0" />
</font>
</Text>
<Text fill="#727272" layoutX="519.0" layoutY="276.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 4,4">
<font>
<Font size="15.0" />
</font>
</Text>
<HBox alignment="CENTER" layoutX="299.0" layoutY="310.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="grainsBakedGoodsLabel" text="4.4 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Slider fx:id="grainsBakedGoodsSlider" blockIncrement="4.5" layoutX="146.0" layoutY="366.0" majorTickUnit="4.5" max="13.5" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<Text fill="#727272" layoutX="146.0" layoutY="278.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Grains &amp; baked goods">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="146.0" layoutY="439.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Dairy">
<font>
<Font size="18.0" />
</font>
</Text>
<Slider fx:id="dairySlider" blockIncrement="2.5" layoutX="146.0" layoutY="527.0" majorTickUnit="2.5" max="7.5" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="299.0" layoutY="471.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="dairyLabel" text="2.4 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Text fill="#727272" layoutX="519.0" layoutY="437.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 2,4">
<font>
<Font size="15.0" />
</font>
</Text>
<Text fill="#727272" layoutX="524.0" layoutY="776.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 3,7">
<font>
<Font size="15.0" />
</font>
</Text>
<HBox alignment="CENTER" layoutX="304.0" layoutY="810.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="snacksDrinksLabel" text="3.7 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Slider fx:id="snacksDrinksSlider" blockIncrement="3.7" layoutX="151.0" layoutY="866.0" majorTickUnit="3.7" max="11.0" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<Text fill="#727272" layoutX="151.0" layoutY="778.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Snacks, drinks etc.">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="151.0" layoutY="617.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Fruits &amp; vegetables">
<font>
<Font size="18.0" />
</font>
</Text>
<Slider fx:id="fruitsVegetablesSlider" blockIncrement="3.9" layoutX="151.0" layoutY="705.0" majorTickUnit="3.9" max="11.6" minorTickCount="0" prefHeight="24.0" prefWidth="517.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="304.0" layoutY="649.0" prefHeight="31.0" prefWidth="220.0" styleClass="km-indicator">
<children>
<Label fx:id="fruitsVegetablesLabel" text="3.9 daily servings per person">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<Text fill="#727272" layoutX="524.0" layoutY="615.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 3,9">
<font>
<Font size="15.0" />
</font>
</Text>
<Button layoutX="378.0" layoutY="926.0" mnemonicParsing="false" onAction="#displayShopping" styleClass="nextButton" text="Next" />
<Line endX="79.0" layoutX="402.0" layoutY="7.0" stroke="#545b54" />
</children>
</AnchorPane>
</content>
</ScrollPane>
<AnchorPane fx:id="shoppingPane" layoutY="92.0" prefHeight="611.0" prefWidth="820.0" visible="false">
<children>
<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>
</Text>
<Text fill="#727272" layoutX="133.0" layoutY="119.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Goods">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="133.0" layoutY="310.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Services">
<font>
<Font size="18.0" />
</font>
</Text>
<Text fill="#727272" layoutX="518.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 1.520 € / month">
<font>
<Font size="15.0" />
</font>
</Text>
<Text fill="#727272" layoutX="518.0" layoutY="309.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Average: 3.428 € / month">
<font>
<Font size="15.0" />
</font>
</Text>
<Slider fx:id="goodsSlider" blockIncrement="1520.0" layoutX="133.0" layoutY="209.0" majorTickUnit="1520.0" max="4560.0" minorTickCount="0" prefHeight="24.0" prefWidth="554.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="335.0" layoutY="145.0" prefHeight="31.0" prefWidth="150.0" styleClass="km-indicator">
<children>
<Label fx:id="goodsLabel" text="1520 € / month">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</HBox>
<HBox alignment="CENTER" layoutX="335.0" layoutY="348.0" prefHeight="31.0" prefWidth="150.0" styleClass="km-indicator">
<children>
<Label fx:id="servicesLabel" text="3428 € / month">
<font>
<Font size="15.0" />
</font>
</Label>
</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" />
<Line endX="79.0" layoutX="487.0" layoutY="7.0" stroke="#545b54" />
</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>
<Line endX="79.0" layoutX="572.0" layoutY="7.0" stroke="#545b54" />
</children>
</AnchorPane>
<AnchorPane fx:id="homePane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" visible="false" />
<AnchorPane fx:id="foodPane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" visible="false" />
<AnchorPane fx:id="shoppingPane" layoutY="85.0" prefHeight="618.0" prefWidth="820.0" visible="false" />
</children>
</AnchorPane>

View File

@@ -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.CheckBox?>

View File

@@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.image.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.shape.Line?>
<AnchorPane prefHeight="611.0" prefWidth="820.0" stylesheets="@../stylesheets/extraActivitiesStyle.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.ExtraActivityController">
<children>
<AnchorPane prefHeight="611.0" prefWidth="107.0">
<children>
<Button fx:id="displayVeganMealButton" contentDisplay="TOP" layoutX="14.0" layoutY="143.0" mnemonicParsing="false" onAction="#displayVeganMeal" prefHeight="70.0" prefWidth="82.0" styleClass="navButton">
<graphic>
<ImageView fitHeight="45.0" fitWidth="45.0" pickOnBounds="true" preserveRatio="true" styleClass="navButton">
<image>
<Image url="@../icons/icons8-vegan-food-100.png" />
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="displayBikeButton" contentDisplay="TOP" layoutX="14.0" layoutY="224.0" mnemonicParsing="false" onAction="#displayBike" prefHeight="70.0" prefWidth="82.0" styleClass="navButton">
<graphic>
<ImageView fitHeight="45.0" fitWidth="48.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/icons8-bicycle-filled-100.png" />
</image>
</ImageView>
</graphic></Button>
<Button fx:id="displayTemperatureButton" contentDisplay="TOP" layoutX="14.0" layoutY="305.0" mnemonicParsing="false" onAction="#displayTemperature" prefHeight="70.0" prefWidth="82.0" styleClass="navButton">
<graphic>
<ImageView fitHeight="45.0" fitWidth="48.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/icons8-temperature-inside-64.png" />
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="displaySolarPanelButton" contentDisplay="TOP" layoutX="14.0" layoutY="386.0" mnemonicParsing="false" onAction="#displaySolarPanel" prefHeight="70.0" prefWidth="82.0" styleClass="navButton">
<graphic>
<ImageView fitHeight="45.0" fitWidth="48.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/icons8-solar-panel-filled-100.png" />
</image>
</ImageView>
</graphic>
</Button>
</children>
</AnchorPane>
<AnchorPane fx:id="veganMealPane" layoutX="107.0" prefHeight="611.0" prefWidth="713.0" visible="false">
<children>
<Line fx:id="line1" endX="79.0" layoutX="465.0" layoutY="7.0" stroke="#545b54" />
<Text layoutX="248.0" layoutY="56.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Eating a vegetarian meal">
<font>
<Font size="20.0" />
</font>
</Text>
<Button fx:id="addVeganMealButton" contentDisplay="TOP" layoutX="267.0" layoutY="226.0" mnemonicParsing="false" prefHeight="150.0" prefWidth="180.0" style="-fx-background-color: transparent;" text="Add activity!" textFill="#23652b">
<graphic>
<ImageView fitHeight="116.0" fitWidth="156.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/addActivity1.png" />
</image>
</ImageView>
</graphic>
<font>
<Font name="System Bold Italic" size="18.0" />
</font>
</Button>
</children>
</AnchorPane>
<AnchorPane fx:id="bikePane" layoutX="107.0" prefHeight="611.0" prefWidth="713.0" visible="false">
<children>
<Line fx:id="line2" endX="79.0" layoutX="465.0" layoutY="7.0" stroke="#545b54" />
<Text layoutX="203.0" layoutY="56.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Using your bike instead of your car">
<font>
<Font size="20.0" />
</font>
</Text>
<Slider fx:id="bikeSlider" layoutX="144.0" layoutY="271.0" majorTickUnit="20.0" max="200.0" minorTickCount="0" prefHeight="24.0" prefWidth="427.0" showTickLabels="true" showTickMarks="true" />
<Text fill="#727272" layoutX="179.0" layoutY="144.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How many km did you travel using your bike &#10;that you would have traveled with your car?" textAlignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Text>
<Button fx:id="addBikeButton" contentDisplay="TOP" layoutX="267.0" layoutY="351.0" mnemonicParsing="false" prefHeight="150.0" prefWidth="180.0" style="-fx-background-color: transparent;" text="Add activity!" textFill="#23652b">
<font>
<Font name="System Bold Italic" size="18.0" />
</font>
<graphic>
<ImageView fitHeight="116.0" fitWidth="156.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/addActivity1.png" />
</image>
</ImageView>
</graphic>
</Button>
<HBox alignment="CENTER" layoutX="305.0" layoutY="204.0" prefHeight="36.0" prefWidth="107.0" styleClass="textHolder">
<children>
<Label fx:id="bikeLabel" text="0 km">
<font>
<Font size="17.0" />
</font>
</Label>
</children>
</HBox>
</children>
</AnchorPane>
<AnchorPane fx:id="temperaturePane" layoutX="107.0" prefHeight="611.0" prefWidth="713.0" visible="false">
<children>
<Line fx:id="line3" endX="79.0" layoutX="465.0" layoutY="7.0" stroke="#545b54" />
<Text layoutX="179.0" layoutY="56.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Lowering the temperature of your home">
<font>
<Font size="20.0" />
</font>
</Text>
<Text fill="#727272" layoutX="187.0" layoutY="133.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How many degrees (Celcius) did you lower&#10;your home temperature?" textAlignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Text>
<Slider fx:id="temperatureSlider" blockIncrement="1.0" layoutX="176.0" layoutY="266.0" majorTickUnit="1.0" max="15.0" minorTickCount="0" prefHeight="24.0" prefWidth="360.0" showTickLabels="true" showTickMarks="true" />
<HBox alignment="CENTER" layoutX="316.0" layoutY="194.0" prefHeight="36.0" prefWidth="107.0" styleClass="textHolder">
<children>
<Label fx:id="temperatureLabel" text="0 Degrees">
<font>
<Font size="17.0" />
</font>
</Label>
</children>
</HBox>
<Button fx:id="addTemperatureButton" contentDisplay="TOP" layoutX="267.0" layoutY="353.0" mnemonicParsing="false" prefHeight="150.0" prefWidth="180.0" style="-fx-background-color: transparent;" text="Add activity!" textFill="#23652b">
<font>
<Font name="System Bold Italic" size="18.0" />
</font>
<graphic>
<ImageView fitHeight="116.0" fitWidth="156.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/addActivity1.png" />
</image>
</ImageView>
</graphic>
</Button>
</children>
</AnchorPane>
<AnchorPane fx:id="solarPanelPane" layoutX="107.0" prefHeight="611.0" prefWidth="713.0">
<children>
<Line fx:id="line4" endX="79.0" layoutX="465.0" layoutY="7.0" stroke="#545b54" />
<Text layoutX="262.0" layoutY="56.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Installing solar panels">
<font>
<Font size="20.0" />
</font>
</Text>
<Text fill="#727272" layoutX="202.0" layoutY="150.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How many solar panels did you install?" textAlignment="CENTER">
<font>
<Font size="18.0" />
</font>
</Text>
<HBox alignment="CENTER" layoutX="329.0" layoutY="201.0" prefHeight="36.0" prefWidth="56.0" styleClass="textHolder">
<children>
<Label fx:id="solarPanelsLabel" text="0">
<font>
<Font size="17.0" />
</font>
</Label>
</children>
</HBox>
<Slider fx:id="solarPanelsSlider" blockIncrement="1.0" layoutX="187.0" layoutY="274.0" majorTickUnit="1.0" max="10.0" min="1.0" minorTickCount="0" prefHeight="24.0" prefWidth="338.0" showTickLabels="true" showTickMarks="true" />
<Button fx:id="addSolarPanelsButton" contentDisplay="TOP" layoutX="267.0" layoutY="378.0" mnemonicParsing="false" prefHeight="150.0" prefWidth="180.0" style="-fx-background-color: transparent;" text="Add activity!" textFill="#23652b">
<font>
<Font name="System Bold Italic" size="18.0" />
</font>
<graphic>
<ImageView fitHeight="116.0" fitWidth="156.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../icons/addActivity1.png" />
</image>
</ImageView>
</graphic>
</Button>
</children>
</AnchorPane>
</children>
</AnchorPane>

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -14,6 +14,9 @@
-fx-font-size: 16px;
-fx-font-weight: regular;
}
#calculatorTabs #saveButton:hover {
-fx-background-color: #9ec19c;
}
.nextButton {
-fx-background-color: #89a888;
@@ -26,7 +29,6 @@
.slider {
-show-value-on-interaction: true;
-fx-text-fill: red;
}
.km-yearBox {
@@ -36,6 +38,38 @@
-fx-padding: 0 0 0 3px;
}
.km-indicator {
-fx-background-color: #89a888;
-fx-background-radius: 5px;
-fx-border-radius: 5px;
}
.slider .track {
-fx-background-color: #d3d3d3;
}
.slider .thumb {
-fx-background-color: transparent;
-fx-background-image: url('../icons/leaficon.png');
-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;
}

View File

@@ -6,7 +6,7 @@
.root {
-fx-background-color: #f9fffb;
/*-fx-font-family: "Designio Regular";*/
-fx-font-family: Corbel; /*this doesn't work for some reason*/
/*-fx-font-family: Corbel; !*this doesn't work for some reason*!*/
}
#dashboardButton {
@@ -58,13 +58,31 @@
}
/*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;
}
.table-view .table-cell {
-fx-font-size: 17px;
}
.table-row-cell {
-fx-background-color: #c4f2cb;
}
.table-row-cell:odd {
-fx-background-color: #b7e2c2;
}
.activityField {
-fx-font-size: 14px;
}

View File

@@ -0,0 +1,19 @@
.navButton {
-fx-background-color: #6a7a6d;
}
.slider .track {
-fx-background-color: #d3d3d3;
}
.slider .thumb {
-fx-background-color: transparent;
-fx-background-image: url('../icons/leaficon.png');
-fx-padding: 12;
}
.textHolder {
-fx-background-color: #89a888;
-fx-background-radius: 5px;
-fx-border-radius: 5px;
}

View File

@@ -0,0 +1,29 @@
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertFalse;
import greenify.client.Hints;
import org.junit.Test;
public class HintsTest {
@Test
public void initHintsTest() {
Hints test = new Hints();
assertFalse(test.hints.isEmpty());
}
@Test
public void hintsContainsTest() {
Hints test = new Hints();
assertTrue(test.hints.contains("27,000 trees are cut down "
+ "each day so we can have toilet paper."));
}
@Test
public void randomHintTest() {
Hints test = new Hints();
String random = test.randomHint();
assertTrue(test.hints.contains(random));
}
}

View File

@@ -62,8 +62,8 @@ public class UserController {
*/
@RequestMapping("/setExtraInput")
public void setExtraInput(@RequestParam(value = "name") String name,
@RequestParam(value = "inputName") String inputName,
@RequestParam(value = "value") Boolean value) {
@RequestParam(value = "inputName") String inputName,
@RequestParam(value = "value") Boolean value) {
userService.setExtraInput(name, inputName, value);
}
@@ -186,3 +186,4 @@ public class UserController {
return userService.getAchievements(name);
}
}

View File

@@ -72,7 +72,21 @@ public class CalculatorService {
* @return the footprint of the user
*/
public Float calculateFootprint(User user) {
return invokeExternalService(user.getFootPrintInputs());
Float footprint = invokeExternalService(user.getFootPrintInputs());
addExtras(user);
return footprint;
}
public void addExtras(User user) {
if (user.getExtraInputs().get("local_produce")) {
user.setFootPrint(user.getFootPrint() - 2);
} else if (user.getExtraInputs().get("bike")) {
user.setFootPrint(user.getFootPrint() - 2);
} else if (user.getExtraInputs().get("temperature")) {
user.setFootPrint(user.getFootPrint() - 2);
} else if (user.getExtraInputs().get("solar_panels")) {
user.setFootPrint(user.getFootPrint() - 2);
}
}
}

View File

@@ -92,6 +92,29 @@ public class CalculatorServiceTest {
Assert.assertEquals(new Float(19.259982), footPrint);
}
@Test
public void addExtrasTest() throws URISyntaxException {
User user = new User(1L,"greenify", "password");
Map<String,Boolean> map = new HashMap<String, Boolean>() {{
put("local_produce", false);
put("bike", false);
put("temperature", false);
put("solar_panels", false);
}};
user.setExtraInputs(map);
user.setFootPrint(50f);
Map<String,Boolean> secondMap = new HashMap<String, Boolean>() {{
put("local_produce", true);
put("bike", true);
put("temperature", true);
put("solar_panels", true);
}};
user.setExtraInputs(secondMap);
calculatorService.addExtras(user);
mockServer.verify();
Assert.assertEquals(new Float(48f), user.getFootPrint());
}
@Test
public void invokeExternalServiceTest() {
CalculatorService service = new CalculatorService();