View Javadoc
1   /*
2    * Copyright (c) Patrick Magauran 2018.
3    *   Licensed under the AGPLv3. All conditions of said license apply.
4    *       This file is part of ABOS.
5    *
6    *       ABOS is free software: you can redistribute it and/or modify
7    *       it under the terms of the GNU Affero General Public License as published by
8    *       the Free Software Foundation, either version 3 of the License, or
9    *       (at your option) any later version.
10   *
11   *       ABOS is distributed in the hope that it will be useful,
12   *       but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   *       GNU Affero General Public License for more details.
15   *
16   *       You should have received a copy of the GNU Affero General Public License
17   *       along with ABOS.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package Launchers;
21  
22  import Controllers.UsersGroupsAndYearsController;
23  import Exceptions.AccessException;
24  import Utilities.LogToFile;
25  import Utilities.Severity;
26  import javafx.fxml.FXMLLoader;
27  import javafx.scene.Scene;
28  import javafx.stage.Modality;
29  import javafx.stage.Stage;
30  import javafx.stage.Window;
31  
32  import java.io.IOException;
33  
34  public class UsersGroupsAndYears extends Window {
35      public UsersGroupsAndYears(Window owner) {
36          Stage stage = new Stage();
37          FXMLLoader loader;
38  
39          Scene root;
40          try {
41              loader = new FXMLLoader(getClass().getResource("/UI/UsersGroupsAndYears.fxml"));
42              root = new Scene(loader.load());
43              UsersGroupsAndYearsController usersGroupsAndYearsController = loader.getController();
44              usersGroupsAndYearsController.initUsersGroupsAndYears(this);
45              stage.setScene(root);
46              stage.setTitle("Add User");
47              stage.initModality(Modality.APPLICATION_MODAL);
48              stage.initOwner(owner);
49  
50              stage.showAndWait();
51          } catch (IOException e) {
52              LogToFile.log(e, Severity.SEVERE, "Error loading window. Please retry then reinstall application. If error persists, contact the developers.");
53          } catch (AccessException e) {
54              LogToFile.log(e, Severity.WARNING, "You do not have permission to access this window.");
55  
56          }
57      }
58  
59  }