/*
 * WANDORA
 * Knowledge Extraction, Management, and Publishing Application
 * http://wandora.org
 * 
 * Copyright (C) 2004-2023 Wandora Team
 * 
 * This program 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * 
 * PatternEditor.java
 *
 * Created on 2. joulukuuta 2004, 11:49
 */

package org.wandora.application.tools.sqlconsole.gui;



import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

import org.wandora.application.gui.UIConstants;
import org.wandora.application.gui.simple.SimpleFileChooser;
import org.wandora.application.tools.sqlconsole.data.utils.SQLPattern;


/**
 *
 * @author  akivela
 */


public class PatternEditor extends javax.swing.JDialog implements ActionListener {

	private static final long serialVersionUID = 1L;

	public static final String DEFAULT_PATTERN_NAME = "käyttäjän lauseke";
    
    public static Color TEST_ERROR = new Color(255,220,220);
    public static Color TEST_MATCH = new Color(220,255,220);
    public static Color TEST_MISMATCH = new Color(240,220,220);
     
    File currentDirectory;
    Hashtable<String,SQLPattern> patterns;
    public boolean approve;
    Object owner;
    SQLPattern originalPattern;
    int currentColumn;
    
    
    
    
    public PatternEditor() {
        patterns = new Hashtable<>();
        //importPatterns(kirjava.getOptions().get("options.patterns.file"));
        //setIconImage(kirjava.getIconImage());
        owner = null;
        originalPattern = null;
        currentColumn = 0;
        initGui();
        refresh();
    }
    
    
    
    public void initGui() {
        initComponents();
        nameComboBox.setEditable(false);
        //((KirjavaComboBox) nameComboBox).setOptions(patterns.keys()); 
    }
    
        
    public void refresh() {
        /*
        if(kirjava != null) {
            int x = kirjava.getX()+kirjava.getWidth()/2-getWidth()/2;
            x = x > 0 ? x : 0;
            int y = kirjava.getY()+kirjava.getHeight()/2-getHeight()/2;
            y = y > 0 ? y : 0;
            setLocation(x,y);
        }
         */
    }
    
    
    
