<commit_before>package nl.mpi.arbil;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JComboBox;
import javax.swing.text.JTextComponent;

/**
 * Document   : ControlledVocabularyComboBox
 * Created on : Wed Oct 07 11:07:30 CET 2009
 * @author <EMAIL>
 */
public class ControlledVocabularyComboBox extends JComboBox implements KeyListener, ActionListener {

    ImdiField targetField;
    String currentValue;

    public ControlledVocabularyComboBox(ImdiField targetFieldLocal) {
        targetField = targetFieldLocal;
        currentValue = targetFieldLocal.getFieldValue();
        ImdiVocabularies.Vocabulary fieldsVocabulary = targetField.getVocabulary();
        if (null == fieldsVocabulary || null == fieldsVocabulary.findVocabularyItem(targetField.fieldValue)) {
            this.addItem(targetField.fieldValue);
        }
        if (null != fieldsVocabulary) {
            for (ImdiVocabularies.VocabularyItem vocabularyListItem : fieldsVocabulary.getVocabularyItems()) {
                this.addItem(vocabularyListItem.languageName);
            }
        }
        // TODO: enable multiple selection for vocabulary lists
        this.setSelectedItem(targetField.toString());
        this.setEditable(true);//targetField.vocabularyIsOpen);
//        if (targetField.vocabularyIsOpen) {
//            this.getEditor().getEditorComponent().requestFocusInWindow();
//        } else {
//            this.requestFocusInWindow();
//        }
//        this.setBorder(null);
        this.setUI(new javax.swing.plaf.basic.BasicComboBoxUI());
        this.addActionListener(this);
        this.getEditor().getEditorComponent().addKeyListener(this);
    }

    public String getCurrentValue() {
        return currentValue;
    }

    @Override
    public void actionPerformed(ActionEvent actionEvent) {
        // handle item selections<commit_msg>Added a close button to the templates & profiles dialogue. Updated the CMDI schema location and namespace syntax and updated the xpath accordingly. Corrected field paths that replace the use of the 'domid' attributes for saving changes to the dom.<commit_after>package nl.mpi.arbil;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JComboBox;
import javax.swing.text.JTextComponent;

/**
 * Document   : ControlledVocabularyComboBox
 * Created on : Wed Oct 07 11:07:30 CET 2009
 * @author <EMAIL>
 */
public class ControlledVocabularyComboBox extends JComboBox implements KeyListener, ActionListener {

    ImdiField targetField;
    String currentValue;

    public ControlledVocabularyComboBox(ImdiField targetFieldLocal) {
        targetField = targetFieldLocal;
        currentValue = targetFieldLocal.getFieldValue();
        ImdiVocabularies.Vocabulary fieldsVocabulary = targetField.getVocabulary();
        if (null == fieldsVocabulary || null == fieldsVocabulary.findVocabularyItem(targetField.getFieldValue())) {
            this.addItem(targetField.getFieldValue());
        }
        if (null != fieldsVocabulary) {
            for (ImdiVocabularies.VocabularyItem vocabularyListItem : fieldsVocabulary.getVocabularyItems()) {
                this.addItem(vocabularyListItem.languageName);
            }
        }
        // TODO: enable multiple selection for vocabulary lists
        this.setSelectedItem(targetField.toString());
        this.setEditable(true);//targetField.vocabularyIsOpen);
//        if (targetField.vocabularyIsOpen) {
//            this.getEditor().getEditorComponent().requestFocusInWindow();
//        } else {
//            this.requestFocusInWindow();
//        }
//        this.setBorder(null);
        this.setUI(new javax.swing.plaf.basic.BasicComboBoxUI());
        this.addActionListener(this);
        this.getEditor().getEditorComponent().addKeyListener(this);
    }

    public String getCurrentValue() {
        return currentValue;
    }

    @Override
    public void actionPerformed(ActionEvent actionEvent) {
        // handle item selections
{'fraction_non_alphanumeric': 0.09596928982725528, 'fraction_numerical': 0.005758157389635317, 'mean_word_length': 3.2671443193449337, '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': '6433773', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1129, 'n_words': 225}