<commit_before>//-----------------------------------------------------------------------//
//                                                                       //
//                    S p i n n e r U t i l i t i e s                    //
//                                                                       //
//  Copyright (C) <NAME> 2000-2006. All rights reserved.          //
//  This software is released under the terms of the GNU General Public  //
//  License. Please contact the author at <EMAIL>      //
//  to report bugs & suggestions.                                        //
//-----------------------------------------------------------------------//
//      $Id$
package omr.ui.field;

import java.awt.event.ActionEvent;
import java.util.List;

import javax.swing.*;

/**
 * Class <code>SpinnerUtilities</code> gathers a few utilities for JSpinner
 * entities
 *
 * @author <NAME>
 * @version $Id$
 */
public class SpinnerUtilities
{
    //~ Methods ----------------------------------------------------------------

    //---------//
    // setList //
    //---------//
    /**
     * Assign the List model (for a list-based spinner)
     *
     * @param spinner the spinner to update
     * @param values the model list values
     */
    public static void setList (JSpinner spinner,
                                List<?>  values)
    {
        SpinnerModel model = spinner.getModel();

        if (model instanceof SpinnerListModel) {
            ((SpinnerListModel) model).setList(values);
        } else {<commit_msg>Added NO_VALUE and the setEditable() method<commit_after>//-----------------------------------------------------------------------//
//                                                                       //
//                    S p i n n e r U t i l i t i e s                    //
//                                                                       //
//  Copyright (C) <NAME> 2000-2006. All rights reserved.          //
//  This software is released under the terms of the GNU General Public  //
//  License. Please contact the author at <EMAIL>      //
//  to report bugs & suggestions.                                        //
//-----------------------------------------------------------------------//
//      $Id$
package omr.ui.field;

import java.awt.event.ActionEvent;
import java.util.List;

import javax.swing.*;

/**
 * Class <code>SpinnerUtilities</code> gathers a few utilities for JSpinner
 * entities
 *
 * @author <NAME>
 * @version $Id$
 */
public class SpinnerUtilities
{
    //~ Static fields/initializers ---------------------------------------------

    /** To indicate that spinner value is invalid */
    public static final int NO_VALUE = 0;

    //~ Methods ----------------------------------------------------------------

    //-------------//
    // setEditable //
    //-------------//
    /**
     * Make the spinner text field editable, or not
     *
     * @param spinner the spinner to update
     * @param bool true if editable, false otherwise
     */
    public static void setEditable (JSpinner spinner,
                                    boolean  bool)
    {
        JSpinner.DefaultEditor editor;
        editor = (JSpinner.DefaultEditor) spinner.getEditor();
        editor.getTextField()
              .setEditable(bool);
    }

    //---------//
    // setList //
    //---------//
    /**
     * Assign the List model (for a list-based spinner)
     *
     * @param spinner the spinner to update
     * @param values the model list values
     */
    public static void setList (JSpinner spinner,
                                List<?>  values)
    {
        SpinnerModel model = spinner.getModel();

        if (model instanceof SpinnerListModel) {
            ((SpinnerListModel) model).setList(values);
        } else {
{'fraction_non_alphanumeric': 0.22713016204913747, 'fraction_numerical': 0.004443282801881861, 'mean_word_length': 0.9485743380855397, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 21, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5704060', 'n_tokens_mistral': 896, 'n_tokens_neox': 867, 'n_words': 281}