<commit_before>package nl.mpi.kinnate.ui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import nl.mpi.arbil.LinorgBugCatcher;
import nl.mpi.arbil.LinorgWindowManager;
import nl.mpi.kinnate.SavePanel;
import nl.mpi.kinnate.kintypestrings.KinTerm;
import nl.mpi.kinnate.kintypestrings.KinTermGroup;

/**
 *  Document   : KinTermPanel
 *  Created on : Mar 8, 2011, 12:21:12 PM
 *  Author     : <NAME>
 */
public class KinTermPanel extends JPanel {

    KinTermGroup kinTerms;
    SavePanel savePanel;
    JCheckBox autoGenerateCheckBox;
    JCheckBox showOnGraphCheckBox;
    JComboBox colourSelectBox;
    JPanel outerPanel;
    JTextField addNewKinTerm;
    JTextField addNewKinType;
    String defaultKinType = "";

    public KinTermPanel(SavePanel savePanelLocal, KinTermGroup kinTermsLocal, String defaultKinTypeLocal) {
        kinTerms = kinTermsLocal;
        savePanel = savePanelLocal;
        defaultKinType = defaultKinTypeLocal;
        colourSelectBox = new JComboBox(new String[]{"red", "blue", "#FF0000", "#FFAA00", "#00FF95", "#62D9A7", "#8000FF", "#FF00D4"});
        colourSelectBox.setSelectedItem(kinTerms.graphColour);
        colourSelectBox.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kinTerms.graphColour = colourSelectBox.getSelectedItem().toString();
                savePanel.updateGraph();
            }
        });
        showOnGraphCheckBox = new JCheckBox("Show On Graph");
        autoGenerateCheckBox = new JCheckBox("Generate Example Entities");
        this.setLayout(new BorderLayout());
        outerPanel = new JPanel();
        outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.Y_AXIS));
        populateKinTermList();
        // keep the panel items pushed to the top of the page
        JPanel paddingPanel = new JPanel();
        paddingPanel.setLayout(new BorderLayout());
        paddingPanel.add(outerPanel, BorderLayout.PAGE_START);
        this.add(new JScrollPane(paddingPanel), BorderLayout.CENTER);
    }

    private void populateKinTermList() {
        outerPanel.removeAll();
        outerPanel.add(showOnGraphCheckBox);
        outerPanel.add(colourSelectBox);
        outerPanel.add(autoGenerateCheckBox);
//        this.add(new JLabel("KinTerms"));
        for (KinTerm currentKinTerm : kinTerms.getKinTerms()) {
            JPanel termPanel = new JPanel();
            termPanel.setLayout(new BoxLayout(termPanel, BoxLayout.Y_AXIS));
            JPanel labelPanel = new JPanel();
            labelPanel.setLayout(new BorderLayout());<commit_msg>Added a framework for triangular kin terms and added the kin term groups to the svg storage.<commit_after>package nl.mpi.kinnate.ui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import nl.mpi.arbil.LinorgBugCatcher;
import nl.mpi.arbil.LinorgWindowManager;
import nl.mpi.kinnate.SavePanel;
import nl.mpi.kinnate.kintypestrings.KinTerm;
import nl.mpi.kinnate.kintypestrings.KinTermGroup;

/**
 *  Document   : KinTermPanel
 *  Created on : Mar 8, 2011, 12:21:12 PM
 *  Author     : <NAME>
 */
public class KinTermPanel extends JPanel {

    JTextArea kinTypeGroupName;
    KinTermGroup kinTerms;
    SavePanel savePanel;
    JCheckBox autoGenerateCheckBox;
    JCheckBox showOnGraphCheckBox;
    JComboBox colourSelectBox;
    JPanel outerPanel;
    JTextField addNewKinTerm;
    JTextField addNewKinType;
    String defaultKinType = "";

    public KinTermPanel(SavePanel savePanelLocal, KinTermGroup kinTermsLocal, String defaultKinTypeLocal) {
        kinTerms = kinTermsLocal;
        savePanel = savePanelLocal;
        defaultKinType = defaultKinTypeLocal;
        kinTypeGroupName = new JTextArea(kinTerms.titleString);
        kinTypeGroupName.addKeyListener(new KeyAdapter() {

            @Override
            public void keyReleased(KeyEvent ke) {
                super.keyReleased(ke);
                kinTerms.titleString = ((JTextArea) ke.getComponent()).getText();
                Component parentComponent = KinTermPanel.this.getParent();
                if (parentComponent instanceof JTabbedPane) {
                    ((JTabbedPane) parentComponent).setTitleAt(((JTabbedPane) parentComponent).getSelectedIndex(), kinTerms.titleString);
                }
            }
        });
        colourSelectBox = new JComboBox(new String[]{"red", "blue", "#FF0000", "#FFAA00", "#00FF95", "#62D9A7", "#8000FF", "#FF00D4"});
        colourSelectBox.setSelectedItem(kinTerms.graphColour);
        colourSelectBox.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kinTerms.graphColour = colourSelectBox.getSelectedItem().toString();
                savePanel.updateGraph();
            }
        });
        showOnGraphCheckBox = new JCheckBox("Show On Graph");
        autoGenerateCheckBox = new JCheckBox("Generate Example Entities");
        this.setLayout(new BorderLayout());
        outerPanel = new JPanel();
        outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.Y_AXIS));
        populateKinTermList();
        // keep the panel items pushed to the top of the page
        JPanel paddingPanel = new JPanel();
        paddingPanel.setLayout(new BorderLayout());
        paddingPanel.add(outerPanel, BorderLayout.PAGE_START);
        this.add(new JScrollPane(paddingPanel), BorderLayout.CENTER);
    }

    private void populateKinTermList() {
        outerPanel.removeAll();
        outerPanel.add(kinTypeGroupName);
        outerPanel.add(showOnGraphCheckBox);
        outerPanel.add(colourSelectBox);
        outerPanel.add(autoGenerateCheckBox);
//        this.add(new JLabel("KinTerms"));
        for (KinTerm currentKinTerm : kinTerms.getKinTerms()) {
            JPanel termPanel = new JPanel();
            termPanel.setLayout(new BoxLayout(termPanel, BoxLayout.Y_AXIS));
            JPanel labelPanel = new JPanel();
            labelPanel.setLayout(new BorderLayout());
{'fraction_non_alphanumeric': 0.10048442906574394, 'fraction_numerical': 0.008858131487889274, 'mean_word_length': 3.477075588599752, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2973829', 'n_tokens_mistral': 2203, 'n_tokens_neox': 2096, 'n_words': 425}