Merge branch 'Add_friends_to_GUI' into 'master'
merge Add_friends_to_gui into master See merge request cse1105/2018-2019/oopp-group-43/template!39
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?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.PasswordField?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
@@ -8,8 +12,10 @@
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?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">
|
||||
<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">
|
||||
<image>
|
||||
<Image url="@../registerBackground.png" />
|
||||
|
||||
@@ -42,9 +42,15 @@
|
||||
<Font size="21.0" />
|
||||
</font>
|
||||
</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="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 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>
|
||||
<AnchorPane fx:id="activitiesPane" layoutX="214.0" prefHeight="603.0" prefWidth="720.0" visible="false">
|
||||
<children>
|
||||
@@ -188,7 +194,7 @@
|
||||
</children>
|
||||
</VBox>
|
||||
</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>
|
||||
<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">
|
||||
@@ -215,5 +221,20 @@
|
||||
</Text>
|
||||
</children>
|
||||
</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>
|
||||
</AnchorPane>
|
||||
|
||||
@@ -38,8 +38,29 @@
|
||||
#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;
|
||||
}
|
||||
|
||||
/*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