<commit_before><link rel="import" href="../../behaviors/taaabs-stylesheet.html">

<dom-module id="taaabs-display-model">
<link rel="import" type="css" href="../../bower_components/samotracesjs/dist/samotraces.css"/>
  <template>
    <h2> Show Model </h2>
    <div id="modeldiv"></div>
  </template>

  <script>
    /* global Polymer, Samotraces, TaaabsBehaviors  */

    Polymer({
      is: 'taaabs-display-model',
      behaviors: [
        TaaabsBehaviors.Stylesheet
      ],
      properties: {
        model: {
          type: Object,
          notify: true,
          observer: '_modelSelChanged'
        },
        obselSelector: {
          type: Object,
          reflectToAttribute: true,
          notify: true
        },
        options: {
          type: String,
          notify: true,
          observer: '_optionsChanged'
        }
      },
      _modelSelChanged: function() {
        var that = this;
        if (!this.options){
          this._getStylesheet().then(function(stylesheet) {
            that.options = stylesheet;
            that._attachWidget();
          });
        }
        else {
          that._attachWidget();
        }
      },
      _optionsChanged: function(){

          this._attachWidget();
      },
      _attachWidget: function() {
        if (this.model && this.options) {
        this.$$('#modeldiv').innerHTML="";
        new Samotraces.Ui.Widgets.DisplayModel (this.$$('#modeldiv'), this.model, this.options);
        this.model.on('Model:listeType', (function(){
          setTimeout(this.observObselsType.bind(this), 2000); // TODO check if this bind(this) is useless ?
        }).bind(this));
        }
      },
      observObselsType: function() {
        // this is a NodeList, not an Array, so no forEach
        var obselsNodeList = this.shadowRoot.querySelectorAll('.Samotraces-obsel');
        // forall obsel Node, attach a click handler
        for (var i = 0; i < obselsNodeList.length; i++) {
          var obsel = obselsNodeList[i];
          obsel.onclick = this.handleClick.bind(this);
        }
      },
      handleClick: function(event) {
        var obsel = event.target.__data__;
        this.set('obselSelector', obsel);

      }
    });
  </script>
</dom-module>
<commit_msg>fix bug show obselType after change style<commit_after><link rel="import" href="../../behaviors/taaabs-stylesheet.html">

<dom-module id="taaabs-display-model">
<link rel="import" type="css" href="../../bower_components/samotracesjs/dist/samotraces.css"/>
  <template>
    <h2> Show Model </h2>
    <div id="modeldiv"></div>
  </template>

  <script>
    /* global Polymer, Samotraces, TaaabsBehaviors  */

    Polymer({
      is: 'taaabs-display-model',
      behaviors: [
        TaaabsBehaviors.Stylesheet
      ],
      properties: {
        model: {
          type: Object,
          notify: true,
          observer: '_modelSelChanged'
        },
        obselSelector: {
          type: Object,
          reflectToAttribute: true,
          notify: true
        },
        options: {
          type: String,
          notify: true,
          observer: '_optionsChanged'
        }
      },
      _modelSelChanged: function() {
        var that = this;
        if (!this.options){
          this._getStylesheet().then(function(stylesheet) {
            that.options = stylesheet;
            that._attachWidget();
          });
        }
        else {
          that._attachWidget();
        }
      },
      _optionsChanged: function(){

          this._attachWidget();
          this.observObselsType();
      },
      _attachWidget: function() {
        if (this.model && this.options) {
        this.$$('#modeldiv').innerHTML="";
        new Samotraces.Ui.Widgets.DisplayModel (this.$$('#modeldiv'), this.model, this.options);
        this.model.on('Model:listeType', (function(){
          setTimeout(this.observObselsType.bind(this), 2000); // TODO check if this bind(this) is useless ?
        }).bind(this));
        }
      },
      observObselsType: function() {
        // this is a NodeList, not an Array, so no forEach
        var obselsNodeList = this.shadowRoot.querySelectorAll('.Samotraces-obsel');
        // forall obsel Node, attach a click handler
        for (var i = 0; i < obselsNodeList.length; i++) {
          var obsel = obselsNodeList[i];
          obsel.onclick = this.handleClick.bind(this);
        }
      },
      handleClick: function(event) {
        var obsel = event.target.__data__;
        this.set('obselSelector', obsel);

      }
    });
  </script>
</dom-module>

{'fraction_non_alphanumeric': 0.14025860179706334, 'fraction_numerical': 0.0030681569143107606, 'mean_word_length': 1.9810581319399085, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 27, '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': '1789578', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1345, 'n_words': 269}