<commit_before>package de.uni.freiburg.iig.telematik.swat.editor.properties;

import java.awt.Component;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.Enumeration;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Set;

import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.border.Border;
import javax.swing.event.CellEditorListener;
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellEditor;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellEditor;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;

import com.mxgraph.util.mxEventObject;
import com.mxgraph.util.mxEventSource.mxIEventListener;
import com.mxgraph.view.mxGraphSelectionModel;

import de.invation.code.toval.graphic.RestrictedTextField;
import de.invation.code.toval.validate.ParameterException;
import de.invation.code.toval.validate.Validate;
import de.uni.freiburg.iig.telematik.swat.editor.graph.PNGraphCell;
import de.uni.freiburg.iig.telematik.swat.editor.properties.PNProperties.PNComponent;
import de.uni.freiburg.iig.telematik.swat.editor.tree.PNCellEditor;
import de.uni.freiburg.iig.telematik.swat.editor.tree.PNTreeNode;
import de.uni.freiburg.iig.telematik.swat.editor.tree.PNTreeNodeRenderer;
import de.uni.freiburg.iig.telematik.swat.editor.tree.PNTreeNodeType;

public class PropertiesView extends JTree implements PNPropertiesListener, mxIEventListener, TreeSelectionListener, TreeModelListener {


	private static final long serialVersionUID = -23504178961013201L;

	protected PNProperties properties = null;

	private PNTreeNode rootNode;

	private PNTreeNode root;
	private DefaultTreeModel treeModel;

	public PropertiesView(PNProperties properties) throws ParameterException {
		Validate.notNull(properties);
		root = new PNTreeNode("root", PNTreeNodeType.ROOT);
		
		



		addTreeSelectionListener(this);
		
		// expand all nodes in the tree to be visible
		for (int i = 0; i < this.getRowCount(); i++) {
			this.expandRow(i);
		}

		this.properties = properties;
		setUpGUI();

		treeModel = new DefaultTreeModel(root);
		this.setModel(treeModel);
		 setInvokesStopCellEditing(false);
		 getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
		 setRootVisible(false);
		
		 // tree.setInvokesStopCellEditing(false);
		 // Set Editor for Property Fields
		 JTextField textField = new JTextField();
		 textField.setBorder(javax.swing.BorderFactory.createEmptyBorder());
		 PNCellEditor editor = new PNCellEditor(textField);
		 setCellEditor(editor);
		 setEditable(true);
		
		 PNTreeNodeRenderer renderer = new PNTreeNodeRenderer();
		 setCellRenderer(renderer);
		 addTreeSelectionListener(this);
		 getModel().addTreeModelListener(this);
//		 add(new JScrollPane(this), BorderLayout.CENTER);
		
		 // expand all nodes in the tree to be visible
		 for (int i = 0; i < getRowCount(); i++) {
		 expandRow(i);<commit_msg>jtree adjustment to display correctly on mac<commit_after>package de.uni.freiburg.iig.telematik.swat.editor.properties;

import java.awt.Component;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.Enumeration;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Set;

import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.border.Border;
import javax.swing.event.CellEditorListener;
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellEditor;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellEditor;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;

import com.mxgraph.util.mxEventObject;
import com.mxgraph.util.mxEventSource.mxIEventListener;
import com.mxgraph.view.mxGraphSelectionModel;

import de.invation.code.toval.graphic.RestrictedTextField;
import de.invation.code.toval.validate.ParameterException;
import de.invation.code.toval.validate.Validate;
import de.uni.freiburg.iig.telematik.swat.editor.graph.PNGraphCell;
import de.uni.freiburg.iig.telematik.swat.editor.properties.PNProperties.PNComponent;
import de.uni.freiburg.iig.telematik.swat.editor.tree.PNCellEditor;
import de.uni.freiburg.iig.telematik.swat.editor.tree.PNTreeNode;
import de.uni.freiburg.iig.telematik.swat.editor.tree.PNTreeNodeRenderer;
import de.uni.freiburg.iig.telematik.swat.editor.tree.PNTreeNodeType;

public class PropertiesView extends JTree implements PNPropertiesListener, mxIEventListener, TreeSelectionListener, TreeModelListener {


	private static final long serialVersionUID = -23504178961013201L;

	protected PNProperties properties = null;

	private PNTreeNode rootNode;

	private PNTreeNode root;
	private DefaultTreeModel treeModel;

	public PropertiesView(PNProperties properties) throws ParameterException {
		Validate.notNull(properties);
		root = new PNTreeNode("root", PNTreeNodeType.ROOT);
		
		



		addTreeSelectionListener(this);
		
		// expand all nodes in the tree to be visible
		for (int i = 0; i < this.getRowCount(); i++) {
			this.expandRow(i);
		}

		this.properties = properties;
		setUpGUI();

		treeModel = new DefaultTreeModel(root);
		this.setModel(treeModel);
		 setInvokesStopCellEditing(false);
		 getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
		 setRootVisible(false);
		
		 // tree.setInvokesStopCellEditing(false);
		 // Set Editor for Property Fields
		 JTextField textField = new JTextField();
		 textField.setBorder(javax.swing.BorderFactory.createEmptyBorder());
		 PNCellEditor editor = new PNCellEditor(textField);
		 setCellEditor(editor);
		 setEditable(true);
		 setRowHeight(0);
		 PNTreeNodeRenderer renderer = new PNTreeNodeRenderer();
		 setCellRenderer(renderer);
		 addTreeSelectionListener(this);
		 getModel().addTreeModelListener(this);
//		 add(new JScrollPane(this), BorderLayout.CENTER);
		
		 // expand all nodes in the tree to be visible
		 for (int i = 0; i < getRowCount(); i++) {
		 expandRow(i);
{'fraction_non_alphanumeric': 0.10030606566499722, 'fraction_numerical': 0.005425709515859766, 'mean_word_length': 5.782075471698113, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3143174', 'n_tokens_mistral': 2349, 'n_tokens_neox': 2185, 'n_words': 404}