<commit_before>/**
 * @license
 * Copyright 2014 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
 

CLASS({
  name: 'DocDiagram',
  package: 'foam.documentation'
});


CLASS({
  name: 'ModelDocDiagram',
  extendsModel: 'diagram.Block',
  traits: ['foam.views.DataConsumerTrait', 
           'foam.views.DataProviderTrait',
           'foam.views.ChildTreeTrait'], // TODO(jacksonic): put child tree trait into CView 
  
  requires: [
    'diagram.Section',
    'diagram.SectionGroup'
  ],
  
  documentation: function() {/*
    A diagram block documenting one $$DOC{ref:'Model'}.
  */},
    
  methods:{
    propagateParentChange: function(old, nu) {
      // clean up children 
      this.destroy();

      // pass data on
      this.SUPER(old,nu);
      
      // re-create children
      this.processModelChange();      
    },
    
    processModelChange: function() { /* Template Method. Override to iterate over features and 
      build sections for them. */
      //TODO(jacksonic): Use featureDAO
      
      // properties
      
      
    }
  }
});




 
 
 
<commit_msg>Refactoring DocDiagram as a trait to line up with HTMLView refactoring in dataviews.js<commit_after>/**
 * @license
 * Copyright 2014 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
 

CLASS({
  name: 'DocDiagramTrait',
  package: 'foam.documentation',
  // enhances BaseDetailView to add diagram support
  
  requires: [
    'diagram.Section',
    'diagram.SectionGroup'
  ],
  
  properties: [
    {
      name: 'diagramItem',
      documentation: "The diagram item we create and are managing.",
      type: 'diagram.Block'
    },
    
  ],
  
  methods:{
    construct: function() {
      // create diagram nodes 
    },
    
    destroy: function() {
    
    }
  }
  
});


CLASS({
  name: 'ModelDocDiagram',
  extendsModel: 'foam.views.BaseDetailView',
  package: 'foam.documentation',
  traits: ['foam.documentation.DocDiagramTrait'], 
  
  
  documentation: function() {/*
    A diagram block documenting one $$DOC{ref:'Model'}.
  */},
    
});




 
 
 

{'fraction_non_alphanumeric': 0.10655216284987278, 'fraction_numerical': 0.005089058524173028, 'mean_word_length': 2.761961722488038, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4296898', 'n_tokens_mistral': 938, 'n_tokens_neox': 887, 'n_words': 304}