<commit_before>define([
    "dojo/_base/declare",
    "dojo/_base/array",
    "dojo/dom-class",
    "dojo/dom-geometry",
    "dojo/on",
    "dijit/_WidgetBase",
    "dijit/_TemplatedMixin",
    "dijit/_WidgetsInTemplateMixin",
    "dijit/form/ToggleButton",
    "dijit/CheckedMenuItem",
    "dijit/MenuItem",
    "dijit/Toolbar",
    "dojo/text!./templates/GridConfig.html",
    "dojo/i18n!./nls/eFaps"
], function(declare, array, domClass, domGeom, on, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, ToggleButton,
        CheckedMenuItem, MenuItem, Toolbar, template, eFapsNLS) {

    return declare("efaps.GridConfig", [Toolbar, _WidgetsInTemplateMixin], {
        templateString: template,

        baseClass: "dijitToolbar gridConfig",
        //Labels
        nls: eFapsNLS,
        grid: null,
        printItems: [],
        reload: null,

        startup: function(){
            var t = this;
            t.inherited(arguments);
            t.refresh();
        },

        postCreate: function(){
            var t = this,
                m = t.grid.model,
                hC = t.grid.hiddenColumns;

            t.domNode.setAttribute('tabIndex', t.grid.domNode.getAttribute('tabIndex'));
            t.connect(hC, 'add', 'uncheck');
            t.connect(hC, 'remove', 'check');
        },

        refresh: function() {
            var t = this, g = t.grid,
                dn = t.domNode,
                tm = t.menu,
                hC = g.hiddenColumns,
                tW = t.wrapButton,
                pM = t.printMenu,
                rB = t.reloadButton;

            array.forEach(g.structure, function(col){
                 var item = new CheckedMenuItem({
                     colId: col.id,
                     label: col.name,
                     checked: true,
                     disabled: col.hasOwnProperty('dialog'),
                     onClick: function(e){
                         this.checked ? hC.remove(col.id) : hC.add(col.id);
                     }
                 });
                 this.addChild(item);
             }, tm);

            on(tW, "click", function(evt){
                domClass.toggle(tW.domNode, "dijitDisabled", !tW.checked);
                domClass.toggle(g.bodyNode, "eFapsNoWrap", !tW.checked);
                g.resize();
            });

            array.forEach(t.printItems, function(_item){
                 pM.addChild(_item);
            }, pM);

            rB.onClick = t.reload;<commit_msg>- Issue #114: Add a new GridPage <commit_after>define([
    "dojo/_base/declare",
    "dojo/_base/array",
    "dojo/dom-class",
    "dojo/dom-geometry",
    "dojo/on",
    "dijit/_WidgetBase",
    "dijit/_TemplatedMixin",
    "dijit/_WidgetsInTemplateMixin",
    "dijit/form/ToggleButton",
    "dijit/CheckedMenuItem",
    "dijit/MenuItem",
    "dijit/Toolbar",
    "dojo/text!./templates/GridConfig.html",
    "dojo/i18n!./nls/eFaps"
], function(declare, array, domClass, domGeom, on, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, ToggleButton,
        CheckedMenuItem, MenuItem, Toolbar, template, eFapsNLS) {

    return declare("efaps.GridConfig", [Toolbar, _WidgetsInTemplateMixin], {
        templateString: template,

        baseClass: "dijitToolbar gridConfig",
        //Labels
        nls: eFapsNLS,
        grid: null,
        printItems: [],
        reload: null,

        startup: function(){
            var t = this;
            t.inherited(arguments);
            t.refresh();
        },

        postCreate: function(){
            var t = this,
                m = t.grid.model,
                hC = t.grid.hiddenColumns;

            t.domNode.setAttribute('tabIndex', t.grid.domNode.getAttribute('tabIndex'));
            t.connect(hC, 'add', 'uncheck');
            t.connect(hC, 'remove', 'check');
        },

        refresh: function() {
            var t = this, g = t.grid,
                dn = t.domNode,
                tm = t.menu,
                hC = g.hiddenColumns,
                wB = t.wrapButton,
                pM = t.printMenu,
                rB = t.reloadButton;

            array.forEach(g.structure, function(col){
                 var item = new CheckedMenuItem({
                     colId: col.id,
                     label: col.name,
                     checked: true,
                     disabled: col.hasOwnProperty('dialog'),
                     onClick: function(e){
                         this.checked ? hC.remove(col.id) : hC.add(col.id);
                     }
                 });
                 this.addChild(item);
             }, tm);

            if(g.persist){
                var d = g.persist.registerAndLoad('wrapButton', function(){
                    return wB.checked;
                });
                if (d != null && d != wB.checked) {
                    wB.setChecked(d);
                    domClass.toggle(wB.domNode, "dijitDisabled", !wB.checked);
                    domClass.toggle(g.bodyNode, "eFapsNoWrap", !wB.checked);
                    g.resize();
                }
            }

            on(wB, "click", function(evt){
                domClass.toggle(wB.domNode, "dijitDisabled", !wB.checked);
                domClass.toggle(g.bodyNode, "eFapsNoWrap", !wB.checked);
                g.resize();
            });

            array.forEach(t.printItems, function(_item){
                 pM.addChild(_item);
            }, pM);

            rB.onClick = t.reload;
{'fraction_non_alphanumeric': 0.13020355767467448, 'fraction_numerical': 0.0012836970474967907, 'mean_word_length': 1.4915486523526724, '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': '4497257', 'n_tokens_mistral': 1685, 'n_tokens_neox': 1622, 'n_words': 278}