<commit_before>/*globals define, WebGMEGlobal*/
/*jshint browser: true*/
/**
 * Generated by VisualizerGenerator 0.1.0 from webgme on Thu Nov 26 2015 06:07:08 GMT-0600 (CST).
 */

define([
    'js/Constants',
    'js/Utils/GMEConcepts',
    './EasyDAGControl.WidgetEventHandlers',
    'js/NodePropertyNames',
    'js/RegistryKeys'
], function (
    CONSTANTS,
    GMEConcepts,
    EasyDAGControlEventHandlers,
    nodePropertyNames,
    REGISTRY_KEYS
) {

    'use strict';

    var WIDGET_NAME = 'EasyDAG';
    var EasyDAGControl = function (options) {

        this._logger = options.logger.fork('Control');

        this._client = options.client;

        // Initialize core collections and variables
        this._widget = options.widget;

        this._selfPatterns = {};
        this._currentNodeId = null;
        this._currentNodeParentId = undefined;

        this._initWidgetEventHandlers();

        this._logger.debug('ctor finished');
    };

    /* * * * * * * * Visualizer content update callbacks * * * * * * * */
    EasyDAGControl.prototype.DEFAULT_DECORATOR = 'EllipseDecorator';
    EasyDAGControl.prototype.TERRITORY_RULE = {children: 0};
    EasyDAGControl.prototype.selectedObjectChanged = function (nodeId) {
        var desc = this._getObjectDescriptor(nodeId),
            self = this;

        self._logger.debug('activeObject nodeId \'' + nodeId + '\'');

        // Remove current territory patterns
        if (self._currentNodeId) {
            self._client.removeUI(self._territoryId);
            delete self._selfPatterns[self._currentNodeId];
        }

        self._currentNodeId = nodeId;
        self._currentNodeParentId = undefined;

        if (self._currentNodeId || self._currentNodeId === CONSTANTS.PROJECT_ROOT_ID) {
            // Put new node's info into territory rules
            self._selfPatterns[nodeId] = this.TERRITORY_RULE;  // Territory "rule"

            self._widget.setTitle(desc.name.toUpperCase());

            if (desc.parentId || desc.parentId === CONSTANTS.PROJECT_ROOT_ID) {
                self.$btnModelHierarchyUp.show();
            } else {
                self.$btnModelHierarchyUp.hide();
            }
<commit_msg>Set default territory rule to 1 child. Fixes #31<commit_after>/*globals define, WebGMEGlobal*/
/*jshint browser: true*/
/**
 * Generated by VisualizerGenerator 0.1.0 from webgme on Thu Nov 26 2015 06:07:08 GMT-0600 (CST).
 */

define([
    'js/Constants',
    'js/Utils/GMEConcepts',
    './EasyDAGControl.WidgetEventHandlers',
    'js/NodePropertyNames',
    'js/RegistryKeys'
], function (
    CONSTANTS,
    GMEConcepts,
    EasyDAGControlEventHandlers,
    nodePropertyNames,
    REGISTRY_KEYS
) {

    'use strict';

    var WIDGET_NAME = 'EasyDAG';
    var EasyDAGControl = function (options) {

        this._logger = options.logger.fork('Control');

        this._client = options.client;

        // Initialize core collections and variables
        this._widget = options.widget;

        this._selfPatterns = {};
        this._currentNodeId = null;
        this._currentNodeParentId = undefined;

        this._initWidgetEventHandlers();

        this._logger.debug('ctor finished');
    };

    /* * * * * * * * Visualizer content update callbacks * * * * * * * */
    EasyDAGControl.prototype.DEFAULT_DECORATOR = 'EllipseDecorator';
    EasyDAGControl.prototype.TERRITORY_RULE = {children: 1};
    EasyDAGControl.prototype.selectedObjectChanged = function (nodeId) {
        var desc = this._getObjectDescriptor(nodeId),
            self = this;

        self._logger.debug('activeObject nodeId \'' + nodeId + '\'');

        // Remove current territory patterns
        if (self._currentNodeId) {
            self._client.removeUI(self._territoryId);
            delete self._selfPatterns[self._currentNodeId];
        }

        self._currentNodeId = nodeId;
        self._currentNodeParentId = undefined;

        if (self._currentNodeId || self._currentNodeId === CONSTANTS.PROJECT_ROOT_ID) {
            // Put new node's info into territory rules
            self._selfPatterns[nodeId] = {children: 0};

            self._widget.setTitle(desc.name.toUpperCase());

            if (desc.parentId || desc.parentId === CONSTANTS.PROJECT_ROOT_ID) {
                self.$btnModelHierarchyUp.show();
            } else {
                self.$btnModelHierarchyUp.hide();
            }

{'fraction_non_alphanumeric': 0.11662870159453304, 'fraction_numerical': 0.010022779043280182, 'mean_word_length': 2.524077046548957, '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': '4759923', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1284, 'n_words': 239}