<commit_before>//----------------------------------------------------------------------------//
//                                                                            //
//                            S c o r e B o a r d                             //
//                                                                            //
//----------------------------------------------------------------------------//
// <editor-fold defaultstate="collapsed" desc="hdr">                          //
//  Copyright (C) <NAME> 2000-2009. All rights reserved.               //
//  This software is released under the GNU General Public License.           //
//  Please contact <EMAIL> to report bugs & suggestions. //
//----------------------------------------------------------------------------//
// </editor-fold>
package omr.score.ui;

import omr.glyph.text.Language;
import omr.glyph.text.tesseract.TesseractOCR;

import omr.log.Logger;

import omr.score.MeasureRange;
import omr.score.Score;
import omr.score.entity.ScorePart;
import omr.score.midi.MidiAbstractions;

import omr.script.ParametersTask;

import omr.selection.UserEvent;

import omr.sheet.Sheet;

import omr.ui.*;
import omr.ui.field.LField;
import omr.ui.field.LIntegerField;
import omr.ui.util.Panel;

import com.jgoodies.forms.builder.*;
import com.jgoodies.forms.layout.*;

import java.awt.event.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.swing.*;

/**
 * Class <code>ScoreBoard</code> is a board that manages score information as
 * both a display and possible input from user (text language, midi parameters,
 * parts name and instrument, measure range selection).
 *
 * @author <NAME>
 * @version $Id$
 */
public class ScoreBoard
    extends Board
{
    //~ Static fields/initializers ---------------------------------------------

    /** Usual logger utility */
    private static final Logger logger = Logger.getLogger(ScoreBoard.class);

    //~ Instance fields --------------------------------------------------------

    /** The related score */
    private final Score score;

    /** Needed for reference from score pane */
    private final MidiPane midiPane;

    /** Collection of individual data panes */
    private final List<Pane> panes = new ArrayList<Pane>();

    /** Related script task */
    private ParametersTask task;

    //~ Constructors -----------------------------------------------------------

    //------------//
    // ScoreBoard //
    //------------//
    /**
     * Create a ScoreBoard
     *
     * @param unitName name of the unit which declares a score board
     * @param score the related score
     */
    public ScoreBoard (String unitName,
                       Score  score)
    {
        super(unitName + "-ScoreBoard", null, null);
        this.score = score;

        // Sequence of Pane instances
        panes.add(new LanguagePane());
        panes.add(midiPane = new MidiPane());
        panes.add(new ScorePane());
        panes.add(new MeasurePane());

        // Layout
        defineLayout();
    }

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

    //--------//
    // commit //
    //--------//
    /**
     * Check the values and commit them if all are OK
     *
     * @param sheet the related sheet
     * @return true if committed, false otherwise
     */
    public boolean commit (Sheet sheet)
    {
        if (dataIsValid()) {
            try {
                task.launch(sheet); // Just launch it
            } catch (Exception ex) {
                logger.warning("Could not run ParametersTask", ex);

                return false;<commit_msg>Use an explicit commit, to carry out actions that are not handled by the ParametersTask<commit_after>//----------------------------------------------------------------------------//
//                                                                            //
//                            S c o r e B o a r d                             //
//                                                                            //
//----------------------------------------------------------------------------//
// <editor-fold defaultstate="collapsed" desc="hdr">                          //
//  Copyright (C) <NAME> 2000-2009. All rights reserved.               //
//  This software is released under the GNU General Public License.           //
//  Please contact <EMAIL> to report bugs & suggestions. //
//----------------------------------------------------------------------------//
// </editor-fold>
package omr.score.ui;

import omr.glyph.text.Language;
import omr.glyph.text.tesseract.TesseractOCR;

import omr.log.Logger;

import omr.score.MeasureRange;
import omr.score.Score;
import omr.score.entity.ScorePart;
import omr.score.midi.MidiAbstractions;

import omr.script.ParametersTask;

import omr.selection.UserEvent;

import omr.sheet.Sheet;

import omr.ui.*;
import omr.ui.field.LField;
import omr.ui.field.LIntegerField;
import omr.ui.util.Panel;

import com.jgoodies.forms.builder.*;
import com.jgoodies.forms.layout.*;

import java.awt.event.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.swing.*;

/**
 * Class <code>ScoreBoard</code> is a board that manages score information as
 * both a display and possible input from user (text language, midi parameters,
 * parts name and instrument, measure range selection).
 *
 * @author <NAME>
 * @version $Id$
 */
public class ScoreBoard
    extends Board
{
    //~ Static fields/initializers ---------------------------------------------

    /** Usual logger utility */
    private static final Logger logger = Logger.getLogger(ScoreBoard.class);

    //~ Instance fields --------------------------------------------------------

    /** The related score */
    private final Score score;

    /** Needed for reference from score pane */
    private final MidiPane midiPane;

    /** Collection of individual data panes */
    private final List<Pane> panes = new ArrayList<Pane>();

    /** Related script task */
    private ParametersTask task;

    //~ Constructors -----------------------------------------------------------

    //------------//
    // ScoreBoard //
    //------------//
    /**
     * Create a ScoreBoard
     *
     * @param unitName name of the unit which declares a score board
     * @param score the related score
     */
    public ScoreBoard (String unitName,
                       Score  score)
    {
        super(unitName + "-ScoreBoard", null, null);
        this.score = score;

        // Sequence of Pane instances
        panes.add(new LanguagePane());
        panes.add(midiPane = new MidiPane());
        panes.add(new ScorePane());
        panes.add(new MeasurePane());

        // Layout
        defineLayout();
    }

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

    //--------//
    // commit //
    //--------//
    /**
     * Check the values and commit them if all are OK
     *
     * @param sheet the related sheet
     * @return true if committed, false otherwise
     */
    public boolean commit (Sheet sheet)
    {
        if (dataIsValid()) {
            try {
                // Just launch the prepared task
                task.launch(sheet);
                // Also carry out the actions not covered by the task
                for (Pane pane : panes) {
                    pane.commit();
                }
            } catch (Exception ex) {
                logger.warning("Could not run ParametersTask", ex);

                return false;
{'fraction_non_alphanumeric': 0.22488912079311243, 'fraction_numerical': 0.0020871380120010435, 'mean_word_length': 1.258321060382916, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2349612', 'n_tokens_mistral': 1867, 'n_tokens_neox': 1801, 'n_words': 556}