ADD::added animations
added animations for switching between panes in the main stage
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package greenify.client.controller;
|
||||
|
||||
import greenify.client.rest.UserService;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.util.Duration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
@@ -33,8 +36,18 @@ public class DashBoardController {
|
||||
@FXML
|
||||
private Label welcomebacktext;
|
||||
|
||||
FadeTransition fadeTrans;
|
||||
|
||||
public void initialize() {
|
||||
welcomebacktext.setText("Welcome back " + userService.currentUser.getName() + "!");
|
||||
welcomebacktext.setText("Welcome back, " + userService.currentUser.getName() + "!");
|
||||
}
|
||||
|
||||
public void addFadeTransition(Node node) {
|
||||
|
||||
fadeTrans = new FadeTransition(Duration.millis(400), node);
|
||||
fadeTrans.setFromValue(0);
|
||||
fadeTrans.setToValue(1.0);
|
||||
fadeTrans.play();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,11 +56,13 @@ public class DashBoardController {
|
||||
* @param event the event (clicking the button)
|
||||
*/
|
||||
public void displayDashboard(ActionEvent event) {
|
||||
addFadeTransition(dashboardPane);
|
||||
System.out.println("display dashboard");
|
||||
dashboardPane.setVisible(true);
|
||||
userPane.setVisible(false);
|
||||
activitiesPane.setVisible(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,11 +70,13 @@ public class DashBoardController {
|
||||
* @param event the event (clicking the button)
|
||||
*/
|
||||
public void displayActivities(ActionEvent event) {
|
||||
addFadeTransition(activitiesPane);
|
||||
totalVeganMealCounter.setText("" + userService.currentUser.getVeganMeal());
|
||||
System.out.println("display activities");
|
||||
dashboardPane.setVisible(false);
|
||||
userPane.setVisible(false);
|
||||
activitiesPane.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,10 +84,13 @@ public class DashBoardController {
|
||||
* @param event the event (clicking the button)
|
||||
*/
|
||||
public void displayUser(ActionEvent event) {
|
||||
addFadeTransition(userPane);
|
||||
System.out.println("display user");
|
||||
dashboardPane.setVisible(false);
|
||||
userPane.setVisible(true);
|
||||
activitiesPane.setVisible(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user