-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFirstPageController.java
126 lines (106 loc) · 3.58 KB
/
FirstPageController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package application;
import javafx.stage.*;
import javafx.scene.*;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import java.io.IOException;
public class FirstPageController{
// Stage, Scene, and Logs are passed along between controllers - MJ
private Scene scene;
private Stage stage;
public ProjectDataBase projects;
private PasswordDatabase passData;
private EmployeeDataBase employees;
//Setter for the various databases we need - MJ
public void setPassData(PasswordDatabase dat, EmployeeDataBase emp)
{
passData = dat;
employees = emp;
}
//Setter method to take in the reference to the project database - MJ
public void setProjects(ProjectDataBase projects)
{
this.projects = projects;
}
//Fields for the 3 buttons on the main menu
@FXML
private Button softEng;
@FXML
private Button admin;
@FXML
private Button qa;
//Setter method to pass along reference to the database of logs - MJ
//EventHandler to take the user to the software engineer password verification page - MJ
public void softEngView(ActionEvent event) throws IOException
{
try {
//set stage and scene - MJ
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Password.fxml"));
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(fxmlLoader.load());
stage.setTitle("Input Password");
//set fields in the controller for the next page - MJ
passController control = fxmlLoader.getController();
control.setPassData(passData, employees);
control.setProjects(projects);
SoftwareEngineer user = new SoftwareEngineer();
control.setUser(user);
control.setType('s');
//show the new stage - MJ
stage.setScene(scene);
stage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
//EventHandler to take the user to the administrator password verification page - MJ
public void adminView(ActionEvent event) throws IOException
{
//same logic as softEngView method - MJ
try {
//set stage and scene - MJ
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Password.fxml"));
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(fxmlLoader.load());
stage.setTitle("Input Password");
//set fields in the controller for the next page - MJ
passController control = fxmlLoader.getController();
control.setPassData(passData, employees);
Administrator user = new Administrator();
control.setUser(user);
control.setProjects(projects);
control.setType('a');
//show the new stage - MJ
stage.setScene(scene);
stage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
//EventHandler to take the user to the qa engineer password verification page - MJ
public void qaEngineerView(ActionEvent event) throws IOException
{
//same logic as softEngView method - MJ
try {
//set stage and scene - MJ
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Password.fxml"));
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(fxmlLoader.load());
stage.setTitle("Input Password");
//set fields in the controller for the next page - MJ
passController control = fxmlLoader.getController();
control.setPassData(passData, employees);
QAEngineer user = new QAEngineer();
control.setUser(user);
control.setProjects(projects);
control.setType('q');
//show the new stage - MJ
stage.setScene(scene);
stage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
}