<commit_before>package ru.mirea.oop.practice.coursej.starter.jfx;

import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import ru.mirea.oop.practice.coursej.api.ext.BotsExtension;
import ru.mirea.oop.practice.coursej.api.ext.MazeExtension;
import ru.mirea.oop.practice.coursej.starter.jfx.students.Repository;
import ru.mirea.oop.practice.coursej.starter.jfx.students.RepositoryFile;
import ru.mirea.oop.practice.coursej.starter.jfx.students.Student;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;
import java.util.ServiceLoader;

public final class MainApp extends Application {
    private final ObservableList<MazeExtension> mazeExtensions = FXCollections.observableArrayList();
    private final ObservableList<BotsExtension> botsExtensions = FXCollections.observableArrayList();
    private final StackPane main = new StackPane();

    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Курсовые");
        final Scene scene = new Scene(main);
        primaryStage.setScene(scene);
        jbInit();
        updateCourses();
        primaryStage.show();
    }

    private void jbInit() throws FileNotFoundException {
        TabPane tabPane = new TabPane();
        final Tab tabStudents = new Tab("Студенты");
        tabStudents.setClosable(false);
        Repository<Student> repo = new RepositoryFile(new FileInputStream("C:\\GitHub\\2015.2\\.cources.csv"));
        final HashMap<String, String> headers = new HashMap<>();
        Student.createHeaders(headers);
        final TableView<Student> table = createTable(repo, headers);
//        table.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
//            System.out.println(newValue);
//        });
        final ContextMenu contextMenu = new ContextMenu();
        final MenuItem view = new MenuItem("Проверить");
        view.setOnAction(event -> {
            final Student student = table.getSelectionModel().getSelectedItem();
            System.out.println(student);
        });
        contextMenu.getItems().add(view);
        table.setContextMenu(contextMenu);
        final StackPane content = new StackPane();
        content.getChildren().addAll(table);
        tabStudents.setContent(content);

        tabPane.getTabs().add(tabStudents);
//        final Tab tabMazes = new Tab("Лабиринт");
//        tabMazes.setClosable(false);
//        final Tab tabBots = new Tab("Бот");
//        tabBots.setClosable(false);
//        tabPane.getTabs().addAll(tabMazes, tabBots);
//        main.getChildren().clear();
//        final ListView<MazeExtension> listView = new ListView<>(mazeExtensions);
//        listView.setCellFactory(param -> new ListCell<MazeExtension>() {
//            @Override
//            protected void updateItem(MazeExtension Item, boolean empty) {
//                super.updateItem(Item, empty);
//                if (!empty) {
//                    setText(Item.name());
//                    setTooltip(new Tooltip(Item.description()));
//                }
//            }
//        });
//        SplitPane splitPane = new SplitPane();<commit_msg>магия4<commit_after>package ru.mirea.oop.practice.coursej.starter.jfx;

import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import ru.mirea.oop.practice.coursej.api.ext.BotsExtension;
import ru.mirea.oop.practice.coursej.api.ext.MazeExtension;
import ru.mirea.oop.practice.coursej.starter.jfx.students.Repository;
import ru.mirea.oop.practice.coursej.starter.jfx.students.RepositoryFile;
import ru.mirea.oop.practice.coursej.starter.jfx.students.Student;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;
import java.util.ServiceLoader;

public final class MainApp extends Application {
    private final ObservableList<MazeExtension> mazeExtensions = FXCollections.observableArrayList();
    private final ObservableList<BotsExtension> botsExtensions = FXCollections.observableArrayList();
    private final StackPane main = new StackPane();

    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Курсовые");
        final Scene scene = new Scene(main);
        primaryStage.setScene(scene);
        jbInit();
        updateCourses();
        primaryStage.show();
    }

    private void jbInit() throws FileNotFoundException {
        TabPane tabPane = new TabPane();
        final Tab tabStudents = new Tab("Студенты");
        tabStudents.setClosable(false);
        Repository<Student> repo = new RepositoryFile(new FileInputStream("C:\\GitHub\\2015.2\\.cources.csv"));
        final HashMap<String, String> headers = new HashMap<>();
        Student.createHeaders(headers);
        final TableView<Student> table = createTable(repo, headers);
//        table.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
//            System.out.println(newValue);
//        });
        final ContextMenu contextMenu = new ContextMenu();
        final MenuItem view = new MenuItem("Проверить");
        view.setOnAction(event -> {
            final Student student = table.getSelectionModel().getSelectedItem();
            System.out.println(student);
        });
        contextMenu.getItems().add(view);
        table.setContextMenu(contextMenu);
        final StackPane content = new StackPane();
        content.getChildren().addAll(table);
        tabStudents.setContent(content);

        tabPane.getTabs().add(tabStudents);
//        final Tab tabMazes = new Tab("Лабиринт");
//        tabMazes.setClosable(false);
//        final Tab tabBots = new Tab("Бот");
//        tabBots.setClosable(false);
//        tabPane.getTabs().addAll(tabMazes, tabBots);
//        main.getChildren().clear();
//        final ListView<MazeExtension> listView = new ListView<>(mazeExtensions);
//        listView.setCellFactory(param -> new ListCell<MazeExtension>() {
//            @Override
//            protected void updateItem(MazeExtension item, boolean empty) {
//                super.updateItem(item, empty);
//                if (!empty) {
//                    setText(item.name());
//                    setTooltip(new Tooltip(item.description()));
//                }
//            }
//        });
//        SplitPane splitPane = new SplitPane();
{'fraction_non_alphanumeric': 0.12143993060575393, 'fraction_numerical': 0.0015902848055515397, 'mean_word_length': 3.067019400352734, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, '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': '6082021', 'n_tokens_mistral': 1990, 'n_tokens_neox': 1917, 'n_words': 359}