vcpanel added

Change-Id: Ieb731a6385ba8fd27540c94962f3729b9f0697b6
diff --git a/dev/js/src/panel/vcpanel.js b/dev/js/src/panel/vcpanel.js
new file mode 100644
index 0000000..98a9b4b
--- /dev/null
+++ b/dev/js/src/panel/vcpanel.js
@@ -0,0 +1,52 @@
+/**
+ * The vc info panel
+ * 
+ * The vc info panel displays information about the virtual corpus, 
+ * for example the corpus statistic
+ * 
+ * @author Helge Stallkamp
+ */
+
+define([
+  'panel',
+  'view/corpstatv'
+], function (panelClass, corpStatVClass) {
+  
+  const d = document;
+
+  // Localization values
+  const loc = KorAP.Locale;
+  loc.SHOW_STAT= loc.SHOW_STAT || 'Statistics';
+  loc.VERB_SHOWSTAT = loc.VERB_SHOWSTAT    || 'Corpus Statistics';
+  
+  return {
+    create : function (vc) {
+      return Object.create(panelClass)._init(['vcinfo']).upgradeTo(this)._init(vc);
+    }, 
+    
+    _init : function(vc){
+     this.vc = vc;
+     var actions = this.actions;
+     var that = this;
+     actions.add(loc.SHOW_STAT, [ 'statistic' ], function() {
+       that.addCorpStat();
+      });
+     
+      return this;
+    },
+    
+
+    /**
+     * Add corpus statistic view to panel
+     */
+    addCorpStat: function(){
+      if (this.statView === undefined || !this.statView.shown()) {
+        this.statView = corpStatVClass.create(this.vc, this);
+        this.add(this.statView);
+      }
+
+    },
+    
+    
+  }
+});
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index 7494cdf..711008f 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -53,7 +53,7 @@
   'vc/statistic',
   'datepicker',
   'buttongroup',
-  'panel',
+  'panel/vcpanel',
   'view/corpstatv',
   'buttongroup',
   'util'
@@ -66,7 +66,7 @@
   statClass,
   dpClass,
   buttonGrClass,
-  panelClass,
+  vcPanelClass,
   corpStatVClass,
   buttonGroupClass) {
   "use strict";
@@ -81,8 +81,6 @@
   // KorAP._validDateMatchRE is defined in datepicker.js!
 
   const loc = KorAP.Locale;
-  loc.SHOW_STAT        = loc.SHOW_STAT        || 'Statistics';
-  loc.VERB_SHOWSTAT    = loc.VERB_SHOWSTAT    || 'Corpus Statistics';
   loc.VC_allCorpora    = loc.VC_allCorpora    || 'all corpora';
   loc.VC_oneCollection = loc.VC_oneCollection || 'a virtual corpus';
   loc.MINIMIZE         = loc.MINIMIZE         || 'Minimize';
@@ -362,12 +360,13 @@
     
     /**
      * Update the whole object based on the underlying data structure
-     */
+     */ 
     update : function() {
       this._root.update();
       return this;
     },
-
+    
+ 
     /**
      * Make the vc persistant by injecting the current timestamp as a
      * creation date limit criterion.
@@ -470,26 +469,17 @@
       return this._root.toQuery();
     },
 
-
-    /*
+    
+    /**
      * Add panel to display virtual corpus information
      */
     addVcInfPanel : function() {
-
       var dv = this._element.addE('div');
-      var panel = panelClass.create([ 'vcinfo' ]);
-      dv.appendChild(panel.element());
-      
-      var that = this;
-      var actions = panel.actions;
-      var statView;
-      
-      actions.add(loc.SHOW_STAT, [ 'statistic' ], function() {
-        if (statView === undefined || !statView.shown()) {
-          statView = corpStatVClass.create(that);
-          panel.add(statView);
-        }
-      });
-    }
+      //Create panel  
+      this.panel = vcPanelClass.create(this); 
+      dv.appendChild(this.panel.element());
+    },
+    
+    
   };
 });