Merge branch 'master' of gitlab.ewi.tudelft.nl:cse1105/2018-2019/oopp-group-43/template
sourcetree needed to merge this
This commit is contained in:
@@ -24,35 +24,40 @@ public class DashBoardController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
UserService userService;
|
UserService userService;
|
||||||
|
|
||||||
|
private FadeTransition fadeTrans; //transition for switching between the different panels
|
||||||
|
private int net;
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane dashboardPane;
|
private AnchorPane dashboardPane;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane userPane;
|
private AnchorPane userPane;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane activitiesPane;
|
private AnchorPane activitiesPane;
|
||||||
|
@FXML
|
||||||
|
private AnchorPane friendsPane;
|
||||||
@FXML
|
@FXML
|
||||||
private Label veganMealCounter;
|
private Label veganMealCounter;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label totalVeganMealCounter;
|
private Label totalVeganMealCounter;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label welcomebacktext;
|
private Label welcomebacktext;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public Button dashboardButton;
|
private Button dashboardButton;
|
||||||
public Button activitiesButton;
|
@FXML
|
||||||
public Button userButton;
|
private Button activitiesButton;
|
||||||
public Line pathLine;
|
@FXML
|
||||||
public AnchorPane menuBar;
|
private Button userButton;
|
||||||
public Button addNewActivityButton;
|
@FXML
|
||||||
|
private Button friendsButton;
|
||||||
|
@FXML
|
||||||
|
private Line pathLine;
|
||||||
|
@FXML
|
||||||
|
private AnchorPane menuBar;
|
||||||
|
@FXML
|
||||||
|
private Button addNewActivityButton;
|
||||||
|
|
||||||
|
|
||||||
FadeTransition fadeTrans; //transition for switching between the different panels
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* loads the the necessary things before anything else.
|
* loads the the necessary things before anything else.
|
||||||
@@ -66,6 +71,7 @@ public class DashBoardController {
|
|||||||
dashboardButton.setSkin(new MyButtonSkin(dashboardButton));
|
dashboardButton.setSkin(new MyButtonSkin(dashboardButton));
|
||||||
activitiesButton.setSkin(new MyButtonSkin(activitiesButton));
|
activitiesButton.setSkin(new MyButtonSkin(activitiesButton));
|
||||||
userButton.setSkin(new MyButtonSkin(userButton));
|
userButton.setSkin(new MyButtonSkin(userButton));
|
||||||
|
friendsButton.setSkin(new MyButtonSkin(friendsButton));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +100,7 @@ public class DashBoardController {
|
|||||||
dashboardPane.setVisible(true);
|
dashboardPane.setVisible(true);
|
||||||
userPane.setVisible(false);
|
userPane.setVisible(false);
|
||||||
activitiesPane.setVisible(false);
|
activitiesPane.setVisible(false);
|
||||||
|
friendsPane.setVisible(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,13 +113,13 @@ public class DashBoardController {
|
|||||||
|
|
||||||
addFadeTransition(activitiesPane);
|
addFadeTransition(activitiesPane);
|
||||||
|
|
||||||
int net = userService.currentUser.getVeganMeal() + count;
|
net = userService.currentUser.getVeganMeal() + count;
|
||||||
totalVeganMealCounter.setText("" + net);
|
totalVeganMealCounter.setText("" + net);
|
||||||
System.out.println("display activities");
|
System.out.println("display activities");
|
||||||
dashboardPane.setVisible(false);
|
dashboardPane.setVisible(false);
|
||||||
userPane.setVisible(false);
|
userPane.setVisible(false);
|
||||||
activitiesPane.setVisible(true);
|
activitiesPane.setVisible(true);
|
||||||
|
friendsPane.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,10 +132,21 @@ public class DashBoardController {
|
|||||||
dashboardPane.setVisible(false);
|
dashboardPane.setVisible(false);
|
||||||
userPane.setVisible(true);
|
userPane.setVisible(true);
|
||||||
activitiesPane.setVisible(false);
|
activitiesPane.setVisible(false);
|
||||||
|
friendsPane.setVisible(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void displayFriends(ActionEvent event) {
|
||||||
|
addFadeTransition(friendsPane);
|
||||||
|
System.out.println("display friends");
|
||||||
|
dashboardPane.setVisible(false);
|
||||||
|
userPane.setVisible(false);
|
||||||
|
activitiesPane.setVisible(false);
|
||||||
|
friendsPane.setVisible(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* adds a vegetarian meal.
|
* adds a vegetarian meal.
|
||||||
* @param event the event (clicking the button)
|
* @param event the event (clicking the button)
|
||||||
@@ -137,7 +154,7 @@ public class DashBoardController {
|
|||||||
public void addVeganMeal(ActionEvent event) {
|
public void addVeganMeal(ActionEvent event) {
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
int net = userService.currentUser.getVeganMeal() + count;
|
net = userService.currentUser.getVeganMeal() + count;
|
||||||
totalVeganMealCounter.setText("" + net);
|
totalVeganMealCounter.setText("" + net);
|
||||||
veganMealCounter.setText("" + count);
|
veganMealCounter.setText("" + count);
|
||||||
System.out.println(userService);
|
System.out.println(userService);
|
||||||
@@ -154,11 +171,21 @@ public class DashBoardController {
|
|||||||
|
|
||||||
//class for the animations on the navigation buttons
|
//class for the animations on the navigation buttons
|
||||||
public class MyButtonSkin extends ButtonSkin {
|
public class MyButtonSkin extends ButtonSkin {
|
||||||
|
/**
|
||||||
|
* adds a skin and scale animation to a button.
|
||||||
|
* the scale transition is for hovering over it so it then scales up
|
||||||
|
* and scales down when you stop hovering over it.
|
||||||
|
* @param button the button to add the animation to
|
||||||
|
*/
|
||||||
public MyButtonSkin(Button button) {
|
public MyButtonSkin(Button button) {
|
||||||
|
//inherit the button properties
|
||||||
super(button);
|
super(button);
|
||||||
|
//transition to scale up on hover
|
||||||
final ScaleTransition scaleUp = new ScaleTransition(Duration.millis(100));
|
final ScaleTransition scaleUp = new ScaleTransition(Duration.millis(100));
|
||||||
|
//add the node and the position to scale to
|
||||||
scaleUp.setNode(button);
|
scaleUp.setNode(button);
|
||||||
scaleUp.setToX(1.1);
|
scaleUp.setToX(1.1);
|
||||||
|
//play the transition when hovered over the button
|
||||||
button.setOnMouseEntered(e -> scaleUp.playFromStart());
|
button.setOnMouseEntered(e -> scaleUp.playFromStart());
|
||||||
|
|
||||||
final ScaleTransition scaleDown = new ScaleTransition(Duration.millis(100));
|
final ScaleTransition scaleDown = new ScaleTransition(Duration.millis(100));
|
||||||
|
|||||||
@@ -1,16 +1,23 @@
|
|||||||
package greenify.client.controller;
|
package greenify.client.controller;
|
||||||
|
|
||||||
import greenify.client.rest.UserService;
|
import greenify.client.rest.UserService;
|
||||||
|
import javafx.animation.TranslateTransition;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.PasswordField;
|
import javafx.scene.control.PasswordField;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.shape.Line;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.Window;
|
import javafx.stage.Window;
|
||||||
|
import javafx.util.Duration;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
//class that controls the actions for the register window
|
//class that controls the actions for the register window
|
||||||
@Controller
|
@Controller
|
||||||
public class RegisterWindowController {
|
public class RegisterWindowController {
|
||||||
@@ -26,6 +33,25 @@ public class RegisterWindowController {
|
|||||||
private PasswordField passwordField2;
|
private PasswordField passwordField2;
|
||||||
@FXML
|
@FXML
|
||||||
private Button signupButton;
|
private Button signupButton;
|
||||||
|
@FXML
|
||||||
|
private Line uNamePathLine;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addSlideAnimation(int duration, Node node, int from) {
|
||||||
|
TranslateTransition slideIn = new TranslateTransition(Duration.millis(duration), node);
|
||||||
|
slideIn.setFromX(from);
|
||||||
|
slideIn.setToX(0);
|
||||||
|
slideIn.play();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* signs the user up.
|
* signs the user up.
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.image.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.shape.*?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.PasswordField?>
|
<?import javafx.scene.control.PasswordField?>
|
||||||
<?import javafx.scene.control.TextField?>
|
<?import javafx.scene.control.TextField?>
|
||||||
@@ -8,8 +12,10 @@
|
|||||||
<?import javafx.scene.image.ImageView?>
|
<?import javafx.scene.image.ImageView?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.text.*?>
|
<?import javafx.scene.text.*?>
|
||||||
|
|
||||||
<AnchorPane prefHeight="300.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.RegisterWindowController">
|
<AnchorPane prefHeight="300.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.RegisterWindowController">
|
||||||
<children>
|
<children>
|
||||||
|
<Line fx:id="uNamePathLine" endX="100.0" layoutX="2.0" layoutY="109.0" startX="-100.0" />
|
||||||
<ImageView fitHeight="312.0" fitWidth="300.0" pickOnBounds="true" preserveRatio="true">
|
<ImageView fitHeight="312.0" fitWidth="300.0" pickOnBounds="true" preserveRatio="true">
|
||||||
<image>
|
<image>
|
||||||
<Image url="@../registerBackground.png" />
|
<Image url="@../registerBackground.png" />
|
||||||
|
|||||||
@@ -42,9 +42,15 @@
|
|||||||
<Font size="21.0" />
|
<Font size="21.0" />
|
||||||
</font>
|
</font>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button fx:id="friendsButton" layoutY="224.0" mnemonicParsing="false" onAction="#displayFriends" prefHeight="45.0" prefWidth="216.0" text="friends">
|
||||||
|
<font>
|
||||||
|
<Font size="21.0" />
|
||||||
|
</font>
|
||||||
|
</Button>
|
||||||
<Line endX="104.0" layoutX="102.0" layoutY="133.0" scaleY="0.7" startX="-100.0" stroke="#e3ffe8" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" />
|
<Line endX="104.0" layoutX="102.0" layoutY="133.0" scaleY="0.7" startX="-100.0" stroke="#e3ffe8" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" />
|
||||||
<Line endX="104.0" layoutX="105.0" layoutY="178.0" scaleY="0.7" startX="-100.0" stroke="#e3ffe8" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" />
|
<Line endX="104.0" layoutX="105.0" layoutY="178.0" scaleY="0.7" startX="-100.0" stroke="#e3ffe8" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" />
|
||||||
<Line fx:id="pathLine" endX="100.0" endY="28.0" fill="#1b9736" layoutX="5.0" layoutY="273.0" startX="-100.0" startY="28.0" stroke="#5a635c" />
|
<Line fx:id="pathLine" endX="100.0" endY="28.0" fill="#1b9736" layoutX="5.0" layoutY="273.0" startX="-100.0" startY="28.0" stroke="#5a635c" />
|
||||||
|
<Line endX="104.0" layoutX="109.0" layoutY="223.0" startX="-100.0" stroke="#e3ffe8" strokeWidth="0.7" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" />
|
||||||
</children></AnchorPane>
|
</children></AnchorPane>
|
||||||
<AnchorPane fx:id="activitiesPane" layoutX="214.0" prefHeight="603.0" prefWidth="720.0" visible="false">
|
<AnchorPane fx:id="activitiesPane" layoutX="214.0" prefHeight="603.0" prefWidth="720.0" visible="false">
|
||||||
<children>
|
<children>
|
||||||
@@ -188,7 +194,7 @@
|
|||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
</children></AnchorPane>
|
</children></AnchorPane>
|
||||||
<AnchorPane fx:id="dashboardPane" layoutX="215.0" prefHeight="603.0" prefWidth="711.0">
|
<AnchorPane fx:id="dashboardPane" layoutX="215.0" prefHeight="603.0" prefWidth="711.0" visible="false">
|
||||||
<children>
|
<children>
|
||||||
<HBox layoutX="97.0" layoutY="124.0" prefHeight="100.0" prefWidth="200.0" />
|
<HBox layoutX="97.0" layoutY="124.0" prefHeight="100.0" prefWidth="200.0" />
|
||||||
<Label fx:id="welcomebacktext" layoutX="69.0" layoutY="53.0" text="Welcome back user!" AnchorPane.leftAnchor="60.0" AnchorPane.topAnchor="40.0">
|
<Label fx:id="welcomebacktext" layoutX="69.0" layoutY="53.0" text="Welcome back user!" AnchorPane.leftAnchor="60.0" AnchorPane.topAnchor="40.0">
|
||||||
@@ -215,5 +221,20 @@
|
|||||||
</Text>
|
</Text>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
<AnchorPane fx:id="friendsPane" layoutX="214.0" prefHeight="603.0" prefWidth="720.0">
|
||||||
|
<children>
|
||||||
|
<Text layoutX="94.0" layoutY="72.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Your Friends" AnchorPane.leftAnchor="60.0" AnchorPane.topAnchor="40.0">
|
||||||
|
<font>
|
||||||
|
<Font size="30.0" />
|
||||||
|
</font>
|
||||||
|
</Text>
|
||||||
|
<TableView fx:id="friendsTable" layoutX="60.0" layoutY="130.0" prefHeight="426.0" prefWidth="216.0" style="-fx-background-color: #e1fcd9;">
|
||||||
|
<columns>
|
||||||
|
<TableColumn fx:id="friendsColumn" prefWidth="107.0" text="Friend" />
|
||||||
|
<TableColumn fx:id="scoreColumn" prefWidth="108.0" text="Score" />
|
||||||
|
</columns>
|
||||||
|
</TableView>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|||||||
@@ -38,8 +38,29 @@
|
|||||||
#activitiesButton:pressed {
|
#activitiesButton:pressed {
|
||||||
-fx-background-color: #b7e2c2;
|
-fx-background-color: #b7e2c2;
|
||||||
}
|
}
|
||||||
|
#friendsButton {
|
||||||
#addNewActivityButton:pressed {
|
-fx-background-color: #5a635c;
|
||||||
-fx-background-color: #e8e8e8;
|
}
|
||||||
|
#friendsButton:hover {
|
||||||
|
-fx-background-color: #677069;
|
||||||
|
}
|
||||||
|
#friendsButton:pressed {
|
||||||
|
-fx-background-color: #b7e2c2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#addNewActivityButton:pressed {
|
||||||
|
-fx-border-color: #497251;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*friends table*/
|
||||||
|
#friendsTable .column-header {
|
||||||
|
/*-fx-background-color: linear-gradient(#4b7a3d, #588c58);*/
|
||||||
|
-fx-background-color: #5a635c;
|
||||||
|
|
||||||
|
}
|
||||||
|
#friendsTable .column-header .label {
|
||||||
|
-fx-text-fill: #d4d6d4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user