    public Container getParent() {
        return null;
    }
    
    
    
    
    /** 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.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        java.awt.GridBagConstraints gridBagConstraints;
        javax.swing.JButton testButton;

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        matchCheckBox = new javax.swing.JCheckBox();
        caseSensitivityCheckBox = new javax.swing.JCheckBox();
        andCheckBox = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        nameLabel = new javax.swing.JLabel();
        nameComboBox = new javax.swing.JComboBox();
        patternLabel = new javax.swing.JLabel();
        patternScrollPane = new javax.swing.JScrollPane();
        patternPane = new javax.swing.JTextPane();
        buttonPanel = new javax.swing.JPanel();
        readyButton = new javax.swing.JButton();
        applyButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();
        testPanel = new javax.swing.JPanel();
        testStringLabel = new javax.swing.JLabel();
        testStringScrollPane = new javax.swing.JScrollPane();
        testStringPane = new javax.swing.JTextPane();
        testButtonPanel = new javax.swing.JPanel();
        testButton = new javax.swing.JButton();
        testResultLabel = new javax.swing.JLabel();
        testResultScrollPane = new javax.swing.JScrollPane();
        testResultPane = new javax.swing.JTextPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        sailytaMenuItem = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        loadMenuItem = new javax.swing.JMenuItem();
        saveMenuItem = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        peruutaMenuItem = new javax.swing.JMenuItem();

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

        setTitle("Suodatin Editori");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });

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

        jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 0, 5));

        jPanel2.setPreferredSize(new java.awt.Dimension(400, 30));
        matchCheckBox.setText("Vahva suodatus");
        matchCheckBox.setToolTipText("Sarakkeen arvon pit\u00e4\u00e4 sopia t\u00e4sm\u00e4lleen suodattimeen (Match / Find)");
        matchCheckBox.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jPanel2.add(matchCheckBox);

        caseSensitivityCheckBox.setText("Erota isot ja pienet");
        caseSensitivityCheckBox.setToolTipText("Erota isot ja pienet kirjaimet (Case Sensitive / Case Insensitive)");
        caseSensitivityCheckBox.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jPanel2.add(caseSensitivityCheckBox);

        andCheckBox.setText("Suodattimien leikkaus");
        andCheckBox.setToolTipText("Eri sarakkeissa olevien suodattimien leikkaus (AND / OR)");
        andCheckBox.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jPanel2.add(andCheckBox);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 0;
        jPanel1.add(jPanel2, gridBagConstraints);

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

        nameLabel.setText("Lausekkeen nimi");
        nameLabel.setPreferredSize(new java.awt.Dimension(400, 14));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 0;
        jPanel4.add(nameLabel, gridBagConstraints);

        nameComboBox.setPreferredSize(new java.awt.Dimension(400, 20));
        nameComboBox.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        nameComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboBoxActionPerformed(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 1;
        jPanel4.add(nameComboBox, gridBagConstraints);

        patternLabel.setText("S\u00e4\u00e4nn\u00f6llinen lauseke");
        patternLabel.setPreferredSize(new java.awt.Dimension(400, 14));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 2;
        gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
        jPanel4.add(patternLabel, gridBagConstraints);

        patternScrollPane.setPreferredSize(new java.awt.Dimension(400, 100));
        patternScrollPane.setViewportView(patternPane);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 3;
        jPanel4.add(patternScrollPane, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 1;
        jPanel1.add(jPanel4, gridBagConstraints);

        buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));

        buttonPanel.setPreferredSize(new java.awt.Dimension(400, 33));
        readyButton.setText("Valitse");
        readyButton.addActionListener(this);
        buttonPanel.add(readyButton);

        applyButton.setText("Sovella");
        applyButton.addActionListener(this);
        buttonPanel.add(applyButton);

        cancelButton.setText("Peruuta");
        cancelButton.addActionListener(this);
        buttonPanel.add(cancelButton);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 2;
        jPanel1.add(buttonPanel, gridBagConstraints);

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

        testPanel.setBorder(new javax.swing.border.EtchedBorder());
        testPanel.setPreferredSize(new java.awt.Dimension(384, 210));
        testStringLabel.setText("Testattava merkkijono");
        testStringLabel.setPreferredSize(new java.awt.Dimension(380, 14));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 1;
        gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
        testPanel.add(testStringLabel, gridBagConstraints);

        testStringScrollPane.setPreferredSize(new java.awt.Dimension(380, 50));
        testStringScrollPane.setViewportView(testStringPane);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 2;
        testPanel.add(testStringScrollPane, gridBagConstraints);

        testButtonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));

        testButtonPanel.setPreferredSize(new java.awt.Dimension(380, 33));
        testButton.setText("Testaa");
        testButton.setMargin(new java.awt.Insets(2, 15, 2, 15));
        testButton.addActionListener(this);
        testButtonPanel.add(testButton);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 3;
        testPanel.add(testButtonPanel, gridBagConstraints);

        testResultLabel.setText("Testauksen tulos");
        testResultLabel.setPreferredSize(new java.awt.Dimension(380, 14));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 4;
        gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
        testPanel.add(testResultLabel, gridBagConstraints);

        testResultScrollPane.setPreferredSize(new java.awt.Dimension(380, 70));
        testResultScrollPane.setViewportView(testResultPane);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 5;
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
        testPanel.add(testResultScrollPane, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 3;
        gridBagConstraints.ipadx = 10;
        gridBagConstraints.insets = new java.awt.Insets(15, 0, 0, 0);
        jPanel1.add(testPanel, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.ipadx = 15;
        gridBagConstraints.ipady = 15;
        getContentPane().add(jPanel1, gridBagConstraints);

        jMenu1.setText("Tiedostot");
        sailytaMenuItem.setText("S\u00e4ilyt\u00e4 lauseke...");
        sailytaMenuItem.addActionListener(this);
        jMenu1.add(sailytaMenuItem);

        jMenu1.add(jSeparator1);

        loadMenuItem.setText("Lataa lausekkeet...");
        loadMenuItem.addActionListener(this);
        jMenu1.add(loadMenuItem);

        saveMenuItem.setText("Talleta lausekkeet...");
        saveMenuItem.addActionListener(this);
        jMenu1.add(saveMenuItem);

        jMenu1.add(jSeparator2);

        peruutaMenuItem.setText("Sulje");
        peruutaMenuItem.addActionListener(this);
        jMenu1.add(peruutaMenuItem);

        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        pack();
    }//GEN-END:initComponents

    private void comboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBoxActionPerformed
        selectPattern();
    }//GEN-LAST:event_comboBoxActionPerformed
    
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        tryExit();
    }//GEN-LAST:event_exitForm
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        new PatternEditor().setVisible(true);
    }
    

    
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
        String c = actionEvent.getActionCommand();
        //Logger.println("PatternEditor action command: " +c);
        if("Peruuta".equalsIgnoreCase(c) || "Sulje".equalsIgnoreCase(c)) {
            approve = false;
            if(owner instanceof SQLTablePanel) {
                SQLTablePanel o = (SQLTablePanel) owner;
                o.applyPattern(currentColumn, getCurrentPattern(), andCheckBox.isSelected());
            }
            tryExit();
        }
        else if("Valitse".equalsIgnoreCase(c)) {
            approve = true;
            if(owner instanceof SQLTablePanel) {
                SQLTablePanel o = (SQLTablePanel) owner;
                o.applyPattern(currentColumn, getCurrentPattern(), andCheckBox.isSelected());
            }
            tryExit();
        }
        else if("Sovella".equalsIgnoreCase(c)) {
            approve = true;
            if(owner instanceof SQLTablePanel) {
                SQLTablePanel o = (SQLTablePanel) owner;
                //Logger.println("andCheckBox.isSelected() == " + andCheckBox.isSelected());
                o.applyPattern(currentColumn, getCurrentPattern(), andCheckBox.isSelected());
            }
        }
        else if("S�ilyt� lauseke...".equalsIgnoreCase(c)) {
            savePattern();
        }
        else if("Testaa".equalsIgnoreCase(c)) {
            testPattern();
        }
        else if("Lataa lausekkeet...".equalsIgnoreCase(c)) {
            importPatterns();
        }
        else if("Talleta lausekkeet...".equalsIgnoreCase(c)) {
            exportPatterns();
        }
    }
    
    
    public void tryExit() {
        this.setVisible(false);
    }
    
    
    public void show(Object o, int column, SQLPattern pattern, boolean isAnd) {
        owner = o;
        originalPattern = pattern;
        currentColumn = column;
        approve = false;
        if(pattern != null) {
            String name = pattern.getName();
            if(name == null) name = DEFAULT_PATTERN_NAME;
            if(patterns.size() == 0 || !patterns.containsKey(name)) {
                patterns.put(name, pattern);
                //((KirjavaComboBox) nameComboBox).setOptions(patterns.keys()); 
            }
            nameComboBox.setSelectedItem(name);
            caseSensitivityCheckBox.setSelected(!pattern.isCaseInsensitive());
            matchCheckBox.setSelected(!pattern.findInsteadMatch());
            patternPane.setText(pattern.getPatternString());
        }
        andCheckBox.setSelected(isAnd);
        super.setVisible(true);
    }
    
    
   
    
    
    public boolean findInsteadMatch() {
        if(matchCheckBox.isSelected()) return false;
        else return true;
    }
    
    
    
    // --- HANDLE PATTERNS -----------------------------------------------------
    
    
    public SQLPattern getCurrentPattern() {
        if(approve == true) {
            try { 
                Pattern p = Pattern.compile(patternPane.getText()); // TRYING
                String name = (String) nameComboBox.getSelectedItem();
                if(name == null) name = DEFAULT_PATTERN_NAME;
                return new SQLPattern((String) nameComboBox.getSelectedItem(), patternPane.getText(), !matchCheckBox.isSelected(), !caseSensitivityCheckBox.isSelected()); }
            catch (Exception e) { 
                testResultPane.setBackground(TEST_ERROR);
                testResultPane.setText("Virhe s��nn�llisess� lausekkeessa!\n\n" + e.toString());
                return null; }
        }
        else {
            return originalPattern;
        }
    }
    
    
    
    public void selectPattern() {
        try {
            if(nameComboBox.getSelectedItem() != null) {
                SQLPattern currentPattern = (SQLPattern) patterns.get(nameComboBox.getSelectedItem());
                if(currentPattern != null) {
                    patternPane.setText(currentPattern.getPatternString());
                    matchCheckBox.setSelected(!currentPattern.findInsteadMatch());
                    caseSensitivityCheckBox.setSelected(!currentPattern.isCaseInsensitive());
                }
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    
    
    public void savePattern() {
        String patternNameString=JOptionPane.showInputDialog(this, "Anna säännöllisen lausekkeen nimi", nameComboBox.getSelectedItem());

        String patternString = patternPane.getText();
        if(patternNameString != null && patternNameString.length() > 0) {
            if(patternString != null && patternString.length() > 0) {
                try {
                    Pattern p = Pattern.compile(patternPane.getText()); // TESTING!
                    SQLPattern kp = new SQLPattern(patternNameString, patternPane.getText(), !matchCheckBox.isSelected(), !caseSensitivityCheckBox.isSelected());
                    patterns.put(patternNameString, kp);
                    //((KirjavaComboBox) nameComboBox).setOptions(patterns.keys());
                    nameComboBox.setSelectedItem(patternNameString);
                }
                catch (Exception e) {
                    testResultPane.setBackground(TEST_ERROR);
                    testResultPane.setText("Säilytys epäonnistui! Virhe säännöllisessä lausekkeessa!\n\n" + e.toString());
                }
            }
            else {
                if(patterns.get(patternString) != null) patterns.remove(patternString);
            }
        }
    }
    
    
    
    
    public void testPattern() {
        String patternString = patternPane.getText();
        String testString = testStringPane.getText();
        if(patternString != null && patternString.length() > 0) {
            if(testString != null && testString.length() > 0) {
                try {
                    Pattern pattern = Pattern.compile(patternString);
                    Matcher matcher = pattern.matcher(testString);
                    boolean match = false;
                    if(findInsteadMatch() == true) {
                        match = matcher.find();
                    }
                    else {
                        match = matcher.matches();
                    }
                    if(match) {
                        testResultPane.setBackground(TEST_MATCH);
                        testResultPane.setText("Ok! Testattava merkkijono on säännöllisen lausekkeen mukainen!");
                    }
                    else {
                        testResultPane.setBackground(TEST_MISMATCH);
                        testResultPane.setText("Testattava merkkijono ei ole säännöllisen lausekkeen mukainen!");
                    }
                }
                catch (PatternSyntaxException pse) {
                    testResultPane.setBackground(TEST_ERROR);
                    StringWriter sw = new StringWriter();
                    pse.printStackTrace(new PrintWriter(sw));
                    testResultPane.setBackground(TEST_ERROR);
                    testResultPane.setText("Virhe säännöllisessä lausekkeessa!\n\n" + sw.toString());
                }
                catch (Exception e) {
                    testResultPane.setBackground(TEST_ERROR);
                    StringWriter sw = new StringWriter();
                    e.printStackTrace(new PrintWriter(sw));
                    testResultPane.setText(sw.toString());
                }
            }
            else {
                testResultPane.setBackground(TEST_ERROR);
                testResultPane.setText("Testattava merkkijono on tyhjä!");
            }
        }
        else {
            testResultPane.setBackground(TEST_ERROR);
            testResultPane.setText("Säännöllinen lauseke on tyhjä!");
        }
    }

    
    
    
    // --- IMPORT PATTERNS -----------------------------------------------------
    
    
    public void importPatterns() {
        SimpleFileChooser chooser=UIConstants.getFileChooser();
        chooser.setDialogTitle("Open regular expressions");
        chooser.setApproveButtonText("Open");
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

        if(currentDirectory != null) {
            chooser.setCurrentDirectory(currentDirectory);
        }

        if(chooser.open(this) == SimpleFileChooser.APPROVE_OPTION) {
            importPatterns(chooser.getSelectedFile());
        }
    }
    
    
    
    public void importPatterns(File file) {
        patterns = new Hashtable<>();
        mergePatterns(file);
    }
    
    
    
    public void mergePatterns(File file) {
        if(file != null) {
            patterns = new Hashtable<>();
            try {
                String s = ""; // IObox.loadFile(file);
                parsePatterns(s);
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    
    
    public void importPatterns(String resourceName) {
        patterns = new Hashtable<>();
        mergePatterns(resourceName);
    }
    
    
    public void mergePatterns(String resourceName) {
        if(resourceName != null) {
            try {
                String s = ""; // IObox.loadResource(resourceName);
                parsePatterns(s);
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    
    
    public void parsePatterns(String s) {
        if(s != null) {
            try {
                StringTokenizer lines = new StringTokenizer(s, "\n");
                while(lines.hasMoreTokens()) {
                    String line = lines.nextToken();
                    StringTokenizer parts = new StringTokenizer(line, "\t");
                    if(parts.countTokens()>3) {
                        String name = parts.nextToken();
                        String pattern = parts.nextToken();
                        String findInstead = parts.nextToken();
                        String caseSensitivity = parts.nextToken();
                        if(name != null && name.length() > 0 && pattern != null && pattern.length() > 0) {
                            patterns.put(name, new SQLPattern(name, pattern, "true".equalsIgnoreCase(findInstead), "true".equalsIgnoreCase(caseSensitivity)));
                        }
                    }
                    else {
                        //Logger.println("Rejecting pattern!");
                    }
                }
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    
    // --- EXPORT PATTERNS -----------------------------------------------------
   
    
    
    public void exportPatterns() {
        JFileChooser chooser=new javax.swing.JFileChooser();
        chooser.setDialogTitle("Talletetaan s��nn�lliset lausekkeet");
        chooser.setApproveButtonText("Talleta");
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

        if(currentDirectory != null) {
            chooser.setCurrentDirectory(currentDirectory);
        }

        if(chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
            currentDirectory = chooser.getCurrentDirectory();
            exportPatterns(chooser.getSelectedFile());
        }
    }
    
    
    
    public void exportPatterns(File file) {
        try {
            //IObox.saveFile(file, patterns2String());
        }
        catch (Exception e) {
            //Logger.println(e);
        }
    }
    
    
    
    public String patterns2String() {
        StringBuffer sb = new StringBuffer("");
        String key;
        for(Enumeration<String> keys=patterns.keys(); keys.hasMoreElements();) {
            try {
                key = (String) keys.nextElement();
                SQLPattern kp = (SQLPattern) patterns.get(key);
                sb.append(key + "\t" + kp.getPatternString() + "\t" + kp.findInsteadMatch() + "\t" + kp.isCaseInsensitive());
                sb.append("\n");
            }
            catch (Exception ex) {
                //Logger.println(ex);
            }
        }
        return sb.toString();
    }
    

    
    // -------------------------------------------------------------------------
    
    
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox andCheckBox;
    private javax.swing.JButton applyButton;
    private javax.swing.JPanel buttonPanel;
    private javax.swing.JButton cancelButton;
    private javax.swing.JCheckBox caseSensitivityCheckBox;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JMenuItem loadMenuItem;
    private javax.swing.JCheckBox matchCheckBox;
    private javax.swing.JComboBox nameComboBox;
    private javax.swing.JLabel nameLabel;
    private javax.swing.JLabel patternLabel;
    private javax.swing.JTextPane patternPane;
    private javax.swing.JScrollPane patternScrollPane;
    private javax.swing.JMenuItem peruutaMenuItem;
    private javax.swing.JButton readyButton;
    private javax.swing.JMenuItem sailytaMenuItem;
    private javax.swing.JMenuItem saveMenuItem;
    private javax.swing.JPanel testButtonPanel;
    private javax.swing.JPanel testPanel;
    private javax.swing.JLabel testResultLabel;
    private javax.swing.JTextPane testResultPane;
    private javax.swing.JScrollPane testResultScrollPane;
    private javax.swing.JLabel testStringLabel;
    private javax.swing.JTextPane testStringPane;
    private javax.swing.JScrollPane testStringScrollPane;
    // End of variables declaration//GEN-END:variables
    
}
