First attempt to create a panel based windows system

Change-Id: I2b6fb4cb147518d661dbccb3bd5f8e093b63bf55
diff --git a/dev/js/src/view.js b/dev/js/src/view.js
new file mode 100644
index 0000000..2eb5dd0
--- /dev/null
+++ b/dev/js/src/view.js
@@ -0,0 +1,55 @@
+/**
+ * Create a view that can be added to a panel,
+ * like a tree view or the metadata view.
+ */
+
+define(['buttongroup', 'util'], function (buttonGroupClass) {
+
+  return {
+
+    // TODO:
+    //   Support classes
+    create : function () {
+      return Object.create(this)._init();
+    },
+
+    _init : function () {
+      // ..
+      this.panel = undefined;
+
+      // The buttonclass is bind to the view
+      this.actions = buttonGroupClass.create(['action', 'view']).bind(this);
+      this.actions.add('close', ['button-icon','close'], function (e) {
+        this.close();
+      });
+
+      return this;
+    },
+
+    /**
+     * Element of the view
+     */
+    element : function () {
+      if (this._element)
+        return this._element;
+
+      // Create panel element
+      var e = document.createElement('div');
+      e.classList.add('view');
+
+      e.appendChild(this.actions.element());
+
+      this._element = e;
+      return e;
+    },
+
+    /**
+     * Close the view.
+     */
+    close : function () {
+      var e = this.element();
+      e.parentNode.removeChild(e);
+      this.panel.delView(this);
+    }
+  };
+});