<commit_before>package gui.root;

import gui.headerarea.DetailView;
import gui.headerarea.ToolView;
import javafx.scene.control.MenuItem;

import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import lombok.Getter;

/**
 * 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.
 */
public class RootHeaderArea extends VBox {

    private RootPane rootPane;
    private HBox headerBar;

    @Getter
    private DetailView detailView;

    @Getter
    private ToolView toolView;

    /**
     * RootHeaderArea Constructor.
     * @param rootPane the root pane this pane itself is located in.
     */
    public 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(initHeaderBar());
        this.setPrefHeight(50);
    }

    /**
     * Init the header bar of the RootHeaderArea.
     * @return - the hbox displaying the headerbar
     */
    private HBox initHeaderBar() {
        headerBar = new HBox();

        detailView = new DetailView();

        headerBar.getChildren().add(detailView);
        headerBar.getChildren().add(initButtons());

        return headerBar;
    }

    /**
     * Initializes top menu (file, edit, etc).
     * @return MenuBar containing menus.
     */
    private MenuBar initMenus() {
        
        Menu fileMenu = new Menu("File");
        
        MenuItem newItem = new MenuItem("New");
        fileMenu.getItems().add(newItem);
        newItem.setOnAction(e -> {
                rootPane.getControllerManager().getFileMenuController().newProject();
            });
        
        MenuItem saveItem = new MenuItem("Save");
        fileMenu.getItems().add(saveItem);
        saveItem.setOnAction(e -> {
                rootPane.getControllerManager().getFileMenuController().save();
            });
        
        MenuItem loadItem = new MenuItem("Load");
        fileMenu.getItems().add(loadItem);
        loadItem.setOnAction(e -> {
                rootPane.getControllerManager().getFileMenuController().load();
            });
        
        
        
        Menu editMenu = new Menu("Edit");
        Menu viewMenu = new Menu("View");
        Menu helpMenu = new Menu("Help");

        MenuBar topMenuBar = new MenuBar();
        topMenuBar.setUseSystemMenuBar(true); // giggidy
        topMenuBar.getMenus().addAll(fileMenu, editMenu, viewMenu, helpMenu);
        return topMenuBar;
    }

    /**
     * Initializes top button area.
     * @return HBox box containing buttons.
     */
    private HBox initButtons() {
        this.toolView = new ToolView();
        return this.toolView;
    }
}<commit_msg>"Forgot" to remove useless comment.<commit_after>package gui.root;

import gui.headerarea.DetailView;
import gui.headerarea.ToolView;
import javafx.scene.control.MenuItem;

import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import lombok.Getter;

/**
 * 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.
 */
public class RootHeaderArea extends VBox {

    private RootPane rootPane;
    private HBox headerBar;

    @Getter
    private DetailView detailView;

    @Getter
    private ToolView toolView;

    /**
     * RootHeaderArea Constructor.
     * @param rootPane the root pane this pane itself is located in.
     */
    public 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(initHeaderBar());
        this.setPrefHeight(50);
    }

    /**
     * Init the header bar of the RootHeaderArea.
     * @return - the hbox displaying the headerbar
     */
    private HBox initHeaderBar() {
        headerBar = new HBox();

        detailView = new DetailView();

        headerBar.getChildren().add(detailView);
        headerBar.getChildren().add(initButtons());

        return headerBar;
    }

    /**
     * Initializes top menu (file, edit, etc).
     * @return MenuBar containing menus.
     */
    private MenuBar initMenus() {
        
        Menu fileMenu = new Menu("File");
        
        MenuItem newItem = new MenuItem("New");
        fileMenu.getItems().add(newItem);
        newItem.setOnAction(e -> {
                rootPane.getControllerManager().getFileMenuController().newProject();
            });
        
        MenuItem saveItem = new MenuItem("Save");
        fileMenu.getItems().add(saveItem);
        saveItem.setOnAction(e -> {
                rootPane.getControllerManager().getFileMenuController().save();
            });
        
        MenuItem loadItem = new MenuItem("Load");
        fileMenu.getItems().add(loadItem);
        loadItem.setOnAction(e -> {
                rootPane.getControllerManager().getFileMenuController().load();
            });
        
        Menu editMenu = new Menu("Edit");
        Menu viewMenu = new Menu("View");
        Menu helpMenu = new Menu("Help");

        MenuBar topMenuBar = new MenuBar();
        topMenuBar.setUseSystemMenuBar(true);
        topMenuBar.getMenus().addAll(fileMenu, editMenu, viewMenu, helpMenu);
        return topMenuBar;
    }

    /**
     * Initializes top button area.
     * @return HBox box containing buttons.
     */
    private HBox initButtons() {
        this.toolView = new ToolView();
        return this.toolView;
    }
}
{'fraction_non_alphanumeric': 0.11156118143459916, 'fraction_numerical': 0.0010126582278481013, 'mean_word_length': 2.3329583802024745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2639122', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1640, 'n_words': 401}