summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/in/inf/se/projektthemenvergabe/Main.java
blob: 9e9d8d3d86ed38f4b03f0ba496d718f84805a03b (plain)
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
/**
 * 
 */
package de.fhswf.in.inf.se.projektthemenvergabe;

import de.fhswf.in.inf.se.projektthemenvergabe.model.Ansprechpartner;
import de.fhswf.in.inf.se.projektthemenvergabe.model.Organisation;
import de.fhswf.in.inf.se.projektthemenvergabe.view.AnsprechpartnerListeController;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

/**
 * Handles the stages and the data.
 *
 * @author Dina-Marie Hanxleden & Stefan Suhren
 * @version 1.0
 */
public class Main extends Application
{
   private ObservableList<Ansprechpartner> ansprechpartner = FXCollections
         .observableArrayList(Ansprechpartner.extractor());

   private ObservableList<Organisation> organisation = FXCollections
         .observableArrayList(Organisation.extractor());

   private Stage primaryStage;

   /*
    * (non-Javadoc)
    * 
    * @see javafx.application.Application#start(javafx.stage.Stage)
    */
   @Override
   public void start(Stage primaryStage) throws Exception
   {
      this.primaryStage = primaryStage;

      try
      {
         FXMLLoader loader = new FXMLLoader(
               getClass().getResource("view/AnsprechpartnerListe.fxml"));
         BorderPane root = (BorderPane) loader.load();

         Scene scene = new Scene(root);
         primaryStage.setScene(scene);

         AnsprechpartnerListeController controller = loader.getController();
         controller.setMain(this);

         primaryStage.show();
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   }

   /**
    * Getter for property ansprechpartner.
    * 
    * @return Returns the ansprechpartner.
    */
   public ObservableList<Ansprechpartner> getAnsprechpartner()
   {
      return ansprechpartner;
   }

   /**
    * Get the primary {@link Stage} for this application. Can for example be
    * used to set modal.
    *
    * @return The primary stage of the application.
    */
   public Stage getPrimaryStage()
   {
      return primaryStage;
   }

   /**
    * Getter for property organisation.
    * 
    * @return Returns the organisation.
    */
   public ObservableList<Organisation> getOrganisation()
   {
      return organisation;
   }

   /**
    * Launches the JavaFX application.
    *
    * @param args
    *           Command line arguments.
    */
   public static void main(String[] args)
   {
      launch(args);
   }

}