Adopt panel system in match spec

Change-Id: I068c9f3ece057ce7eb782575fc5233d00985c02c
diff --git a/dev/js/src/buttongroup/menu.js b/dev/js/src/buttongroup/menu.js
index 4615564..bebaac4 100644
--- a/dev/js/src/buttongroup/menu.js
+++ b/dev/js/src/buttongroup/menu.js
@@ -8,10 +8,10 @@
 
     /**
      * Create new menu object.
-     * Pass the match information object
+     * Pass the panel object
      * and the item parameters.
      *
-     * @param info The match info object
+     * @param panel The panel object
      * @param params The match menu items
      *   as an array of arrays.
      */
@@ -37,15 +37,13 @@
     },
 
     /**
-     * The match information object of the menu.
-     * TODO:
-     *   Rename to 'Panel'
+     * The panel object of the menu.
      */
-    info :function (infoVar) {
-      if (infoVar !== undefined)
-        this._info = infoVar;
+    panel :function (panelVar) {
+      if (panelVar !== undefined)
+        this._panel = panelVar;
 
-      return this._info;
+      return this._panel;
     },
 
     // Attach menu to button
diff --git a/dev/js/src/match.js b/dev/js/src/match.js
index 1a89a8f..66def11 100644
--- a/dev/js/src/match.js
+++ b/dev/js/src/match.js
@@ -34,9 +34,8 @@
   return {
 
     /**
-     * Create a new annotation object.
-     * Expects an array of available foundry/layer=type terms.
-     * Supported types are 'spans', 'tokens' and 'rels'.
+     * Create a new match object.
+     * Expects an element with match descriptions.
      */
     create : function (match) {
       return Object.create(this)._init(match);
@@ -147,12 +146,12 @@
      * Open match
      */
     open : function () {
-
+      
       // Add actions unless it's already activated
       var element = this._element;
 
       // There is an element to open
-      if (this._element === undefined || this._element === null)
+      if (element === undefined || element === null)
         return false;
 
       // The element is already opened
@@ -187,16 +186,16 @@
       if (!refLine)
         return;
       
-      var panel = matchPanelClass.create(this);
+      this.panel = matchPanelClass.create(this);
 
       this._element.insertBefore(
-        panel.element(),
+        this.panel.element(),
         this._element.querySelector("p.ref")
       );
 
       // Insert before reference line
       refLine.insertBefore(
-        panel.actions.element(),
+        this.panel.actions.element(),
         refLine.firstChild
       );
 
diff --git a/dev/js/src/match/treeitem.js b/dev/js/src/match/treeitem.js
index 68ffe8c..d99165a 100644
--- a/dev/js/src/match/treeitem.js
+++ b/dev/js/src/match/treeitem.js
@@ -56,8 +56,8 @@
       var menu = this.menu();
       menu.hide();
       e.halt();
-      if (menu.info() !== undefined) {
-	      menu.info().showTree(this._foundry, this._layer, this._type);
+      if (menu.panel() !== undefined) {
+	      menu.panel().addTree(this._foundry, this._layer, this._type);
       };
     },
 
diff --git a/dev/js/src/panel/match.js b/dev/js/src/panel/match.js
index aba8873..2b220d3 100644
--- a/dev/js/src/panel/match.js
+++ b/dev/js/src/panel/match.js
@@ -35,7 +35,8 @@
 
       var a = this.actions;
 
-      // Ugly hack!
+      // TODO:
+      //   Ugly hack!
       var cl= a.element().classList;
       cl.remove('matchinfo');
       cl.add('button-matchinfo');
@@ -67,7 +68,7 @@
           var tm = KorAP.TreeMenu;
 
           // Set panel
-          tm.info(this);
+          tm.panel(this);
 
           // Reread list
           tm.readItems(this._treeMenuList());
@@ -107,8 +108,7 @@
     /**
      * Add Tree view to panel
      */
-    // TODO: Rename to addTree() - this is called in treeitem.js
-    showTree : function (foundry, layer, type) {
+    addTree : function (foundry, layer, type) {
       this.add(
         relationsView.create(this._match, foundry, layer, type)
       );
diff --git a/dev/js/src/view/match/tokentable.js b/dev/js/src/view/match/tokentable.js
index 70e8a8f..f0d2fd2 100644
--- a/dev/js/src/view/match/tokentable.js
+++ b/dev/js/src/view/match/tokentable.js
@@ -13,7 +13,6 @@
 
 
     _init : function (match) {
-      console.log(match);
       this._match = match;
       return this;
     },