<commit_before>/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package net.localizethat.util.gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

/**
 * Class to build JDialogs that can return true or false (like in OK / Cancel)
 * @author rpalomares
 * @param <C> a Component subclass instance, usually a JPanel, that will be displayed as the
 *              content of the Dialog
 * @param <D> a DialogDataObject subclass instance used to transfer data to and from C instance
 */
public class ModalDialog<C extends Component, D extends DialogDataObject> extends JDialog {
    private final C dlgContent;
    private boolean result;
    private D ddo;

    /**
     * Default constructor for ModalDialog. It asks for Component, usually a JPanel with
     * everything that must be displayed inside the JDialog contentPane, including the
     * OK / Cancel buttons (this allows to the caller provide customized buttons)
     * @param owner the JFrame that owns this dialog
     * @param c a Component that will be the displayed content inside the JDialog
     */
    public ModalDialog(JFrame owner, C c) {
        this(owner, c, false);
    }
    
    public ModalDialog(JFrame owner, C c, boolean createOkCancelPanel) {
        super(owner, true);
        dlgContent = c;
        this.getContentPane().setLayout(new BorderLayout());<commit_msg>Synchronize code with LocalizeThat application<commit_after>/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package net.localizethat.util.gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

/**
 * Class to build JDialogs that can return true or false (like in OK / Cancel)
 * @author rpalomares
 * @param <C> a Component subclass instance, usually a JPanel, that will be displayed as the
 *              content of the Dialog
 * @param <D> a DialogDataObject subclass instance used to transfer data to and from C instance
 */
public class ModalDialog<C extends Component, D extends DialogDataObject> extends JDialog {
    private static final long serialVersionUID = 1L;
    private final C dlgContent;
    private boolean result;
    private D ddo;

    /**
     * Default constructor for ModalDialog. It asks for Component, usually a JPanel with
     * everything that must be displayed inside the JDialog contentPane, including the
     * OK / Cancel buttons (this allows to the caller provide customized buttons)
     * @param owner the JFrame that owns this dialog
     * @param c a Component that will be the displayed content inside the JDialog
     */
    public ModalDialog(JFrame owner, C c) {
        this(owner, c, false);
    }
    
    public ModalDialog(JFrame owner, C c, boolean createOkCancelPanel) {
        super(owner, true);
        dlgContent = c;
        this.getContentPane().setLayout(new BorderLayout());
{'fraction_non_alphanumeric': 0.0765840220385675, 'fraction_numerical': 0.0024793388429752068, 'mean_word_length': 3.482716049382716, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4255773', 'n_tokens_mistral': 1007, 'n_tokens_neox': 987, 'n_words': 415}