/* ////////////////////////////////////////////////////////////////
*
*   In the Name of Allah
*
*   DICTIONARYFORMIDS-CREATOR
*
*   This file is part of DictionaryForMIDs-Creator
*   Copyright (C) 2012 Karim Mahamane Karimou
*   DictionaryForMIDs-Creator is a GUI wrapper around various
*   DictionaryForMIDs tools, among others we have
*   DictdToDictionaryForMIDs, DictionaryGeneration,
*   JarCreator and BitmapFontGenerator.
*
*   DictionaryForMIDs-Creator is free software;
*   you can redistribute it and/or modify it under the terms
*   of the GNU General Public License as published by the
*   Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
*   DictionaryForMIDs-Creator is distributed in the hope that
*   it will be useful, but WITHOUT ANY WARRANTY; without even
*   the implied warranty of MERCHANTABILITY or
*   FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public
*   License along with DictionaryForMIDs-Creator;
*   if not, write to the Free Software Foundation, Inc.,
*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*
* //////////////////////////////////////////////////////////////// */


package de.kugihan.DfMCreator;

import de.kugihan.dictionaryformids.dictdtodictionaryformids.DictdToDfM;
import edu.hws.eck.mdb.I18n;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.event.WindowListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.text.BadLocationException;
import javax.swing.text.StyledDocument;



