<commit_before>/*jshint bitwise:false, indent:2, curly:true eqeqeq:true, immed:true,
latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
trailing:true white:true*/
/*global XV:true, XM:true, Backbone:true, enyo:true, XT:true */

(function () {

  enyo.kind({
    name: "XV.Workspace",
    kind: "FittableRows",
    published: {
      title: "_none".loc(),
      model: ""
    },
    events: {
      onError: "",
      onStatusChange: "",
      onTitleChange: ""
    },
    handlers: {
      onValueChange: "valueChanged"
    },
    components: [
      {kind: "Panels", name: "topPanel", arrangerKind: "CarouselArranger",
        classes: "xv-top-panel", components: [
        {kind: "onyx.Groupbox", classes: "xv-groupbox", components: [
          {kind: "onyx.GroupboxHeader", content: "_overview".loc()},
          {kind: "XV.InputWidget", name: "name"},
          {kind: "XV.InputWidget", name: "description"}
        ]}
      ]}
    ],
    /**
      Updates all child controls on the workspace where the name of
      the control matches the name of an attribute on the model.

      @param {XM.Model} model
      @param {Object} options
    */
    attributesChanged: function (model, options) {
      options = options || {};
      var attr,
        value,
        K = XM.Model,
        status = model.getStatus(),
        changes = options.changes,
        canNotUpdate = !model.canUpdate() || !(status & K.READY),
        control,
        isReadOnly,
        isRequired;
      for (attr in changes) {
        if (changes.hasOwnProperty(attr)) {
          value = model.get(attr);
          isReadOnly = model.isReadOnly(attr);
          isRequired = model.isRequired(attr);
          control = this.$[attr];
          if (control) {
            if (control.setPlaceholder && isRequired &&
                !control.getPlaceholder()) {
              control.setPlaceholder("_required".loc());
            }
            if (control.setValue) {
              control.setValue(value, {silent: true});
            }
            if (control.setDisabled) {
              control.setDisabled(canNotUpdate || isReadOnly);
            }
          }
        }
      }
    },
    clear: function () {
      var attrs = this._model ? this._model.getAttributeNames() : [],
        attr,
        i;
      for (i = 0; i < attrs.length; i++) {
        attr = attrs[i];
        if (this.$[attr] && this.$[attr].clear) {
          this.$[attr].clear({silent: true});
        }
      }
    },
    create: function () {
      var prop;
      this.inherited(arguments);
      this.titleChanged();
      this.modelChanged();

      // Create a menu for every group box<commit_msg>Don't mess with value when data is processing.<commit_after>/*jshint bitwise:false, indent:2, curly:true eqeqeq:true, immed:true,
latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
trailing:true white:true*/
/*global XV:true, XM:true, Backbone:true, enyo:true, XT:true */

(function () {

  enyo.kind({
    name: "XV.Workspace",
    kind: "FittableRows",
    published: {
      title: "_none".loc(),
      model: ""
    },
    events: {
      onError: "",
      onStatusChange: "",
      onTitleChange: ""
    },
    handlers: {
      onValueChange: "valueChanged"
    },
    components: [
      {kind: "Panels", name: "topPanel", arrangerKind: "CarouselArranger",
        classes: "xv-top-panel", components: [
        {kind: "onyx.Groupbox", classes: "xv-groupbox", components: [
          {kind: "onyx.GroupboxHeader", content: "_overview".loc()},
          {kind: "XV.InputWidget", name: "name"},
          {kind: "XV.InputWidget", name: "description"}
        ]}
      ]}
    ],
    /**
      Updates all child controls on the workspace where the name of
      the control matches the name of an attribute on the model.

      @param {XM.Model} model
      @param {Object} options
    */
    attributesChanged: function (model, options) {
      options = options || {};
      var attr,
        value,
        K = XM.Model,
        status = model.getStatus(),
        changes = options.changes,
        canNotUpdate = !model.canUpdate() || !(status & K.READY),
        control,
        isReadOnly,
        isRequired;
      for (attr in changes) {
        if (changes.hasOwnProperty(attr)) {
          value = model.get(attr);
          isReadOnly = model.isReadOnly(attr);
          isRequired = model.isRequired(attr);
          control = this.$[attr];
          if (control) {
            if (control.setPlaceholder && isRequired &&
                !control.getPlaceholder()) {
              control.setPlaceholder("_required".loc());
            }
            if (control.setValue && !(status & K.BUSY)) {
              control.setValue(value, {silent: true});
            }
            if (control.setDisabled) {
              control.setDisabled(canNotUpdate || isReadOnly);
            }
          }
        }
      }
    },
    clear: function () {
      var attrs = this._model ? this._model.getAttributeNames() : [],
        attr,
        i;
      for (i = 0; i < attrs.length; i++) {
        attr = attrs[i];
        if (this.$[attr] && this.$[attr].clear) {
          this.$[attr].clear({silent: true});
        }
      }
    },
    create: function () {
      var prop;
      this.inherited(arguments);
      this.titleChanged();
      this.modelChanged();

      // Create a menu for every group box
{'fraction_non_alphanumeric': 0.14449583718778908, 'fraction_numerical': 0.0007400555041628122, 'mean_word_length': 2.0167410714285716, 'pattern_counts': {'":': 0, '<': 5, '<?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': '942506', 'n_tokens_mistral': 1624, 'n_tokens_neox': 1619, 'n_words': 364}