package gui;

import control.TimelineController;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

/**
 * Class that represents the whole of top-level elements in the gui.
 * In other words, the file-edit-view-help menus and any buttons below that.
 */
class RootHeaderArea extends VBox {

    private RootPane rootPane;

    /**
     * RootHeaderArea Constructor.
     * @param rootPane the root pane this pane itself is located in.
     */
    RootHeaderArea(RootPane rootPane) {
        this.rootPane = rootPane;
        // border style to mark it, for debugging for now.
        setStyle("-fx-border-style: solid inside;"
                + "-fx-border-width: 1;");

        getChildren().add(initMenus());

        getChildren().add(initButtons());
        this.setPrefHeight(50);
    }

    /**
     * Initializes top menu (file, edit, etc).
     * @return MenuBar containing menus.
     */
    private MenuBar initMenus() {
        MenuBar topMenuBar = new MenuBar();
        Menu menu1 = new Menu("File");
        Menu menu2 = new Menu("Edit");
        Menu menu3 = new Menu("View");
        Menu menu4 = new Menu("Help");
        topMenuBar.getMenus().addAll(menu1, menu2, menu3, menu4);
        return topMenuBar;
    }

    /**
     * Initializes top button area.
     * @return HBox box containing buttons.
     */
    private HBox initButtons() {
        HBox topButtonBar = new HBox();
        topButtonBar.setSpacing(15);
        topButtonBar.setPadding(new Insets(5, 10, 5, 10));

        Button shotCreation = createShotButton();
        topButtonBar.getChildren().add(shotCreation);
        return topButtonBar;
    }

    /**
     * Create camera shot creation button.
     * TODO: Replace mocked object
     * @return Creation Button.
     */
    private Button createShotButton() {
        Button shotCreation = new Button("Add Camera Shot");

        TimelineController tlController = rootPane.getControllerManager().getTimelineControl();
        shotCreation.setOnMouseClicked(e -> tlController.addCameraShot(1, "BOOM", "", 1, 2));

        return shotCreation;
    }

}
@@ -2058,41 +2058,61 @@
     
-TimelineController tlController =
+shotCreation.setOnMouseClicked(e -%3E %7B%0A               
  roo
@@ -2160,17 +2160,16 @@
 ontrol()
-;
 %0A       
@@ -2173,56 +2173,20 @@
     
-shotCreation.setOnMouseClicked(e -%3E tlController
+            
 .add
@@ -2216,16 +2216,31 @@
 %22, 1, 2)
+;%0A            %7D
 );%0A%0A    

Repair Uninitialized Controller Exception