diff --git a/src/Client/src/main/java/greenify/client/controller/DashBoardController.java b/src/Client/src/main/java/greenify/client/controller/DashBoardController.java
index df2f2b5..c9429e5 100644
--- a/src/Client/src/main/java/greenify/client/controller/DashBoardController.java
+++ b/src/Client/src/main/java/greenify/client/controller/DashBoardController.java
@@ -24,35 +24,40 @@ public class DashBoardController {
@Autowired
UserService userService;
+ private FadeTransition fadeTrans; //transition for switching between the different panels
+ private int net;
private int count = 0;
@FXML
private AnchorPane dashboardPane;
-
@FXML
private AnchorPane userPane;
-
@FXML
private AnchorPane activitiesPane;
-
+ @FXML
+ private AnchorPane friendsPane;
@FXML
private Label veganMealCounter;
-
@FXML
private Label totalVeganMealCounter;
-
@FXML
private Label welcomebacktext;
-
@FXML
- public Button dashboardButton;
- public Button activitiesButton;
- public Button userButton;
- public Line pathLine;
- public AnchorPane menuBar;
- public Button addNewActivityButton;
+ private Button dashboardButton;
+ @FXML
+ private Button activitiesButton;
+ @FXML
+ private Button userButton;
+ @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.
@@ -66,6 +71,7 @@ public class DashBoardController {
dashboardButton.setSkin(new MyButtonSkin(dashboardButton));
activitiesButton.setSkin(new MyButtonSkin(activitiesButton));
userButton.setSkin(new MyButtonSkin(userButton));
+ friendsButton.setSkin(new MyButtonSkin(friendsButton));
@@ -94,7 +100,7 @@ public class DashBoardController {
dashboardPane.setVisible(true);
userPane.setVisible(false);
activitiesPane.setVisible(false);
-
+ friendsPane.setVisible(false);
}
@@ -107,13 +113,13 @@ public class DashBoardController {
addFadeTransition(activitiesPane);
- int net = userService.currentUser.getVeganMeal() + count;
+ net = userService.currentUser.getVeganMeal() + count;
totalVeganMealCounter.setText("" + net);
System.out.println("display activities");
dashboardPane.setVisible(false);
userPane.setVisible(false);
activitiesPane.setVisible(true);
-
+ friendsPane.setVisible(false);
}
/**
@@ -126,10 +132,21 @@ public class DashBoardController {
dashboardPane.setVisible(false);
userPane.setVisible(true);
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.
* @param event the event (clicking the button)
@@ -137,7 +154,7 @@ public class DashBoardController {
public void addVeganMeal(ActionEvent event) {
count++;
- int net = userService.currentUser.getVeganMeal() + count;
+ net = userService.currentUser.getVeganMeal() + count;
totalVeganMealCounter.setText("" + net);
veganMealCounter.setText("" + count);
System.out.println(userService);
@@ -154,11 +171,21 @@ public class DashBoardController {
//class for the animations on the navigation buttons
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) {
+ //inherit the button properties
super(button);
+ //transition to scale up on hover
final ScaleTransition scaleUp = new ScaleTransition(Duration.millis(100));
+ //add the node and the position to scale to
scaleUp.setNode(button);
scaleUp.setToX(1.1);
+ //play the transition when hovered over the button
button.setOnMouseEntered(e -> scaleUp.playFromStart());
final ScaleTransition scaleDown = new ScaleTransition(Duration.millis(100));
diff --git a/src/Client/src/main/java/greenify/client/controller/RegisterWindowController.java b/src/Client/src/main/java/greenify/client/controller/RegisterWindowController.java
index ca3b042..c44b668 100644
--- a/src/Client/src/main/java/greenify/client/controller/RegisterWindowController.java
+++ b/src/Client/src/main/java/greenify/client/controller/RegisterWindowController.java
@@ -1,16 +1,23 @@
package greenify.client.controller;
import greenify.client.rest.UserService;
+import javafx.animation.TranslateTransition;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
+import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
+import javafx.scene.shape.Line;
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.util.concurrent.TimeUnit;
+
//class that controls the actions for the register window
@Controller
public class RegisterWindowController {
@@ -26,6 +33,25 @@ public class RegisterWindowController {
private PasswordField passwordField2;
@FXML
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.
diff --git a/src/Client/src/main/resources/fxml/RegisterWindow.fxml b/src/Client/src/main/resources/fxml/RegisterWindow.fxml
index 4b3a472..35bff80 100644
--- a/src/Client/src/main/resources/fxml/RegisterWindow.fxml
+++ b/src/Client/src/main/resources/fxml/RegisterWindow.fxml
@@ -1,6 +1,10 @@
-
+
+
+
+
+
@@ -8,8 +12,10 @@
+
+
diff --git a/src/Client/src/main/resources/fxml/dashboard.fxml b/src/Client/src/main/resources/fxml/dashboard.fxml
index ee7d589..7f4d131 100644
--- a/src/Client/src/main/resources/fxml/dashboard.fxml
+++ b/src/Client/src/main/resources/fxml/dashboard.fxml
@@ -42,9 +42,15 @@
+
+
@@ -215,5 +221,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/Client/src/main/resources/stylesheets/dashboardStyle.css b/src/Client/src/main/resources/stylesheets/dashboardStyle.css
index df39894..73cca5f 100644
--- a/src/Client/src/main/resources/stylesheets/dashboardStyle.css
+++ b/src/Client/src/main/resources/stylesheets/dashboardStyle.css
@@ -38,8 +38,17 @@
#activitiesButton:pressed {
-fx-background-color: #b7e2c2;
}
-
-#addNewActivityButton:pressed {
- -fx-background-color: #e8e8e8;
+#friendsButton {
+ -fx-background-color: #5a635c;
+}
+#friendsButton:hover {
+ -fx-background-color: #677069;
+}
+#friendsButton:pressed {
+ -fx-background-color: #b7e2c2;
+}
+
+#addNewActivityButton:pressed {
+ -fx-border-color: #497251;
}