summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/in/inf/java2/aufgabe05/MainApplication.java
blob: 7978cb1d2a6108cee46022bcd1a936cd8577b748 (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
package de.fhswf.in.inf.java2.aufgabe05;

import java.io.IOException;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.SplitPane;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class MainApplication extends Application
{

   private Stage primaryStage;
   private BorderPane rootLayout;

   @Override
   public void start(Stage primaryStage)
   {
      this.primaryStage = primaryStage;
      this.primaryStage.setTitle("ThemeChooser");

      initRootLayout();
      
      showDirectoryOverview();
   }

   private void initRootLayout()
   {
      try
      {
         // Load root layout from fxml file.
         FXMLLoader loader = new FXMLLoader();
         loader.setLocation(MainApplication.class.getResource("view/RootLayout.fxml"));
         rootLayout = (BorderPane) loader.load();

         // Show the scene containing the root layout.
         Scene scene = new Scene(rootLayout);
         primaryStage.setScene(scene);

         // Give the controller access to the main app.
         // RootLayoutController controller = loader.getController();
         // controller.setMainApp(this);

         primaryStage.show();
      }
      catch (IOException e)
      {
         e.printStackTrace();
      }
   }
   
   private void showDirectoryOverview()
   {
      try
      {
         // Load person overview.
         FXMLLoader loader = new FXMLLoader();
         loader.setLocation(MainApplication.class
               .getResource("view/DirectoryOverview.fxml"));
         AnchorPane personOverview = (AnchorPane) loader.load();

         // Set person overview into the center of root layout.
         rootLayout.setCenter(personOverview);

         // Give the controller access to the main app.
         // DirectoryOverviewController controller = loader.getController();
         // controller.setMainApp(this);
      }
      catch (IOException e)
      {
         e.printStackTrace();
      }
   }

   public static void main(String[] args)
   {
      launch(args);
   }
}