/**
 * @license
 * Copyright 2018 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'foam.u2.view',
  name: 'StringArrayRowView',
  extends: 'foam.u2.View',

  methods: [
    function initE() {
      this.SUPER();
      var self = this;

      this.
        add(this.data$.map(function(array) { return array.map(function(p, index) {
          var view = self.RowView.create({data: p, index: index});
          view.focus();
          view.data$.sub(function() {
            self.data[index] = view.data;
          });
          return view;
        })})).
        startContext({data: this}).add(this.ADD_ROW).endContext();
    }
  ],

  actions: [
    {
      name: 'addRow',
      label: 'Add',
      code: function(X) { this.data = this.data.concat(''); }
    }
  ],

  classes: [
    {
      name: 'RowView',
      extends: 'foam.u2.Controller',

      properties: [
        {
          class: 'String',
          name: 'data',
          displayWidth: 50
        },
        'index'
      ],

      methods: [
        function initE() {
          this.SUPER();
          this.
            addClass(this.myClass()).
            add(this.DATA).
            tag(this.REMOVE_ROW, {data: this});
        }
      ],

      actions: [
        {
          name: 'removeRow',
          label: 'X',
          speechLabel: 'delete',
          toolTip: 'delete',
          // iconFontName: 'delete_forever',
          code: function(X) {
            var data = foam.util.clone(X.self.data);
            data.splice(this.index, 1);
            X.self.data = data;
          }
        }
      ]
    }
  ]
});

@@ -211,1440 +211,115 @@
 .u2.
-View',%0A%0A  methods: %5B%0A    function initE() %7B%0A      this.SUPER();%0A      var self = this;%0A%0A      this.%0A        add(this.data$.map(function(array) %7B return array.map(function(p, index) %7B%0A          var view = self.RowView.create(%7Bdata: p, index: index%7D);%0A          view.focus();%0A          view.data$.sub(function() %7B%0A            self.data%5Bindex%5D = view.data;%0A          %7D);%0A          return view;%0A        %7D)%7D)).%0A        startContext(%7Bdata: this%7D).add(this.ADD_ROW).endContext();%0A    %7D%0A  %5D,%0A%0A  actions: %5B%0A    %7B%0A      name: 'addRow',%0A      label: 'Add',%0A      code: function(X) %7B this.data = this.data.concat(''); %7D%0A    %7D%0A  %5D,%0A%0A  classes: %5B%0A    %7B%0A      name: 'RowView',%0A      extends: 'foam.u2.Controller',%0A%0A      properties: %5B%0A        %7B%0A          class: 'String',%0A          name: 'data',%0A          displayWidth: 50%0A        %7D,%0A        'index'%0A      %5D,%0A%0A      methods: %5B%0A        function initE() %7B%0A          this.SUPER();%0A          this.%0A            addClass(this.myClass()).%0A            add(this.DATA).%0A            tag(this.REMOVE_ROW, %7Bdata: this%7D);%0A        %7D%0A      %5D,%0A%0A      actions: %5B%0A        %7B%0A          name: 'removeRow',%0A          label: 'X',%0A          speechLabel: 'delete',%0A          toolTip: 'delete',%0A          // iconFontName: 'delete_forever',%0A          code: function(X) %7B%0A            var data = foam.util.clone(X.self.data);%0A            data.splice(this.index, 1);%0A            X.self.data = data;%0A          %7D%0A        %7D%0A      %5D
+view.ArrayView',%0A  properties: %5B%0A    %7B%0A      name: 'valueView',%0A      value: %7B class: 'foam.u2.TextField' %7D
 %0A   
@@ -328,9 +328,8 @@
 %0A  %5D%0A%7D);
-%0A

Make StringArrayRowView use the ArrayView.