<commit_before>package chess.view.twod.history;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.VBox;


/**
 * Created by Yitzi on 4/20/2016.
 */
public class GameHistory extends VBox {

    private TableView gameHistoryTable = new TableView();

    private final Label headerLabel = new Label("Game History");
    private TableColumn turnNumberCol = new TableColumn("Turn");
    private TableColumn moveCol = new TableColumn("Move");
    private TableColumn detailedDescriptionCol = new TableColumn("Details");

    private final ObservableList<Move> moveHistory = FXCollections.observableArrayList();

    public GameHistory() {
        //set columns to not be sortable
        turnNumberCol.setSortable(false);
        moveCol.setSortable(false);
        detailedDescriptionCol.setSortable(false);

        //set column width
        turnNumberCol.setMinWidth(35);
        moveCol.setMinWidth(35);
        detailedDescriptionCol.setMinWidth(460);
        //set column data sources
        turnNumberCol.setCellValueFactory(new PropertyValueFactory<Move, String>("moveNumber"));
        moveCol.setCellValueFactory(new PropertyValueFactory<Move, String>("algebraicNotation"));
        detailedDescriptionCol.setCellValueFactory(new PropertyValueFactory<Move, String>("details"));

        gameHistoryTable.setMaxHeight(150);
        gameHistoryTable.setEditable(false);
        gameHistoryTable.setPlaceholder(new Label("No moves have been made yet"));
        gameHistoryTable.getColumns().addAll(turnNumberCol, moveCol, detailedDescriptionCol);

        this.setSpacing(5);
        this.setPadding(new Insets(10, 0, 0, 10));
        this.getChildren().addAll(headerLabel, gameHistoryTable);

    }

    public void addMove(int moveNumber, chess.model.Move move) {
        moveHistory.add(new Move(moveNumber + "", move.getAlgebraicNotation(), move.getDetailedDescription()));
        gameHistoryTable.setItems(moveHistory);

    }

}<commit_msg>table autoscrolls to last move<commit_after>package chess.view.twod.history;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.VBox;


/**
 * Created by Yitzi on 4/20/2016.
 */
public class GameHistory extends VBox {

    private TableView gameHistoryTable = new TableView();

    private final Label headerLabel = new Label("Game History");
    private TableColumn turnNumberCol = new TableColumn("Turn");
    private TableColumn moveCol = new TableColumn("Move");
    private TableColumn detailedDescriptionCol = new TableColumn("Details");

    private final ObservableList<Move> moveHistory = FXCollections.observableArrayList();

    public GameHistory() {
        //set columns to not be sortable
        turnNumberCol.setSortable(false);
        moveCol.setSortable(false);
        detailedDescriptionCol.setSortable(false);

        //set column width
        turnNumberCol.setMinWidth(50);
        turnNumberCol.setMaxWidth(50);
        moveCol.setMinWidth(50);
        moveCol.setMaxWidth(50);
        detailedDescriptionCol.setMinWidth(529);

        //set column data sources
        turnNumberCol.setCellValueFactory(new PropertyValueFactory<Move, String>("moveNumber"));
        moveCol.setCellValueFactory(new PropertyValueFactory<Move, String>("algebraicNotation"));
        detailedDescriptionCol.setCellValueFactory(new PropertyValueFactory<Move, String>("details"));

        gameHistoryTable.setMaxHeight(150);
        gameHistoryTable.setMaxWidth(630);
        gameHistoryTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
        gameHistoryTable.setEditable(false);
        gameHistoryTable.setPlaceholder(new Label("No moves have been made yet"));
        gameHistoryTable.getColumns().addAll(turnNumberCol, moveCol, detailedDescriptionCol);
        gameHistoryTable.setItems(moveHistory);

        //this.setSpacing(5);
        //this.setPadding(new Insets(10, 0, 0, 10));
        this.getChildren().addAll(headerLabel, gameHistoryTable);

    }

    public void addMove(int moveNumber, chess.model.Move move) {
        moveHistory.add(new Move(moveNumber + "", move.getAlgebraicNotation(), move.getDetailedDescription()));
        gameHistoryTable.scrollTo(moveHistory.size() - 1);

    }

}
{'fraction_non_alphanumeric': 0.10133843212237094, 'fraction_numerical': 0.011897174421074994, 'mean_word_length': 4.17931793179318, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2969806', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1267, 'n_words': 252}