<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.diirt.javafx.graphing;

import java.util.ArrayList;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

/**
 * Allows the user to configure the properties of a graph (e.g. the x column of
 * a bubble graph, or the interpolation scheme of a line graph).
 * <p>
 * To create a custom <code>ConfigurationDialog</code>, in the containing class, 
 * list out what properties the user may configure. In most cases, the containing
 * class will be of type <code>BaseGraphApp</code>, and the supported property types are
 * <ul>
 *  <li> String
 *  <li> Boolean
 *  <li> InterpolationScheme (TODO)
 * </ul>
 * 
 * <p>
 * Then, determine what code should execute when each property changes, and create
 * a <code>Runnable</code> for each of these actions. For example,
 * 
 * <p>
 * <pre>
 * <code>
 * Runnable onPropertyChanged = new Runnable() {
 *     public void run() {
 *          //update graph view to reflect this property change
 *     }
 * };
 * </code>
* </pre>
* 
 * <p>
 * Finally, in the containing class, determine the appropriate <code>addProperty()</code>
 * method to add each property to the configuration dialog. For example, to add
 * a string property, we would use
 * 
 * <p>
 * <pre>
 * <code>
 * StringProperty newProperty = new StringProperty( this , "My String Property" , "" );
 * Runnable onStringChanged = new Runnable() {
 *     public void run() {
 *         graph.update( graph.newUpdate().xColumn( newProperty.getValue() );
 *     }
 * };
 * config.add( newProperty , onStringChanged );
 * </code>
 * </pre>
 * <p>
 * Then, the configuration dialog will display the name of the property, "My String Property"
 * in a label, and provide a text field for the user to edit the property.
 * @author mjchao
 */
public class ConfigurationDialog extends Stage {
    
    /**
     * Contains the configuration field in which the user's current configurations
     * for a property are stored, and remembers the last saved configuration for 
     * this property
     * 
     * @param <T> the type of data used for this configuration (e.g. string, boolean)
     */
    private class ConfigurationData< T > {

	final public ConfigurationField< T > field;<commit_msg>Correct ConfigurationDialog documentation<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.diirt.javafx.graphing;

import java.util.ArrayList;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

/**
 * Allows the user to configure the properties of a graph (e.g. the x column of
 * a bubble graph, or the interpolation scheme of a line graph).
 * <p>
 * To create a custom <code>ConfigurationDialog</code>, in the containing class, 
 * list out what properties the user may configure. In most cases, the containing
 * class will be of type <code>BaseGraphApp</code>, and the supported property types are
 * <ul>
 *  <li> String
 *  <li> Boolean
 *  <li> InterpolationScheme (TODO)
 * </ul>
 * 
 * <p>
 * Then, determine what code should execute when each property changes, and create
 * a <code>Runnable</code> for each of these actions. For example,
 * 
 * <p>
 * <pre>
 * <code>
 * Runnable onPropertyChanged = new Runnable() {
 *     public void run() {
 *          //update graph view to reflect this property change
 *     }
 * };
 * </code>
* </pre>
* 
 * <p>
 * Finally, in the containing class, determine the appropriate <code>addProperty()</code>
 * method to add each property to the configuration dialog. For example, to add
 * a string property, we would use
 * 
 * <p>
 * <pre>
 * <code>
 * StringProperty newProperty = new StringProperty( this , "My String Property" , "" );
 * Runnable onStringChanged = new Runnable() {
 *     public void run() {
 *         graph.update( graph.newUpdate().xColumn( newProperty.getValue() );
 *     }
 * };
 * config.addStringProperty( newProperty , onStringChanged );
 * </code>
 * </pre>
 * <p>
 * Then, the configuration dialog will display the name of the property, "My String Property",
 * in a label, and provide a text field for the user to edit the property.
 * 
 * @author mjchao
 */
public class ConfigurationDialog extends Stage {
    
    /**
     * Contains the configuration field in which the user's current configurations
     * for a property are stored, and remembers the last saved configuration for 
     * this property
     * 
     * @param <T> the type of data used for this configuration (e.g. string, boolean)
     */
    private class ConfigurationData< T > {

	final public ConfigurationField< T > field;
{'fraction_non_alphanumeric': 0.10230756817815072, 'fraction_numerical': 0.0, 'mean_word_length': 3.8726415094339623, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 63, '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': '1795841', 'n_tokens_mistral': 1754, 'n_tokens_neox': 1718, 'n_words': 639}