package ui;

import java.io.IOException;

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

public class Main extends Application {

    private Stage primaryStage;
    private Scene scene;
    private BorderPane rootLayout;
    private AnchorPane listLayout;
    // create a private controller variable using the Controller Class

    @Override
    public void start(Stage primaryStage) throws Exception {

        this.primaryStage = primaryStage;
        this.primaryStage.setTitle("JFDI");

        setStageTransparent();
        loadFonts(); // if any
        initRootLayut();
        showView();

    }

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

    /**
     * LEVEL 1 of abstraction
     */

    private void setStageTransparent() {
        this.primaryStage.initStyle(StageStyle.TRANSPARENT);
    }

    private void loadFonts() {
        // Implement when team decides to specific font types that needs to be loaded
        // Font font1 = Font.loadFont(Main.class.getResourceAsStream(
        //                              <filepath e.g."resource/Oxygen regular.ttf">), <size>);
        // Font font2 = Font.loadFont(Main.class.getResourceAsStream(
        //                              <filepath e.g."resource/Oxygen regular.ttf">), <size>);
    }

    private void initRootLayut() throws IOException {

        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(null); // set URL of fxml file
        rootLayout = loader.load();

    }

    private void showView() {
        // Initialize UI
        // Load View
        // Initialize Controller
        // Link Controller with UI and Main
        // Link UI with Controller
    }

    /**
     * LEVEL 2 of abstraction
     */

    /**
     * Get Methods for private variables
     */
    public Stage getPrimaryStage() {
        return this.primaryStage;
    }

    public Scene getScene() {
        return this.scene;
    }

    public BorderPane getRootLayout() {
        return rootLayout;
    }

    public AnchorPane getlistPane() {
        return listLayout;
    }

    // create a get method for private controller
}

@@ -206,24 +206,57 @@
 BorderPane;%0A
+import javafx.scene.paint.Color;%0A
 import javaf
@@ -479,28 +479,16 @@
     
-// create a 
 private 
 cont
@@ -475,33 +475,37 @@
 ut;%0A    private 
-c
+MainC
 ontroller variab
@@ -502,28 +502,9 @@
 ler 
-variable using the C
+c
 ontr
@@ -512,14 +512,9 @@
 ller
- Class
+;
 %0A%0A  
@@ -751,24 +751,25 @@
  initRootLay
+o
 ut();%0A      
@@ -770,20 +770,20 @@
         
-show
+init
 View();%0A
@@ -867,31 +867,58 @@
   %7D%0A%0A    /**
+*************************
 %0A     *
+**
  LEVEL 1 of 
@@ -914,20 +914,17 @@
 LEVEL 1 
-of a
+A
 bstracti
@@ -917,38 +917,68 @@
 EL 1 Abstraction
+ ***
 %0A     
+**************************
 */%0A%0A    private 
@@ -1558,16 +1558,17 @@
 tRootLay
+o
 ut() thr
@@ -1710,16 +1710,29 @@
 Layout =
+ (BorderPane)
  loader.
@@ -1738,16 +1738,249 @@
 .load();
+%0A        %0A        // Display scene with root layout%0A        Scene scene = new Scene(rootLayout);%0A        scene.setFill(Color.TRANSPARENT);%0A        primaryStage.setScene(scene);%0A        primaryStage.show();%0A        this.scene = scene;
 %0A%0A    %7D%0A
@@ -2001,18 +2001,37 @@
 oid 
-show
+init
 View()
+ throws IOException
  %7B%0A 
@@ -2066,145 +2066,823 @@
     
-// Load View%0A        // Initialize Controller%0A        // Link Controller with UI and Main%0A        // Link UI with Controller%0A    %7D%0A%0A    /
+IUserInterface userInterface = new UserInterface();%0A        userInterface.init();%0A        %0A        // Load View%0A        FXMLLoader loader = new FXMLLoader();%0A        loader.setLocation(null); // set URL of fxml file%0A        AnchorPane appView = (AnchorPane) loader.load();%0A        rootLayout.setCenter(appView);%0A        %0A        // Initialize Controller (set up MainController Class first)%0A        controller = loader.getController();%0A        controller.setStage(primaryStage);%0A        %0A        // Link Controller with UI and Main (set up MainController Class first)%0A        controller.setUI(userInterface);%0A        controller.setMainApp(this);%0A        %0A        // Link UI with Controller%0A        userInterface.setController(controller);%0A        userInterface.displayWelcome();%0A    %7D%0A%0A    /*************************
 **%0A 
@@ -2886,16 +2886,18 @@
 *%0A     *
+**
  LEVEL 2
@@ -2901,12 +2901,9 @@
 L 2 
-of a
+A
 bstr
@@ -2908,22 +2908,52 @@
 traction
+ ***
 %0A     
+**************************
 */%0A%0A    
@@ -3202,16 +3202,21 @@
  return 
+this.
 rootLayo
@@ -3279,16 +3279,21 @@
  return 
+this.
 listLayo
@@ -3311,43 +3311,68 @@
     
-// create a get method for private 
+public MainController getController() %7B%0A        return this.
 cont
@@ -3377,11 +3377,18 @@
 ntroller
+;%0A    %7D
 %0A%7D%0A

Update UI components