<commit_before>package netspy.components.gui.components;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JTextArea;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;

/**
 * The Class LogBox.
 */
public class LogBox extends JTextArea {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 9108921515991796683L;

	/** The doc. */
	private Document doc;
	
	/**
	 * Instantiates a new log box.
	 */
	public LogBox() {
		super();
        setEditable(false);
        setPreferredSize(new Dimension(600, 200));
        setBackground(Color.WHITE);
        // TODO: remove
        append("This is the first line!");
        append("Second line alallalallallal!");
	}
	
	@Override
	public void append(String str) {
		str = str + "\n";
        doc = getDocument();
        if (doc != null) {
            try {
                this.doc.insertString(this.doc.getLength(), str, null);
            } catch (BadLocationException e) {
            }
        }
	}
	
	public void clear() {
		setText("");
	}
	/**
	 * Toggle display.
	 */
	public void toggleDisplay() {
		setVisible(!isVisible());
	}

}<commit_msg>added ErrorNotificationPopup for errors with the LogBox, added InfoNotificationPopup when clearing LogBox<commit_after>package netspy.components.gui.components;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JTextArea;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;

import netspy.components.gui.components.popups.ErrorNotificationPopup;
import netspy.components.gui.components.popups.InfoNotificationPopup;

/**
 * The Class LogBox.
 */
public class LogBox extends JTextArea {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 9108921515991796683L;

	/** The doc. */
	private Document doc;
	
	/**
	 * Instantiates a new log box.
	 */
	public LogBox() {
		super();
        setEditable(false);
        setPreferredSize(new Dimension(600, 200));
        setBackground(Color.WHITE);
        // TODO: remove
        append("This is the first line!");
        append("Second line alallalallallal!");
	}
	
	@Override
	public void append(String str) {
		str = str + "\n";
        doc = getDocument();
        if (doc != null) {
            try {
                this.doc.insertString(this.doc.getLength(), str, null);
            } catch (BadLocationException e) {
                new ErrorNotificationPopup("BadLocationException", e.getMessage());
            }
        }
	}
	
	public void clear() {
		setText("");
		new InfoNotificationPopup("", "Reportfenster wurde geleert!");
	}
	/**
	 * Toggle display.
	 */
	// TODO: wollen wir die funktion haben?
	public void toggleDisplay() {
		setVisible(!isVisible());
	}

}
{'fraction_non_alphanumeric': 0.12311557788944724, 'fraction_numerical': 0.017946877243359655, 'mean_word_length': 2.870833333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5893539', 'n_tokens_mistral': 882, 'n_tokens_neox': 822, 'n_words': 203}