<commit_before>/*
 * Copyright (C) 2016 <NAME>
 *
 * This file is distributed under the terms of the
 * GNU General Public License. See the file `LICENSE'
 * in the root directory of the present distribution,
 * or http://www.gnu.org/copyleft/gpl.txt .
 */

package burai.com.periodic;

import javafx.geometry.Pos;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.DialogPane;
import javafx.scene.layout.GridPane;
import burai.app.QEFXMain;
import burai.atoms.element.ElementUtil;

public class PeriodicTable extends Dialog<ElementButton> {

    private GridPane gridPane;

    public PeriodicTable() {
        super();

        DialogPane dialogPane = this.getDialogPane();
        QEFXMain.initializeStyleSheets(dialogPane.getStylesheets());
        QEFXMain.initializeDialogOwner(this);

        this.setResizable(false);
        this.setTitle("Periodic Table");
        dialogPane.setHeaderText("Select an element.");
        dialogPane.getButtonTypes().addAll(ButtonType.CANCEL);

        this.createGridPane();
        dialogPane.setContent(this.gridPane);

        this.setResultConverter(buttonType -> {
            return null;
        });
    }

    private void createGridPane() {
        this.gridPane = new GridPane();
        this.gridPane.setHgap(0.0);
        this.gridPane.setVgap(0.0);
        this.gridPane.setAlignment(Pos.CENTER);

        String[] elementNames = ElementUtil.listAllElements();
        for (String elementName : elementNames) {
            ElementButton elementButton = new ElementButton(elementName);
            elementButton.setDialog(this);
            this.gridPane.add(elementButton, elementButton.getY() - 1, elementButton.getX() - 1);
        }
    }
}<commit_msg>update PeriodicTable<commit_after>/*
 * Copyright (C) 2016 <NAME>
 *
 * This file is distributed under the terms of the
 * GNU General Public License. See the file `LICENSE'
 * in the root directory of the present distribution,
 * or http://www.gnu.org/copyleft/gpl.txt .
 */

package burai.com.periodic;

import java.util.Map;

import burai.app.QEFXMain;
import burai.atoms.element.ElementUtil;
import javafx.geometry.Pos;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.DialogPane;
import javafx.scene.layout.GridPane;

public class PeriodicTable extends Dialog<ElementButton> {

    private GridPane gridPane;

    public PeriodicTable() {
        this(null);
    }

    public PeriodicTable(Map<String, String> styles) {
        super();

        DialogPane dialogPane = this.getDialogPane();
        QEFXMain.initializeStyleSheets(dialogPane.getStylesheets());
        QEFXMain.initializeDialogOwner(this);

        this.setResizable(false);
        this.setTitle("Periodic Table");
        dialogPane.setHeaderText("Select an element.");
        dialogPane.getButtonTypes().addAll(ButtonType.CANCEL);

        this.createGridPane(styles);
        dialogPane.setContent(this.gridPane);

        this.setResultConverter(buttonType -> {
            return null;
        });
    }

    private void createGridPane(Map<String, String> styles) {
        this.gridPane = new GridPane();
        this.gridPane.setHgap(0.0);
        this.gridPane.setVgap(0.0);
        this.gridPane.setAlignment(Pos.CENTER);

        String[] elementNames = ElementUtil.listAllElements();
        for (String elementName : elementNames) {
            ElementButton elementButton = new ElementButton(elementName);
            elementButton.setDialog(this);

            if (styles != null && !styles.isEmpty()) {
                String style = styles.get(elementName);
                if (style != null && !style.isEmpty()) {
                    elementButton.setStyle(style);
                }
            }

            this.gridPane.add(elementButton, elementButton.getY() - 1, elementButton.getX() - 1);
        }
    }
}
{'fraction_non_alphanumeric': 0.11031847133757962, 'fraction_numerical': 0.005095541401273885, 'mean_word_length': 2.871794871794872, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3421350', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1100, 'n_words': 226}