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

foam.CLASS({
  package: 'foam.nanos.pm',
  name: 'PMTableView',
  extends: 'foam.u2.view.TableView',

  documentation: 'TableView for displaying PMInfos.',

  implements: [ 'foam.mlang.Expressions' ],

  requires: [ 'foam.nanos.pm.PMInfo' ],

  exports: [ 'maxTotalTime' ],

  axioms: [
    foam.u2.CSS.create({code: foam.u2.view.TableView.getAxiomsByClass(foam.u2.CSS)[0].code})
  ],

  properties: [
    {
      class: 'Long',
      name: 'maxTotalTime'
    }
  ],

  methods: [
    function initE() {
      this.add(this.CLEAR_ALL);

      this.SUPER();

      this.updateMax();
      this.data.listen({reset: this.updateMax, put: this.updateMax});
    }
  ],

  actions: [
    {
      name: 'clearAll',
      code: function() {
        this.data.removeAll();
      }
    }
  ],

  listeners: [
    {
      name: 'updateMax',
      isFramed: true,
      code: function() {
        var self = this;
        this.data.select(this.MAX(this.PMInfo.TOTALTIME)).then(function(max) {
          self.maxTotalTime = max.value;
        });
      }
    }
  ]
 });

@@ -496,17 +496,254 @@
 %5D.code%7D)
+,%0A    foam.u2.CSS.create(%7Bcode: %60%0A      .foam-comics-BrowserView-foam-nanos-pm-PMInfo .foam-u2-ActionView-create %7B display: none; %7D%0A      .foam-comics-BrowserView-foam-nanos-pm-PMInfo .foam-u2-ActionView-edit   %7B display: none; %7D%0A    %60%7D)
 %0A
-
   %5D,%0A%0A  
@@ -889,16 +889,54 @@
 AR_ALL);
+%0A      this.columns_.push(this.CLEAR);
 %0A%0A      
@@ -1056,16 +1056,16 @@
 %7D%0A  %5D,%0A%0A
-
   action
@@ -1067,32 +1067,134 @@
 ctions: %5B%0A    %7B%0A
+      name: 'clear',%0A      code: function(X) %7B%0A        X.pmInfoDAO.remove(this);%0A      %7D%0A    %7D,%0A    %7B%0A
       name: 'cle

Add 'Clear' button to PMInfoTableView and hide Create and Edit BrowserView buttons.