1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package Launchers;
21
22 import Controllers.AddUserController;
23 import Utilities.LogToFile;
24 import Utilities.Severity;
25 import javafx.fxml.FXMLLoader;
26 import javafx.scene.Scene;
27 import javafx.stage.Modality;
28 import javafx.stage.Stage;
29 import javafx.stage.Window;
30
31 import java.io.IOException;
32
33
34
35
36 public class AddUser extends Window {
37 public AddUser(Window owner) {
38 Stage stage = new Stage();
39 FXMLLoader loader;
40
41 Scene root;
42 try {
43 loader = new FXMLLoader(getClass().getResource("/UI/AddUser.fxml"));
44 root = new Scene(loader.load());
45 AddUserController addUserController = loader.getController();
46 addUserController.initAddUser(this);
47 stage.setScene(root);
48 stage.setTitle("Add User");
49 stage.initModality(Modality.APPLICATION_MODAL);
50 stage.initOwner(owner);
51 stage.showAndWait();
52 } catch (IOException e) {
53 LogToFile.log(e, Severity.SEVERE, "Error loading window. Please retry then reinstall application. If error persists, contact the developers.");
54 }
55 }
56
57 public AddUser(Window window, String userName) {
58 Stage stage = new Stage();
59 FXMLLoader loader;
60
61 Scene root;
62 try {
63 loader = new FXMLLoader(getClass().getResource("/UI/AddUser.fxml"));
64 root = new Scene(loader.load());
65 AddUserController addUserController = loader.getController();
66 addUserController.initAddUser(userName, this);
67 stage.setScene(root);
68 stage.setTitle("Edit User - " + userName);
69 stage.initModality(Modality.APPLICATION_MODAL);
70 stage.initOwner(window);
71 stage.showAndWait();
72 } catch (IOException e) {
73 LogToFile.log(e, Severity.SEVERE, "Error loading window. Please retry then reinstall application. If error persists, contact the developers.");
74 }
75
76 }
77 }