Merge branch 'master' of gitlab.ewi.tudelft.nl:cse1105/2018-2019/oopp-group-43/template
This commit is contained in:
68
src/Client/src/main/java/greenify/client/Hints.java
Normal file
68
src/Client/src/main/java/greenify/client/Hints.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package greenify.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class Hints {
|
||||
public ArrayList<String> hints;
|
||||
|
||||
public Hints() {
|
||||
this.hints = new ArrayList<String>();
|
||||
initHints();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds all the Strings to the arraylist.
|
||||
*/
|
||||
private void initHints() {
|
||||
hints.add("Buying local produce will not only decrease your carbon "
|
||||
+ "footprint, but also help your local economy: A win-win!");
|
||||
hints.add("Did you know that a gas oven only uses 6% of its energy "
|
||||
+ "to cook? And an electric oven is not much better at 12%.");
|
||||
hints.add("70% of the deforestation of the Amazon is to provide land for cattle ranches.");
|
||||
hints.add("Research shows that reducing meat consumption can increase"
|
||||
+ " your life span by 3.6 years");
|
||||
hints.add("Vegetarians have a lower risk of getting heart disease, high blood pressure, "
|
||||
+ "diabetes and cancer than meat eaters.");
|
||||
hints.add("Did you know? The carbon footprint of a vegetarian diet is about half "
|
||||
+ "that of a meat-lover’s diet!");
|
||||
hints.add("Cycling is good for the environment AND for your body, "
|
||||
+ "so why not grab your bike instead of your car?");
|
||||
hints.add("If we could capture all of the sun’s energy shining on the Earth for just one "
|
||||
+ "hour, we could power the entire world for one year!");
|
||||
hints.add("27,000 trees are cut down each day so we can have toilet paper.");
|
||||
hints.add("A glass bottle made in our time will take more than 4,000 years to decompose.");
|
||||
hints.add("Don't forget to turn off the lights and heating in rooms"
|
||||
+ " you're not using at the moment!");
|
||||
hints.add("Did you know that about 4.5% of the Dutch population does not eat meat");
|
||||
hints.add("Reuse your bags when you go grocery shopping. You will save plastic bags.");
|
||||
hints.add("An estimated 250 million trees can be save each year "
|
||||
+ "if every published newspaper is recycled.");
|
||||
hints.add("About 88,000 jobs were created in 2015 through the wind power sector.");
|
||||
hints.add("You can use LED lights in your home to safe energy!");
|
||||
hints.add("If you isolate your home well, it will be warmer "
|
||||
+ "and you'll save energy as well!");
|
||||
hints.add("Do you have leftovers? Donate them to food kitchens. This way you won't waste "
|
||||
+ "food and help people at the same time.");
|
||||
hints.add("A lot of coffee places give you a discount if you bring your own cup. "
|
||||
+ "Get rid of those disposable cups!");
|
||||
hints.add("When shopping, look for products with minimal to no packaging, "
|
||||
+ "or at least packaging made from recycled items. ");
|
||||
hints.add("If you order food, you can ask the restaurant to not include "
|
||||
+ "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.");
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a random hint from the list of hints.
|
||||
* @return the random hint.
|
||||
*/
|
||||
public String randomHint() {
|
||||
Random rand = new Random();
|
||||
int index = rand.nextInt(hints.size());
|
||||
return hints.get(index);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package greenify.client.controller;
|
||||
|
||||
import greenify.client.Application;
|
||||
import greenify.client.rest.UserService;
|
||||
import javafx.animation.Interpolator;
|
||||
import javafx.animation.KeyFrame;
|
||||
@@ -9,9 +10,7 @@ import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
@@ -151,6 +150,7 @@ public class CalculatorController {
|
||||
@FXML
|
||||
private CheckBox solarPanelsCheckbox;
|
||||
|
||||
|
||||
/**
|
||||
* initializes the window, performs some actions before loading all other things.
|
||||
* it sets the sliders to snap to the ticks.
|
||||
@@ -259,6 +259,7 @@ public class CalculatorController {
|
||||
*/
|
||||
@SuppressWarnings("Duplicates")
|
||||
public void displayGetStarted(ActionEvent event) {
|
||||
|
||||
getStartedPane.setVisible(true);
|
||||
travelPane.setVisible(false);
|
||||
homePane.setVisible(false);
|
||||
@@ -275,7 +276,7 @@ public class CalculatorController {
|
||||
*/
|
||||
@SuppressWarnings("Duplicates")
|
||||
public void displayTravel(ActionEvent event) {
|
||||
addSlideInAnimation(travelPane);
|
||||
|
||||
getStartedPane.setVisible(false);
|
||||
travelPane.setVisible(true);
|
||||
homePane.setVisible(false);
|
||||
@@ -292,6 +293,7 @@ public class CalculatorController {
|
||||
*/
|
||||
@SuppressWarnings("Duplicates")
|
||||
public void displayHome(ActionEvent event) {
|
||||
|
||||
getStartedPane.setVisible(false);
|
||||
travelPane.setVisible(false);
|
||||
homePane.setVisible(true);
|
||||
@@ -307,6 +309,7 @@ public class CalculatorController {
|
||||
*/
|
||||
@SuppressWarnings("Duplicates")
|
||||
public void displayFood(ActionEvent event) {
|
||||
|
||||
getStartedPane.setVisible(false);
|
||||
travelPane.setVisible(false);
|
||||
homePane.setVisible(false);
|
||||
@@ -322,6 +325,7 @@ public class CalculatorController {
|
||||
*/
|
||||
@SuppressWarnings("Duplicates")
|
||||
public void displayShopping(ActionEvent event) {
|
||||
|
||||
getStartedPane.setVisible(false);
|
||||
travelPane.setVisible(false);
|
||||
homePane.setVisible(false);
|
||||
@@ -338,8 +342,8 @@ public class CalculatorController {
|
||||
@SuppressWarnings("Duplicates")
|
||||
public void displayExtra(ActionEvent event) throws IOException {
|
||||
|
||||
// Parent extra = FXMLLoader.load(getClass().getClassLoader().getResource("fxml/extraActivities.fxml"));
|
||||
// extraPane.getChildren().setAll(extra);
|
||||
extraPane.getChildren().setAll((Node) Application.load(this.getClass()
|
||||
.getClassLoader().getResource("fxml/extraActivities.fxml")));
|
||||
getStartedPane.setVisible(false);
|
||||
travelPane.setVisible(false);
|
||||
homePane.setVisible(false);
|
||||
|
||||
@@ -155,20 +155,23 @@ public class DashBoardController {
|
||||
private Label snacks;
|
||||
@FXML
|
||||
private CheckBox localProduce;
|
||||
@SuppressWarnings("CheckStyle")
|
||||
@FXML
|
||||
private CheckBox loweringTemp;
|
||||
@SuppressWarnings("CheckStyle")
|
||||
@FXML
|
||||
private CheckBox bike;
|
||||
@SuppressWarnings("CheckStyle")
|
||||
@FXML
|
||||
private CheckBox solarPanels;
|
||||
|
||||
/**
|
||||
* Loads the the necessary things before anything else.
|
||||
* @throws InterruptedException exception if interrupted
|
||||
*/
|
||||
public void initialize() throws InterruptedException {
|
||||
//set the dashboardPane to visible
|
||||
dashboardPane.setVisible(true);
|
||||
userPane.setVisible(false);
|
||||
activitiesPane.setVisible(false);
|
||||
friendsPane.setVisible(false);
|
||||
//sets the text of the 'welcome back' text to include the username
|
||||
welcomebacktext.setText("Welcome back, " + userService.currentUser.getName() + "!");
|
||||
//adds the slide transition to the menu bar
|
||||
@@ -314,8 +317,8 @@ public class DashBoardController {
|
||||
electricMiles.setText(inputMap.get("input_footprint_transportation_miles3"));
|
||||
electricMpg.setText(inputMap.get("input_footprint_transportation_mpg3"));
|
||||
publicTransportation.setText(inputMap.get("input_footprint_transportation_publictrans")
|
||||
+ " mi/yr");
|
||||
airPlane.setText(inputMap.get("input_footprint_transportation_airtotal") + " mi/yr");
|
||||
+ " km/yr");
|
||||
airPlane.setText(inputMap.get("input_footprint_transportation_airtotal") + " km/yr");
|
||||
goodShopping.setText(inputMap.get("input_footprint_shopping_goods_total") + " €/mo");
|
||||
serviceShopping.setText(inputMap.get("input_footprint_shopping_services_total") + " €/mo");
|
||||
meat.setText(inputMap.get("input_footprint_shopping_food_meatfisheggs"));
|
||||
@@ -397,6 +400,17 @@ public class DashBoardController {
|
||||
calcStage.show();
|
||||
}
|
||||
|
||||
public void openExtraActivities(ActionEvent event) throws IOException {
|
||||
Parent extra = Application.load(this.getClass().getClassLoader()
|
||||
.getResource("fxml/extraActivities.fxml"));
|
||||
Scene scene = new Scene(extra);
|
||||
Stage extraStage = new Stage();
|
||||
extraStage.setScene(scene);
|
||||
extraStage.setTitle("Add extra activity - " + userService.currentUser.getName());
|
||||
extraStage.show();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* method opend addFriend scene.
|
||||
* @throws IOException when file is not found
|
||||
@@ -495,4 +509,5 @@ public class DashBoardController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<AnchorPane prefHeight="702.0" prefWidth="1032.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.DashBoardController">
|
||||
<AnchorPane prefHeight="702.0" prefWidth="1032.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.DashBoardController">
|
||||
<children>
|
||||
<AnchorPane fx:id="menuBar" prefHeight="703.0" prefWidth="216.0" style="-fx-background-color: #5a635c;">
|
||||
<children>
|
||||
@@ -279,6 +279,18 @@
|
||||
<CheckBox fx:id="solarPanels" layoutX="195.0" layoutY="103.0" mnemonicParsing="false" prefHeight="27.0" prefWidth="55.0" />
|
||||
</children>
|
||||
</Pane>
|
||||
<Button contentDisplay="RIGHT" layoutX="545.0" layoutY="14.0" mnemonicParsing="false" onAction="#openExtraActivities" style="-fx-background-color: transparent;" text="Add extra activity!" textFill="#147219">
|
||||
<graphic>
|
||||
<ImageView fitHeight="69.0" fitWidth="61.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../icons/addActivity1.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
<font>
|
||||
<Font name="System Bold Italic" size="14.0" />
|
||||
</font>
|
||||
</Button>
|
||||
</children></AnchorPane>
|
||||
<AnchorPane fx:id="userPane" layoutX="215.0" layoutY="-1.0" prefHeight="703.0" prefWidth="820.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="214.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
@@ -427,6 +439,18 @@
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Button contentDisplay="RIGHT" layoutX="568.0" layoutY="223.0" mnemonicParsing="false" onAction="#openExtraActivities" style="-fx-background-color: transparent;" text="Add extra activity" textFill="#147219">
|
||||
<font>
|
||||
<Font name="Corbel Bold" size="14.0" />
|
||||
</font>
|
||||
<graphic>
|
||||
<ImageView fitHeight="80.0" fitWidth="79.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../icons/addActivity1.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</Button>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane fx:id="friendsPane" layoutX="216.0" prefHeight="703.0" prefWidth="820.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="214.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
|
||||
@@ -1,20 +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 xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="greenify.client.controller.CalculatorController"
|
||||
prefHeight="611.0" prefWidth="820.0">
|
||||
|
||||
<children>
|
||||
<Button text="click">
|
||||
|
||||
</Button>
|
||||
</children>
|
||||
|
||||
<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 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 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: 825 B |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
BIN
src/Client/src/main/resources/icons/icons8-vegan-food-100.png
Normal file
BIN
src/Client/src/main/resources/icons/icons8-vegan-food-100.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -29,7 +29,6 @@
|
||||
|
||||
.slider {
|
||||
-show-value-on-interaction: true;
|
||||
-fx-text-fill: red;
|
||||
}
|
||||
|
||||
.km-yearBox {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
29
src/Client/src/test/java/HintsTest.java
Normal file
29
src/Client/src/test/java/HintsTest.java
Normal 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user