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   * Copyright (c) Patrick Magauran 2018.
22   *   Licensed under the AGPLv3. All conditions of said license apply.
23   *       This file is part of ABOS.
24   *
25   *       ABOS is free software: you can redistribute it and/or modify
26   *       it under the terms of the GNU Affero General Public License as published by
27   *       the Free Software Foundation, either version 3 of the License, or
28   *       (at your option) any later version.
29   *
30   *       ABOS is distributed in the hope that it will be useful,
31   *       but WITHOUT ANY WARRANTY; without even the implied warranty of
32   *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33   *       GNU Affero General Public License for more details.
34   *
35   *       You should have received a copy of the GNU Affero General Public License
36   *       along with ABOS.  If not, see <http://www.gnu.org/licenses/>.
37   */
38  
39  import Controllers.AddYearController;
40  import Utilities.LogToFile;
41  import Utilities.Severity;
42  import javafx.fxml.FXMLLoader;
43  import javafx.scene.Scene;
44  import javafx.stage.Modality;
45  import javafx.stage.Stage;
46  import javafx.stage.Window;
47  
48  import java.io.IOException;
49  
50  /**
51   * Created by patrick on 5/28/17.
52   */
53  public class AddYear extends Window {
54      public AddYear(Window owner) {
55          Stage stage = new Stage();
56          FXMLLoader loader;
57  
58          Scene root;
59          try {
60              loader = new FXMLLoader(getClass().getResource("/UI/AddYear.fxml"));
61              root = new Scene(loader.load());
62              AddYearController addYearController = loader.getController();
63              addYearController.initAddYear(this);
64              stage.setScene(root);
65              stage.setTitle("Reports");
66              stage.initModality(Modality.APPLICATION_MODAL);
67              stage.initOwner(owner);
68              stage.showAndWait();
69          } catch (IOException e) {
70              LogToFile.log(e, Severity.SEVERE, "Error loading window. Please retry then reinstall application. If error persists, contact the developers.");
71          }
72  
73      }
74  
75      public AddYear(String year, Window owner) {
76          Stage stage = new Stage();
77          FXMLLoader loader;
78  
79          Scene root;
80          try {
81              loader = new FXMLLoader(getClass().getResource("/UI/AddYear.fxml"));
82              root = new Scene(loader.load());
83              AddYearController addYearController = loader.getController();
84              addYearController.initAddYear(year, this);
85              stage.setScene(root);
86              stage.setTitle("Reports");
87              stage.initModality(Modality.APPLICATION_MODAL);
88              stage.initOwner(owner);
89              stage.showAndWait();
90          } catch (IOException e) {
91              LogToFile.log(e, Severity.SEVERE, "Error loading window. Please retry then reinstall application. If error persists, contact the developers.");
92          }
93  
94      }
95  }