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;
|
package greenify.client.controller;
|
||||||
|
|
||||||
import greenify.client.rest.UserService;
|
import greenify.client.rest.UserService;
|
||||||
|
import javafx.animation.FadeTransition;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
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;
|
||||||
|
|
||||||
@@ -33,8 +36,18 @@ public class DashBoardController {
|
|||||||
@FXML
|
@FXML
|
||||||
private Label welcomebacktext;
|
private Label welcomebacktext;
|
||||||
|
|
||||||
|
FadeTransition fadeTrans;
|
||||||
|
|
||||||
public void initialize() {
|
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)
|
* @param event the event (clicking the button)
|
||||||
*/
|
*/
|
||||||
public void displayDashboard(ActionEvent event) {
|
public void displayDashboard(ActionEvent event) {
|
||||||
|
addFadeTransition(dashboardPane);
|
||||||
System.out.println("display dashboard");
|
System.out.println("display dashboard");
|
||||||
dashboardPane.setVisible(true);
|
dashboardPane.setVisible(true);
|
||||||
userPane.setVisible(false);
|
userPane.setVisible(false);
|
||||||
activitiesPane.setVisible(false);
|
activitiesPane.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,11 +70,13 @@ public class DashBoardController {
|
|||||||
* @param event the event (clicking the button)
|
* @param event the event (clicking the button)
|
||||||
*/
|
*/
|
||||||
public void displayActivities(ActionEvent event) {
|
public void displayActivities(ActionEvent event) {
|
||||||
|
addFadeTransition(activitiesPane);
|
||||||
totalVeganMealCounter.setText("" + userService.currentUser.getVeganMeal());
|
totalVeganMealCounter.setText("" + userService.currentUser.getVeganMeal());
|
||||||
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,10 +84,13 @@ public class DashBoardController {
|
|||||||
* @param event the event (clicking the button)
|
* @param event the event (clicking the button)
|
||||||
*/
|
*/
|
||||||
public void displayUser(ActionEvent event) {
|
public void displayUser(ActionEvent event) {
|
||||||
|
addFadeTransition(userPane);
|
||||||
System.out.println("display user");
|
System.out.println("display user");
|
||||||
dashboardPane.setVisible(false);
|
dashboardPane.setVisible(false);
|
||||||
userPane.setVisible(true);
|
userPane.setVisible(true);
|
||||||
activitiesPane.setVisible(false);
|
activitiesPane.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -207,6 +207,11 @@
|
|||||||
</ImageView>
|
</ImageView>
|
||||||
</graphic>
|
</graphic>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Text fill="#797676" layoutX="60.0" layoutY="105.0" strokeType="OUTSIDE" strokeWidth="0.0" text="How will you make the world greener today?">
|
||||||
|
<font>
|
||||||
|
<Font size="15.0" />
|
||||||
|
</font>
|
||||||
|
</Text>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Designio Regular ';
|
font-family: 'Designio Regular';
|
||||||
src: url('stylesheets/DesignioRegular.otf');
|
src: url('DesignioRegular.otf');
|
||||||
}
|
}
|
||||||
|
|
||||||
.root {
|
.root {
|
||||||
-fx-background-color: #f9fffb;
|
-fx-background-color: #f9fffb;
|
||||||
-fx-font-family: "Big Designer";
|
/*-fx-font-family: "Designio Regular";*/
|
||||||
|
-fx-font-family: Corbel; /*this doesn't work for some reason*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#dashboardButton {
|
#dashboardButton {
|
||||||
-fx-background-color: #5a635c;
|
-fx-background-color: #5a635c;
|
||||||
|
|
||||||
}
|
}
|
||||||
#dashboardButton:pressed {
|
#dashboardButton:pressed {
|
||||||
-fx-background-color: #b7e2c2;
|
-fx-background-color: #b7e2c2;
|
||||||
@@ -29,3 +29,4 @@
|
|||||||
#activitiesButton:pressed {
|
#activitiesButton:pressed {
|
||||||
-fx-background-color: #b7e2c2;
|
-fx-background-color: #b7e2c2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user