public class SumWinDictdToDfM extends javax.swing.JDialog implements ActionListener,
                                             WindowListener, PropertyChangeListener {

    private Task task;
    public static boolean done;

    /**
     * Creates new form SumWinDictdToDfM
     */
    public SumWinDictdToDfM() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        SumPanel = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        SumCancelButton = new javax.swing.JButton();
        SumProceedButton = new javax.swing.JButton();
        enqueueButton = new javax.swing.JButton();
        clearQueueBT = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        SummaryTextPane = new javax.swing.JTextPane();
        conversionProgBar = new javax.swing.JProgressBar(0, 100);
        jScrollPane2 = new javax.swing.JScrollPane();
        dictdToDfMQueueTextArea = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setMaximumSize(new java.awt.Dimension(800, 650));
        setMinimumSize(new java.awt.Dimension(795, 595));
        setPreferredSize(new java.awt.Dimension(800, 600));
        addWindowListener(this);
        getContentPane().setLayout(new java.awt.GridBagLayout());

        SumPanel.setLayout(new java.awt.GridBagLayout());

        jPanel1.setLayout(new java.awt.GridBagLayout());

        SumCancelButton.setText(I18n.tr("cancel.dictdConvSummary")); // NOI18N
        SumCancelButton.setEnabled(false);
        SumCancelButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.ipadx = 5;
        gridBagConstraints.ipady = 5;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
        jPanel1.add(SumCancelButton, gridBagConstraints);

        SumProceedButton.setText(I18n.tr("proceed.dictdConvSummary")); // NOI18N
        SumProceedButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.ipadx = 5;
        gridBagConstraints.ipady = 5;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        jPanel1.add(SumProceedButton, gridBagConstraints);

        enqueueButton.setText(I18n.tr("enque.another.dict.to.convert")); // NOI18N
        enqueueButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.ipadx = 5;
        gridBagConstraints.ipady = 5;
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
        jPanel1.add(enqueueButton, gridBagConstraints);

        clearQueueBT.setText(I18n.tr("clear.queue.DictdToDfM")); // NOI18N
        clearQueueBT.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.ipadx = 5;
        gridBagConstraints.ipady = 5;
        gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
        jPanel1.add(clearQueueBT, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        SumPanel.add(jPanel1, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        getContentPane().add(SumPanel, gridBagConstraints);

        SummaryTextPane.setBackground(new java.awt.Color(254, 254, 254));
        SummaryTextPane.setEditable(false);
        jScrollPane1.setViewportView(SummaryTextPane);
        fillDictdConvSummaryTextPane();

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        getContentPane().add(jScrollPane1, gridBagConstraints);

        conversionProgBar.setValue(0);
        conversionProgBar.setStringPainted(true);
        conversionProgBar.setToolTipText("");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.ipady = 10;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        getContentPane().add(conversionProgBar, gridBagConstraints);

        dictdToDfMQueueTextArea.setBackground(new java.awt.Color(232, 232, 232));
        dictdToDfMQueueTextArea.setColumns(20);
        dictdToDfMQueueTextArea.setEditable(false);
        dictdToDfMQueueTextArea.setLineWrap(true);
        dictdToDfMQueueTextArea.setRows(5);
        dictdToDfMQueueTextArea.setWrapStyleWord(true);
        jScrollPane2.setViewportView(dictdToDfMQueueTextArea);
        fillDictdToDfMQueueTA();

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        getContentPane().add(jScrollPane2, gridBagConstraints);

        getAccessibleContext().setAccessibleDescription("");
    }

    // Code for dispatching events from components to event handlers.

    public void actionPerformed(java.awt.event.ActionEvent evt) {
        if (evt.getSource() == SumCancelButton) {
            SumWinDictdToDfM.this.SumCancelButtonActionPerformed(evt);
        }
        else if (evt.getSource() == SumProceedButton) {
            SumWinDictdToDfM.this.SumProceedButtonActionPerformed(evt);
        }
        else if (evt.getSource() == enqueueButton) {
            SumWinDictdToDfM.this.enqueueButtonActionPerformed(evt);
        }
        else if (evt.getSource() == clearQueueBT) {
            SumWinDictdToDfM.this.clearQueueBTActionPerformed(evt);
        }
    }

    public void windowActivated(java.awt.event.WindowEvent evt) {
    }

    public void windowClosed(java.awt.event.WindowEvent evt) {
    }

    public void windowClosing(java.awt.event.WindowEvent evt) {
        if (evt.getSource() == SumWinDictdToDfM.this) {
            SumWinDictdToDfM.this.formWindowClosing(evt);
        }
    }

    public void windowDeactivated(java.awt.event.WindowEvent evt) {
    }

    public void windowDeiconified(java.awt.event.WindowEvent evt) {
    }

    public void windowIconified(java.awt.event.WindowEvent evt) {
    }

    public void windowOpened(java.awt.event.WindowEvent evt) {
    }// </editor-fold>//GEN-END:initComponents

    private void SumCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SumCancelButtonActionPerformed
        // Cancelling the conversion process
        // when the Cancel button is clicked.
        stopConversion();
    }//GEN-LAST:event_SumCancelButtonActionPerformed

    private void SumProceedButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SumProceedButtonActionPerformed
        startConversion();
    }//GEN-LAST:event_SumProceedButtonActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        DfMCreatorMain.dfmCreator.clearDictdToDfMTFs();
        stopConversionOnWinClose();
    }//GEN-LAST:event_formWindowClosing

    private void enqueueButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enqueueButtonActionPerformed
        this.dispose();
        DfMCreatorMain.dfmCreator.clearDictdToDfMTFs();
    }//GEN-LAST:event_enqueueButtonActionPerformed

    private void clearQueueBTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearQueueBTActionPerformed
        clearDictConvQueueContents();
    }//GEN-LAST:event_clearQueueBTActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton SumCancelButton;
    private javax.swing.JPanel SumPanel;
    private javax.swing.JButton SumProceedButton;
    private javax.swing.JTextPane SummaryTextPane;
    private javax.swing.JButton clearQueueBT;
    private javax.swing.JProgressBar conversionProgBar;
    private javax.swing.JTextArea dictdToDfMQueueTextArea;
    private javax.swing.JButton enqueueButton;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    // End of variables declaration//GEN-END:variables

    private static final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

    public static SumWinDictdToDfM getInstance(){
        SumWinDictdToDfM summary = new SumWinDictdToDfM();
        //summary.setSize(800, 600);
        summary.setModal(true);
        summary.setLocation(screenSize.width / 2 - summary.getWidth() / 2,
                          screenSize.height / 2 - summary.getHeight() / 2);
        return summary;
    }

    /**
     * deleteCSVFile() is used to delete the
     * incomplete output csv file if the conversion
     * process is aborted by the user.
     */

    private boolean deleteCSVFile(){
        boolean status;
        File csvFile = new File (DictdToDfM.getOutputCSVFile());
        if (csvFile.exists()) {
            csvFile.delete();
            status = true;
        }
        else {
            status = false;
        }
        return status;
    }

    /*
     * Subroutines that are used to retrieve the
     * conversion preferences summary.
     */

    private final static String newline = "\n";

    private String DBName(){
        return DictdToDfM.getDBName();
    }

    private String DBFolder(){
        return DictdToDfM.getDBFolderName();
    }

    private String CSVFile(){
        return DictdToDfM.getOutputCSVFile();
    }

    private String outputEncoding(){
        return DictdToDfM.getOutputEncodingCharset();
    }

    // This takes the separator character and transcribes it
    // into an english comprehensible word, e.g trancribes
    // \t into Tab-Character...
    private String transcribeSeparatorCharacter(){
        String s = Character.toString(DictdToDfM.getSeparatorCharacter());

        if (DictdToDfM.getSeparatorCharacter() == '\t'){
            return I18n.tr("tab.dictdConvSummary");
        }
        else
            if (DictdToDfM.getSeparatorCharacter() == '\r'){
                return I18n.tr("carRe.dictdConvSummary");
            }
        else
            if (DictdToDfM.getSeparatorCharacter() == '\f'){
                return I18n.tr("formFeed.dictdConvSummary");
            }
        else {
                return s;
             }
    }

    private String switchLanguages(){
        if (DictdToDfM.getSwitchLanguages()){
            return I18n.tr("true.dictdConvSummary");
        }
        else {
            return I18n.tr("false.dictdConvSummary");
        }
    }

    private String keepTabsAndNewlineChars(){
        if (DictdToDfM.getKeepTabAndNewLineChars()){
            return I18n.tr("true.dictdConvSummary");
        }
        else {
            return I18n.tr("false.dictdConvSummary");
        }
    }

    private String removeSquareBracketContents(){
        if (DictdToDfM.getRemoveSquareBrackets()){
            return I18n.tr("true.dictdConvSummary");
        }
        else {
            return I18n.tr("false.dictdConvSummary");
        }
    }

    public void startConversion() {
        executeConversionTask();
    }

    public void stopConversion() {
        confirmCancelConvert();
    }

    public void stopConversionOnWinClose() {
        convCancelledOnQuit();
    }

    public void append(String s) {
        try {
            StyledDocument doc = SummaryTextPane.getStyledDocument();
            doc.insertString(doc.getLength(), s, null);
        } catch(BadLocationException exc) {
        }
    }

    @Override
    public void propertyChange(PropertyChangeEvent evt) {
        if (!done) {
            int progress = task.getProgress();
                if (progress == 0) {
                    conversionProgBar.setStringPainted(false);
                    conversionProgBar.setIndeterminate(true);
                    append(I18n.tr("pleaseWait.dictdConvSummary"));
                }
                else {
                    conversionProgBar.setIndeterminate(false);
                    conversionProgBar.setString(null);
                    conversionProgBar.setValue(progress);
                    append(String.format(newline + newline +
                    I18n.tr("completed.dictdConvSummary"), task.getProgress()));
                }
        }
    }


    /**
     * <pre>class Task extends SwingWorker<Void, Void></pre>
     * SwinWorker class named <i>Task</i> that is used to actually
     * launch the dictionary conversion process in a new thread.<br>
     * In the DictionaryForMIDs-Creator, almost all SwingWorker classes
     * are called <i>Task</i>, however, they do not belong to the same
     * classes and therefore do not do the same things. We could have used
     * just about any valid variable/class name instead of <i>Task</i>.
     */
    class Task extends SwingWorker<Void, Void> {
        @Override
        public Void doInBackground() {
            DfMCreatorMain.DTDFMValsToEnqueue q;
            try {
                    // This is for the queue itself
                    while (!DfMCreatorMain.dfmCreator.dictConvQueue.isEmpty()){
                        q = DfMCreatorMain.dfmCreator.dictConvQueue.remove();
                        // Passing the values of the current item
                        // to DictdToDfM in order for it to convert
                        // this item.
                        DictdToDfM.setDBName(q.db);
                        DictdToDfM.setDBFolderName(q.dbFolder);
                        DictdToDfM.setOutputCSVFile(q.outputCSV);
                        DictdToDfM.setOutputEncodingCharset(q.outputEncoding);
                        DictdToDfM.setSeparatorCharacter(q.separatorChar);
                        DictdToDfM.setSwitchLanguages(q.switchLangs);
                        DictdToDfM.setKeepTabAndNewLineChars(q.keepTabAndNewLines);
                        DictdToDfM.setRemoveSquareBrackets(q.removeSquareBracks);

                        // Showing the conversion preferences
                        // for the current item being processed.
                        SummaryTextPane.setText("");
                        append(I18n.tr("item.being.processed.DictdToDfM") + "\n");
                        append(I18n.tr("remaining.items.DictdToDfM"));
                        append(String.valueOf(DfMCreatorMain.dfmCreator.dictConvQueue.size()) + "\n\n");
                        append(I18n.tr("dbName.dictdConvSummary") + " ");
                        append(" " + q.db + newline + newline);
                        append(I18n.tr("dbDir.dictdConvSummary"));
                        append(" " + q.dbFolder + newline + newline);
                        append(I18n.tr("outputCSVfilePath.dictdConvSummary"));
                        append(" " + q.outputCSV + newline + newline);
                        append(I18n.tr("encoding.dictdConvSummary"));
                        append(" " + q.outputEncoding + newline + newline);

                        append(I18n.tr("separatorCharacter.dictdConvSummary"));
                        append(" " + q.separatorChar + newline + newline);

                        append(I18n.tr("switchLanguages.dictdConvSummary"));
                        append(" " + q.switchLangs + newline);
                        append(I18n.tr("keepTabs.dictdConvSummary"));
                        append(" " + q.keepTabAndNewLines + newline);
                        append(I18n.tr("removeSquares.dictdConvSummary"));
                        append(" " + q.removeSquareBracks + newline);

                        // Perform the conversion
                        DictdToDfM.convert();

                        // Rename the converted dictionary file as follows:
                        // if it's original name was freedict-eng-fra
                        // rename it as freedict-eng-fran-converted.txt
                        String csvfile = DictdToDfM.getOutputCSVFile();
                        String destcsvfile = csvfile + I18n.tr("converted.dictdConvSummary");
                        Path csvpath = Paths.get(csvfile);
                        Path destcsvpath = Paths.get(destcsvfile);
                        try {
                            Files.move(csvpath, destcsvpath, REPLACE_EXISTING);
                        } catch (IOException ex) {
                            System.out.println(ex.getLocalizedMessage());
                        }

                        // Update the contents of the TextArea that displays the items
                        // to be processed as some are being removed from the queue
                        int i = 0;
                        DfMCreatorMain.dfmCreator.dictConvArray.remove(i);
                        dictdToDfMQueueTextArea.setText("");
                        dictdToDfMQueueTextArea.append(I18n.tr("queue.text.area.DictdToDfM") + "\n\n");
                        for (int j=0; j<DfMCreatorMain.dfmCreator.dictConvArray.size(); j++){
                            dictdToDfMQueueTextArea.append(DfMCreatorMain.dfmCreator.dictConvArray.get(j).toString() + "\n");
                        }

                    }

            } catch (ArrayIndexOutOfBoundsException | StringIndexOutOfBoundsException ex) {
                done = true;
                DfMCreatorMain.printAnyMsg(I18n.tr("criticalError.dictdConvSummary"),
                        I18n.tr("internalError.dictdConvSummary"), JOptionPane.ERROR_MESSAGE);
                System.out.println(ex.getLocalizedMessage() + "\n");
            } catch (Throwable t) {
                done = true;
                DfMCreatorMain.printAnyMsg(I18n.tr("unknownRuntimeError.dfmCreatorMain",
                    new Object[] {t, t.getLocalizedMessage()}),
                    I18n.tr("unknownRuntimeErrorTitle"), JOptionPane.ERROR_MESSAGE);
                System.out.println(t + "\n");
            }
            return null;
            }

        @Override
        public void done() {
            //Tell progress listener to stopConversion updating progress bar.
            done = true;
            Toolkit.getDefaultToolkit().beep();
            SumProceedButton.setEnabled(false);
            SumCancelButton.setEnabled(false);
            //clearQueueBT.setEnabled(false);
            setCursor(null); //turn off the wait cursor
            conversionProgBar.setIndeterminate(false);
            conversionProgBar.setValue(conversionProgBar.getMinimum());
            append(I18n.tr("done.dictdConvSummary"));
            dictdToDfMQueueTextArea.append("\n\n" + I18n.tr("conversion.done.DictdToDfM") + "\n");
        }
    }

    /*
     * This method will set some values up and call the conversion task.
     */
    public void executeConversionTask(){
        SumProceedButton.setEnabled(false);
        SumCancelButton.setEnabled(true);
        clearQueueBT.setEnabled(false);
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        done = false;
        task = new Task();
        task.addPropertyChangeListener(this);
        task.execute();
        conversionProgBar.setValue(task.getProgress());
      }


    public void confirmCancelConvert() {
        int n = JOptionPane.showConfirmDialog(this, I18n.tr("sureToCancel.dictdConvSummary"),
                                      I18n.tr("cancelConversion.dictdConvSummary"), JOptionPane.YES_NO_OPTION);
        if (n == JOptionPane.YES_OPTION){
            if (!task.isDone()){
                task.cancel(true);
                deleteCSVFile();
                DfMCreatorMain.dfmCreator.dictConvQueue.clear();
                DfMCreatorMain.dfmCreator.dictConvArray.clear();
            }
        }
    }

    public void convCancelledOnQuit() {
        boolean n = deleteCSVFile();
        if (n == true){
            if (!task.isDone()){
                task.cancel(true);
                DfMCreatorMain.dfmCreator.dictConvQueue.clear();
                DfMCreatorMain.dfmCreator.dictConvArray.clear();
            }
        }
        //this.dispose();
    }


    /**
     * fillDictdConvSummaryTextPane() gets all the needed information
     * and formats them correctly so as to have a clear and neat
     * summary of the DictdToDictionaryForMIDs preferences entered
     * by the user.
     */
    private void fillDictdConvSummaryTextPane() {

        SummaryTextPane.setText("");
        append(I18n.tr("headline.dictdConvSummary"));
        append(" " + newline + newline);

        append(I18n.tr("dbName.dictdConvSummary") + " ");
        append(" " + DBName() + newline + newline);
        append(I18n.tr("dbDir.dictdConvSummary"));
        append(" " + DBFolder() + newline + newline);
        append(I18n.tr("outputCSVfilePath.dictdConvSummary"));
        append(" " + CSVFile() + newline + newline);
        append(I18n.tr("encoding.dictdConvSummary"));
        append(" " + outputEncoding() + newline + newline);

        append(I18n.tr("separatorCharacter.dictdConvSummary"));
        append(" " + transcribeSeparatorCharacter() + newline + newline);

        append(I18n.tr("switchLanguages.dictdConvSummary"));
        append(" " + switchLanguages() + newline);
        append(I18n.tr("keepTabs.dictdConvSummary"));
        append(" " + keepTabsAndNewlineChars() + newline);
        append(I18n.tr("removeSquares.dictdConvSummary"));
        append(" " + removeSquareBracketContents() + newline + newline);

        append(I18n.tr("end.dictdConvSummary"));
        append(newline);
        append(I18n.tr("clickToProceed.dictdConvSummary"));
        append(newline);
    }

    private void fillDictdToDfMQueueTA() {
        dictdToDfMQueueTextArea.setText("");
        dictdToDfMQueueTextArea.append(I18n.tr("queue.text.area.DictdToDfM") + "\n\n");
        for (int i=0; i<DfMCreatorMain.dfmCreator.dictConvArray.size(); i++){
            dictdToDfMQueueTextArea.append(DfMCreatorMain.dfmCreator.dictConvArray.get(i).toString() + "\n");
        }
    }

    private void clearDictConvQueueContents() {
        DfMCreatorMain.dfmCreator.dictConvQueue.clear();
        DfMCreatorMain.dfmCreator.dictConvArray.clear();
        dictdToDfMQueueTextArea.setText("");
        SummaryTextPane.setText("");
        DfMCreatorMain.dfmCreator.clearDictdToDfMTFs();
        DfMCreatorMain.dfmCreator.dictConvArray.clear();
    }


}
