Merge branch 'Feature/logoutbutton' into 'master'
ADD:: logout button See merge request cse1105/2018-2019/oopp-group-43/template!67
This commit is contained in:
@@ -26,6 +26,7 @@ import javafx.scene.image.ImageView;
|
|||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.shape.Line;
|
import javafx.scene.shape.Line;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.Window;
|
||||||
import javafx.util.Duration;
|
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,6 +34,7 @@ import org.springframework.stereotype.Controller;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that controls the dashboard fxml file (the GUI Screen).
|
* Class that controls the dashboard fxml file (the GUI Screen).
|
||||||
@@ -70,6 +72,8 @@ public class DashBoardController {
|
|||||||
@FXML
|
@FXML
|
||||||
private Button friendsButton;
|
private Button friendsButton;
|
||||||
@FXML
|
@FXML
|
||||||
|
private Button logOutButton;
|
||||||
|
@FXML
|
||||||
private Line pathLine;
|
private Line pathLine;
|
||||||
@FXML
|
@FXML
|
||||||
private AnchorPane menuBar;
|
private AnchorPane menuBar;
|
||||||
@@ -197,7 +201,7 @@ public class DashBoardController {
|
|||||||
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));
|
friendsButton.setSkin(new MyButtonSkin(friendsButton));
|
||||||
|
logOutButton.setSkin(new MyButtonSkin(logOutButton));
|
||||||
friendsColumn.setCellValueFactory(new PropertyValueFactory<>("Friend"));
|
friendsColumn.setCellValueFactory(new PropertyValueFactory<>("Friend"));
|
||||||
scoreColumn.setCellValueFactory(new PropertyValueFactory<>("Score"));
|
scoreColumn.setCellValueFactory(new PropertyValueFactory<>("Score"));
|
||||||
globalUser.setCellValueFactory(new PropertyValueFactory<>("Friend"));
|
globalUser.setCellValueFactory(new PropertyValueFactory<>("Friend"));
|
||||||
@@ -403,6 +407,33 @@ public class DashBoardController {
|
|||||||
updateFriends();
|
updateFriends();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out the user
|
||||||
|
* @param event the event (clicking the button)
|
||||||
|
* @throws IOException if the Application doesn't load.
|
||||||
|
*/
|
||||||
|
public void logOut(ActionEvent event) throws IOException {
|
||||||
|
//get the current window
|
||||||
|
Window owner = logOutButton.getScene().getWindow();
|
||||||
|
Stage current = (Stage) owner;
|
||||||
|
//close current window (log out)
|
||||||
|
current.close();
|
||||||
|
System.out.println("User is logged out");
|
||||||
|
|
||||||
|
//load the fxml file
|
||||||
|
Parent dash = Application.load(this.getClass().getClassLoader()
|
||||||
|
.getResource("fxml/LoginWindow.fxml"));
|
||||||
|
Scene scene = new Scene(dash);
|
||||||
|
//add the stylesheet for the CSS
|
||||||
|
scene.getStylesheets().add(Objects.requireNonNull(getClass().getClassLoader()
|
||||||
|
.getResource("stylesheets/LoginWindowStyle.css")).toExternalForm());
|
||||||
|
Stage appStage = new Stage();
|
||||||
|
appStage.setScene(scene);
|
||||||
|
//set the title
|
||||||
|
appStage.setTitle("Greenify");
|
||||||
|
appStage.show();
|
||||||
|
}
|
||||||
|
|
||||||
//sets the slide in transition for startup
|
//sets the slide in transition for startup
|
||||||
public void addSlideTransition(Node node, Line path1) {
|
public void addSlideTransition(Node node, Line path1) {
|
||||||
PathTransition pathTrans = new PathTransition(Duration.millis(1100), path1, node);
|
PathTransition pathTrans = new PathTransition(Duration.millis(1100), path1, node);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<?import javafx.scene.text.Text?>
|
<?import javafx.scene.text.Text?>
|
||||||
|
|
||||||
<AnchorPane prefHeight="702.0" prefWidth="1032.0" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.DashBoardController">
|
<AnchorPane prefHeight="702.0" prefWidth="1032.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="greenify.client.controller.DashBoardController">
|
||||||
<children>
|
<children>
|
||||||
<AnchorPane fx:id="menuBar" prefHeight="703.0" prefWidth="216.0" style="-fx-background-color: #5a635c;">
|
<AnchorPane fx:id="menuBar" prefHeight="703.0" prefWidth="216.0" style="-fx-background-color: #5a635c;">
|
||||||
<children>
|
<children>
|
||||||
@@ -44,10 +44,16 @@
|
|||||||
<Font size="21.0" />
|
<Font size="21.0" />
|
||||||
</font>
|
</font>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button fx:id="logOutButton" layoutY="270.0" mnemonicParsing="false" onAction="#logOut" prefHeight="45.0" prefWidth="216.0" text="log out ">
|
||||||
|
<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 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" />
|
<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" />
|
||||||
<Line fx:id="pathLine" endX="100.0" endY="28.0" fill="#1b9736" layoutX="8.0" layoutY="323.0" startX="-100.0" startY="28.0" stroke="#5a635c" />
|
<Line fx:id="pathLine" endX="100.0" endY="28.0" fill="#1b9736" layoutX="8.0" layoutY="323.0" startX="-100.0" startY="28.0" stroke="#5a635c" />
|
||||||
|
<Line endX="104.0" layoutX="105.0" layoutY="271.0" startX="-100.0" stroke="#e3ffe8" strokeWidth="0.7" />
|
||||||
<Label fx:id="hintText" alignment="TOP_LEFT" layoutX="14.0" layoutY="420.0" prefHeight="218.0" prefWidth="187.0" text="Hints" textFill="#c2cdc4">
|
<Label fx:id="hintText" alignment="TOP_LEFT" layoutX="14.0" layoutY="420.0" prefHeight="218.0" prefWidth="187.0" text="Hints" textFill="#c2cdc4">
|
||||||
<font>
|
<font>
|
||||||
<Font size="15.0" />
|
<Font size="15.0" />
|
||||||
@@ -303,7 +309,8 @@
|
|||||||
<Font name="System Bold Italic" size="14.0" />
|
<Font name="System Bold Italic" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</Button>
|
</Button>
|
||||||
</children></AnchorPane>
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
<AnchorPane fx:id="userPane" layoutX="215.0" layoutY="-1.0" prefHeight="703.0" prefWidth="820.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="214.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<AnchorPane fx:id="userPane" layoutX="215.0" layoutY="-1.0" prefHeight="703.0" prefWidth="820.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="214.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<Text layoutX="94.0" layoutY="72.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Your Profile" AnchorPane.leftAnchor="60.0" AnchorPane.topAnchor="40.0">
|
<Text layoutX="94.0" layoutY="72.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Your Profile" AnchorPane.leftAnchor="60.0" AnchorPane.topAnchor="40.0">
|
||||||
|
|||||||
@@ -47,6 +47,15 @@
|
|||||||
#friendsButton:pressed {
|
#friendsButton:pressed {
|
||||||
-fx-background-color: #b7e2c2;
|
-fx-background-color: #b7e2c2;
|
||||||
}
|
}
|
||||||
|
#logOutButton {
|
||||||
|
-fx-background-color: #5a635c;
|
||||||
|
}
|
||||||
|
#logOutButton:hover {
|
||||||
|
-fx-background-color: #677069;
|
||||||
|
}
|
||||||
|
#logOutButton:pressed {
|
||||||
|
-fx-background-color: #b7e2c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#addNewActivityButton:pressed {
|
#addNewActivityButton:pressed {
|
||||||
|
|||||||
Reference in New Issue
Block a user