<commit_before>/***************************************************************************
  Title:      GraphBrowser/GraphView.java
  ID:         $Id$
  Author:     <NAME>, T<NAME>
  Copyright   1997  TU Muenchen

  This class defines the window in which the graph is displayed. It
  contains methods for handling events such as collapsing / uncollapsing
  nodes of the graph.
***************************************************************************/

package GraphBrowser;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import awtUtilities.*;

public class GraphView extends Canvas implements MouseListener, MouseMotionListener {
	Graph gra, gra2;
	GraphBrowser browser;
	Vertex v = null;
	Vector collapsed = new Vector(10,10);
	Vector collapsedDirs = new Vector(10,10);
	TreeBrowser tb;
	long timestamp;
	Vertex highlighted = null;
	Dimension size;
	boolean parent_needs_layout;

	public void setTreeBrowser(TreeBrowser br) {
		tb=br;
	}

	public GraphBrowser getBrowser() { return browser; }

	public Graph getGraph() { return gra; }

	public Graph getOriginalGraph() { return gra2; }

	public GraphView(Graph gr,GraphBrowser br) {
		gra2=gr;
		browser=br;
		gra=(Graph)(gra2.clone());
		parent_needs_layout = true;
		size = new Dimension(0, 0);
		addMouseListener(this);
		addMouseMotionListener(this);
	}

	public void PS(String fname,boolean printable) throws IOException {
		gra.PS(fname,printable);
	}

	public void paint(Graphics g) {
		gra.draw(g);
		if (highlighted!=null) highlighted.drawBox(g,Color.white);
		size = new Dimension(gra.max_x-gra.min_x, gra.max_y-gra.min_y);
		if (parent_needs_layout) {
			parent_needs_layout = false;
			getParent().doLayout();
		}
	}

	public Dimension getPreferredSize() {
		return size;
	}

	public void mouseMoved(MouseEvent evt) {
		int x = evt.getX() + gra.min_x;
		int y = evt.getY() + gra.min_y;

		Vertex v2=gra.vertexAt(x,y);
		Graphics g=getGraphics();
		g.translate(-gra.min_x,-gra.min_y);
		if (highlighted!=null) {
			highlighted.drawBox(g,Color.lightGray);
			highlighted=null;
		}
		if (v2!=v) {<commit_msg>PS method now calculates layout using default font metrics.<commit_after>/***************************************************************************
  Title:      GraphBrowser/GraphView.java
  ID:         $Id$
  Author:     <NAME>, <NAME>
  License:    GPL (GNU GENERAL PUBLIC LICENSE)

  This class defines the window in which the graph is displayed. It
  contains methods for handling events such as collapsing / uncollapsing
  nodes of the graph.
***************************************************************************/

package GraphBrowser;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import awtUtilities.*;

public class GraphView extends Canvas implements MouseListener, MouseMotionListener {
	Graph gra, gra2;
	GraphBrowser browser;
	Vertex v = null;
	Vector collapsed = new Vector(10,10);
	Vector collapsedDirs = new Vector(10,10);
	TreeBrowser tb;
	long timestamp;
	Vertex highlighted = null;
	Dimension size;
	boolean parent_needs_layout;

	public void setTreeBrowser(TreeBrowser br) {
		tb=br;
	}

	public GraphBrowser getBrowser() { return browser; }

	public Graph getGraph() { return gra; }

	public Graph getOriginalGraph() { return gra2; }

	public GraphView(Graph gr,GraphBrowser br) {
		gra2=gr;
		browser=br;
		gra=(Graph)(gra2.clone());
		parent_needs_layout = true;
		size = new Dimension(0, 0);
		addMouseListener(this);
		addMouseMotionListener(this);
	}

	public void PS(String fname,boolean printable) throws IOException {
	    Graph gra3 = (Graph)gra.clone();
	    gra3.layout(null);
	    gra3.PS(fname,printable);
	}

	public void paint(Graphics g) {
		gra.draw(g);
		if (highlighted!=null) highlighted.drawBox(g,Color.white);
		size = new Dimension(gra.max_x-gra.min_x, gra.max_y-gra.min_y);
		if (parent_needs_layout) {
			parent_needs_layout = false;
			getParent().doLayout();
		}
	}

	public Dimension getPreferredSize() {
		return size;
	}

	public void mouseMoved(MouseEvent evt) {
		int x = evt.getX() + gra.min_x;
		int y = evt.getY() + gra.min_y;

		Vertex v2=gra.vertexAt(x,y);
		Graphics g=getGraphics();
		g.translate(-gra.min_x,-gra.min_y);
		if (highlighted!=null) {
			highlighted.drawBox(g,Color.lightGray);
			highlighted=null;
		}
		if (v2!=v) {
{'fraction_non_alphanumeric': 0.17694431661297744, 'fraction_numerical': 0.008973768982972849, 'mean_word_length': 4.50253164556962, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4318524', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1357, 'n_words': 358}