<commit_before>define(['hbs!templates/graph','../util/events', '../rest/trailGraph', '../util/testData', '../layout/forensicColumnLayout', '../grouping/forensicGroupingManager', '../config/forensic_config', '../util/util'], function(graphTemplate,events,TrailGraphService,testData,ForensicColumnLayout,ForensicGroupingManager,ForensicConfig,_) {


	var DEFAULT_NODE_RADIUS = 20;

	/**
	 *
	 * @param element - the parent DOM element
	 * @param context - the context for the graph view template
	 * @constructor
	 */
	function GraphView(element,context) {
		this._graph = null;
		this._jqCanvas = null;
		this._layouter = null;
		this._activeTrail = null;
		this._browsePathComponents = null;
		this._entitiesComponents = null;
		this._entityValuesMap = null;
		this._relatedLinksComponents = null;
		this._groupingManager = new ForensicGroupingManager();
		this._initialize(element,context);
	}

	/**
	 * Initializes the view.   Creates a canvas context and a initializes a graph in it.
	 * @param element - the parent DOM element
	 * @param context - the context for the graph view template
	 * @private
	 */
	GraphView.prototype._initialize = function(element,context) {
		this._jqCanvas = $(graphTemplate(context));
		this._graph = new GraphJS.Graph()
			.canvas(this._jqCanvas[0])
			.groupingManager(new ForensicGroupingManager())
			.pannable()
			.zoomable()
			.nodeHover(this._onNodeOver,this._onNodeOut)
			.nodeClick(this._onNodeClick,this)
			.fontColour(ForensicConfig.LABEL.FILL_STYLE)
			.fontFamily(ForensicConfig.LABEL.FONT_FAMILY)
			.fontSize(ForensicConfig.LABEL.FONT_HEIGHT)
			.draw();

		this._bindEventHandlers();

		var self = this;
		$(window).resize(function(e) {
			self._onResize(e);
		});
		this._jqCanvas.appendTo(element);
		$(window).resize();
	};

	/**
	 * Ungroups the node on click.
	 * TODO: if this is not a cluster, do something intelligent like open the webpage?   display other info?
	 * @param node
	 * @private
	 */
	GraphView.prototype._onNodeClick = function(node) {
		this._graph.ungroup(node);
	};

	/**
	 * Mouseover event handler.   Adds a label/tooltip
	 * @param node
	 * @private
	 */
	GraphView.prototype._onNodeOver = function(node) {
		this.addLabel(node,node.labelText);
	};

	/**
	 * Node out handler.   Removes the label displayed
	 * @param node
	 * @private
	 */
	GraphView.prototype._onNodeOut = function(node) {
		this.removeLabel(node);
	};

	GraphView.prototype._showLoader = function(duration) {<commit_msg>Open websites in new tab when clicking on them<commit_after>define(['hbs!templates/graph','../util/events', '../rest/trailGraph', '../util/testData', '../layout/forensicColumnLayout', '../grouping/forensicGroupingManager', '../config/forensic_config', '../util/util'], function(graphTemplate,events,TrailGraphService,testData,ForensicColumnLayout,ForensicGroupingManager,ForensicConfig,_) {


	var DEFAULT_NODE_RADIUS = 20;

	/**
	 *
	 * @param element - the parent DOM element
	 * @param context - the context for the graph view template
	 * @constructor
	 */
	function GraphView(element,context) {
		this._graph = null;
		this._jqCanvas = null;
		this._layouter = null;
		this._activeTrail = null;
		this._browsePathComponents = null;
		this._entitiesComponents = null;
		this._entityValuesMap = null;
		this._relatedLinksComponents = null;
		this._groupingManager = new ForensicGroupingManager();
		this._initialize(element,context);
	}

	/**
	 * Initializes the view.   Creates a canvas context and a initializes a graph in it.
	 * @param element - the parent DOM element
	 * @param context - the context for the graph view template
	 * @private
	 */
	GraphView.prototype._initialize = function(element,context) {
		this._jqCanvas = $(graphTemplate(context));
		this._graph = new GraphJS.Graph()
			.canvas(this._jqCanvas[0])
			.groupingManager(new ForensicGroupingManager())
			.pannable()
			.zoomable()
			.nodeHover(this._onNodeOver,this._onNodeOut)
			.nodeClick(this._onNodeClick,this)
			.fontColour(ForensicConfig.LABEL.FILL_STYLE)
			.fontFamily(ForensicConfig.LABEL.FONT_FAMILY)
			.fontSize(ForensicConfig.LABEL.FONT_HEIGHT)
			.draw();

		this._bindEventHandlers();

		var self = this;
		$(window).resize(function(e) {
			self._onResize(e);
		});
		this._jqCanvas.appendTo(element);
		$(window).resize();
	};

	/**
	 * Ungroups the node on click.
	 * TODO: if this is not a cluster, do something intelligent like open the webpage?   display other info?
	 * @param node
	 * @private
	 */
	GraphView.prototype._onNodeClick = function(node) {
		if (node.children) {
			this._graph.ungroup(node);
		} else if (node.type === 'website' || node.type === 'browse_path') {
			var win = window.open(node.value, '_blank');
			win.focus();
		}
	};

	/**
	 * Mouseover event handler.   Adds a label/tooltip
	 * @param node
	 * @private
	 */
	GraphView.prototype._onNodeOver = function(node) {
		this.addLabel(node,node.labelText);
	};

	/**
	 * Node out handler.   Removes the label displayed
	 * @param node
	 * @private
	 */
	GraphView.prototype._onNodeOut = function(node) {
		this.removeLabel(node);
	};

	GraphView.prototype._showLoader = function(duration) {
{'fraction_non_alphanumeric': 0.13424124513618677, 'fraction_numerical': 0.0011673151750972762, 'mean_word_length': 4.07502467917078, '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': '5506004', 'n_tokens_mistral': 1788, 'n_tokens_neox': 1587, 'n_words': 341}