You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2017/08/10 16:26:59 UTC

qpid-broker-j git commit: QPID-7781: [Java Broker] Address review comments

Repository: qpid-broker-j
Updated Branches:
  refs/heads/master 2e809efcc -> 0e4b9c556


QPID-7781: [Java Broker] Address review comments

* Destroy Add Virtual Host dialog on pressing cancel button from menu
* Apply metadata to VHN and VH widgets as part of loading UI for the selected type
* Fix destroy method for context variable editor


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/0e4b9c55
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/0e4b9c55
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/0e4b9c55

Branch: refs/heads/master
Commit: 0e4b9c556000c93d0ccd90959a91c851b7136290
Parents: 2e809ef
Author: Alex Rudyy <or...@apache.org>
Authored: Thu Aug 10 16:39:35 2017 +0100
Committer: Alex Rudyy <or...@apache.org>
Committed: Thu Aug 10 17:26:48 2017 +0100

----------------------------------------------------------------------
 .../js/qpid/management/virtualhost/bdb/add.js   |  1 +
 .../qpid/management/virtualhost/bdb_ha/add.js   |  8 +++-
 .../qpid/management/virtualhostnode/bdb/add.js  |  8 +++-
 .../management/virtualhostnode/bdb_ha/add.js    | 14 +++++--
 .../bdb_ha/add/existinggroup/add.js             |  1 +
 .../virtualhostnode/bdb_ha/add/newgroup/add.js  |  1 +
 .../js/qpid/management/virtualhost/derby/add.js |  1 +
 .../management/virtualhostnode/derby/add.js     |  8 +++-
 .../js/qpid/management/virtualhost/jdbc/add.js  |  1 +
 .../qpid/management/virtualhostnode/jdbc/add.js |  1 +
 .../src/main/java/resources/addVirtualHost.html | 39 ++++++++++----------
 .../js/qpid/common/ContextVariablesEditor.js    | 23 ++++++++----
 .../js/qpid/management/VirtualHostNode.js       | 26 ++++++++++++-
 .../js/qpid/management/addVirtualHost.js        | 36 ++++++++++++------
 .../addVirtualHostNodeAndVirtualHost.js         | 36 ++++++++++--------
 .../management/virtualhost/providedstore/add.js |  1 +
 .../qpid/management/virtualhostnode/json/add.js |  8 +++-
 .../java/resources/showVirtualHostNode.html     |  1 +
 .../qpid/management/virtualhost/memory/add.js   |  8 +++-
 .../management/virtualhostnode/memory/add.js    |  8 +++-
 20 files changed, 157 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/add.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/add.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/add.js
index 1cf1cb4..7258d93 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/add.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/add.js
@@ -40,6 +40,7 @@ define(["dojo/_base/xhr",
                         .set("regExpGen", util.numericOrContextVarRegexp);
                     registry.byId("addVirtualHost.storeOverfullSize")
                         .set("regExpGen", util.numericOrContextVarRegexp);
+                    util.applyMetadataToWidgets(data.containerNode, "VirtualHost", data.type, data.metadata);
                 });
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/add.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/add.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/add.js
index 4ebb3f3..f87e06a 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/add.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/add.js
@@ -23,15 +23,19 @@ define(["dojo/_base/xhr",
         "dojo/json",
         "dijit/registry",
         "dojo/text!virtualhost/bdb_ha/add.html",
+        "qpid/common/util",
         "dijit/form/ValidationTextBox",
         "dijit/form/CheckBox",
-        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template)
+        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template, util)
 {
     return {
         show: function (data)
         {
             this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
-            parser.parse(this.containerNode);
+            parser.parse(this.containerNode).then(function (instances)
+            {
+                util.applyMetadataToWidgets(data.containerNode, "VirtualHost", data.type, data.metadata);
+            });
         }
     };
 });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/add.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/add.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/add.js
index b62485f..065d812 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/add.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/add.js
@@ -25,15 +25,19 @@ define(["dojo/_base/xhr",
         "dojo/json",
         "dijit/registry",
         "dojo/text!virtualhostnode/bdb/add.html",
+        "qpid/common/util",
         "dijit/form/ValidationTextBox",
         "dijit/form/CheckBox",
-        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template)
+        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template, util)
 {
     return {
         show: function (data)
         {
             this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
-            parser.parse(this.containerNode);
+            parser.parse(this.containerNode).then(function (instances)
+            {
+                util.applyMetadataToWidgets(data.containerNode, "VirtualHostNode", data.type, data.metadata);
+            });
         }
     };
 });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add.js
index 3ab6e18..8713f84 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add.js
@@ -26,9 +26,10 @@ define(["dojo/_base/xhr",
         "dojo/json",
         "dijit/registry",
         "dojo/text!virtualhostnode/bdb_ha/add.html",
+        "qpid/common/util",
         "dijit/form/ValidationTextBox",
         "dijit/form/RadioButton",
-        "dojo/domReady!"], function (xhr, parser, array, dom, domConstruct, json, registry, template)
+        "dojo/domReady!"], function (xhr, parser, array, dom, domConstruct, json, registry, template, util)
 {
     return {
         show: function (data)
@@ -48,11 +49,14 @@ define(["dojo/_base/xhr",
                     {
                         that._groupChoiceChanged(type,
                             that.virtualHostNodeBdbhaTypeFieldsContainer,
-                            "qpid/management/virtualhostnode/bdb_ha/add/");
+                            "qpid/management/virtualhostnode/bdb_ha/add/",
+                            data
+                        );
                     });
+                    util.applyMetadataToWidgets(data.containerNode, "VirtualHostNode", data.type, data.metadata);
                 });
         },
-        _groupChoiceChanged: function (type, typeFieldsContainer, urlStem)
+        _groupChoiceChanged: function (type, typeFieldsContainer, urlStem, data)
         {
             var widgets = registry.findWidgets(typeFieldsContainer);
             array.forEach(widgets, function (item)
@@ -70,7 +74,9 @@ define(["dojo/_base/xhr",
                     {
                         TypeUI.show({
                             containerNode: typeFieldsContainer,
-                            parent: that
+                            parent: that,
+                            type: data.type,
+                            metadata: data.metadata
                         });
                     }
                     catch (e)

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/existinggroup/add.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/existinggroup/add.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/existinggroup/add.js
index e272c93..529311a 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/existinggroup/add.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/existinggroup/add.js
@@ -45,6 +45,7 @@ define(["dojo/_base/xhr",
                         .set("regExpGen", util.nodeAddressOrContextVarRegexp);
 
                     dom.byId("addVirtualHostNode.uploadFields").style.display = "none";
+                    util.applyMetadataToWidgets(data.containerNode, "VirtualHostNode", data.type, data.metadata);
                 });
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/newgroup/add.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/newgroup/add.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/newgroup/add.js
index 0a9fb63..cf74d75 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/newgroup/add.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/add/newgroup/add.js
@@ -104,6 +104,7 @@ define(["dojo/_base/xhr",
             {
                 return that.permittedNodesArray;
             };
+            util.applyMetadataToWidgets(data.containerNode, "VirtualHostNode", data.type, data.metadata);
         },
         _updatePermittedNodesJson: function ()
         {

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js
----------------------------------------------------------------------
diff --git a/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js b/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js
index 1cf1cb4..7258d93 100644
--- a/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js
+++ b/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/add.js
@@ -40,6 +40,7 @@ define(["dojo/_base/xhr",
                         .set("regExpGen", util.numericOrContextVarRegexp);
                     registry.byId("addVirtualHost.storeOverfullSize")
                         .set("regExpGen", util.numericOrContextVarRegexp);
+                    util.applyMetadataToWidgets(data.containerNode, "VirtualHost", data.type, data.metadata);
                 });
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js
----------------------------------------------------------------------
diff --git a/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js b/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js
index 467fe5f..b6b2d2e 100644
--- a/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js
+++ b/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/add.js
@@ -25,15 +25,19 @@ define(["dojo/_base/xhr",
         "dojo/json",
         "dijit/registry",
         "dojo/text!virtualhostnode/derby/add.html",
+        "qpid/common/util",
         "dijit/form/ValidationTextBox",
         "dijit/form/CheckBox",
-        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template)
+        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template, util)
 {
     return {
         show: function (data)
         {
             this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
-            parser.parse(this.containerNode);
+            parser.parse(this.containerNode).then(function(instances)
+            {
+                util.applyMetadataToWidgets(data.containerNode, "VirtualHostNode", data.type, data.metadata);
+            });
         }
     };
 });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/add.js
----------------------------------------------------------------------
diff --git a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/add.js b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/add.js
index eabae42..0c3b47f 100644
--- a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/add.js
+++ b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/add.js
@@ -87,6 +87,7 @@ define(["dojo/_base/xhr",
                         });
                     }
                 });
+                util.applyMetadataToWidgets(data.containerNode, "VirtualHost", data.type, data.metadata);
             }
         };
     });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/add.js
----------------------------------------------------------------------
diff --git a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/add.js b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/add.js
index af57780..1a52a46 100644
--- a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/add.js
+++ b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/add.js
@@ -88,6 +88,7 @@ define(["dojo/_base/xhr",
                         });
                     }
                 });
+                util.applyMetadataToWidgets(data.containerNode, "VirtualHostNode", data.type, data.metadata);
             }
         };
     });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html b/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html
index fba2dc0..dfb4d8d 100644
--- a/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html
+++ b/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html
@@ -18,17 +18,16 @@
   ~
   -->
 <div class="dijitHidden">
-    <div data-dojo-attach-point="addVirtualHost" data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add'" id="${id}_addVirtualHost">
-      <div id="${id}_addVirtualHost.contentPane">
-
-        <form id="${id}_addVirtualHost.form" data-dojo-attach-point="virtualHostForm" method="post" data-dojo-type="dijit/form/Form">
-            <div class="formBox">
-              <fieldset>
-                <legend>Virtual Host</legend>
+    <div data-dojo-attach-point="addVirtualHost" data-dojo-type="dijit.Dialog" style="width:600px;"
+         data-dojo-props="title:'Add Virtual Host'" id="${id}_addVirtualHost">
+        <form id="${id}_addVirtualHost.form" data-dojo-attach-point="virtualHostForm" method="post"
+              data-dojo-type="dijit/form/Form">
+            <div id="${id}_addVirtualHost.contentPane">
                 <div class="clear">
                     <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div>
                     <div class="tableContainer-valueCell formLabel-controlCell">
-                        <select data-dojo-attach-point="virtualHostType" id="${id}_addVirtualHost.type" data-dojo-type="dijit/form/FilteringSelect"
+                        <select data-dojo-attach-point="virtualHostType" id="${id}_addVirtualHost.type"
+                                data-dojo-type="dijit/form/FilteringSelect"
                                 data-dojo-props="
                                 name: 'type',
                                 required: true,
@@ -41,20 +40,20 @@
                     </div>
                 </div>
                 <div class="clear"></div>
-
                 <div data-dojo-attach-point="typeFields" id="${id}_addVirtualHost.typeFields"></div>
-                  <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables',  open: false">
-                      <div id="${id}_addVirtualHost.context" data-dojo-attach-point="virtualHostContext"
-                           data-dojo-type="qpid.common.ContextVariablesEditor"
-                           data-dojo-props="name: 'context', title: 'Context variables'"></div>
-                  </div>
-              </fieldset>
+                <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables',  open: false"
+                     data-dojo-attach-point="contextEditorPane">
+                    <div id="${id}_addVirtualHost.context" data-dojo-attach-point="virtualHostContext"
+                         data-dojo-type="qpid.common.ContextVariablesEditor"
+                         data-dojo-props="name: 'context', title: 'Context variables'"></div>
+                </div>
+            </div>
+            <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar">
+                <button data-dojo-attach-point="addButton" data-dojo-type="dijit/form/Button"
+                        id="${id}_addVirtualHost.addButton" data-dojo-props="label: 'Add'" type="submit"></button>
+                <button data-dojo-attach-point="cancelButton" data-dojo-type="dijit/form/Button"
+                        id="${id}_addVirtualHost.cancelButton" data-dojo-props="label: 'Cancel'"></button>
             </div>
         </form>
-      </div>
-      <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar">
-            <button data-dojo-attach-point="addButton" data-dojo-type="dijit/form/Button" id="${id}_addVirtualHost.addButton" data-dojo-props="label: 'Add'" type="submit"></button>
-            <button data-dojo-attach-point="cancelButton" data-dojo-type="dijit/form/Button" id="${id}_addVirtualHost.cancelButton" data-dojo-props="label: 'Cancel'" ></button>
-      </div>
     </div>
 </div>

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js
index e3aa602..24c681a 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js
@@ -297,26 +297,33 @@ define(["qpid/common/util",
             },
             destroy: function ()
             {
-                if (this.domNode  && this.domNode.destroy)
-                {
-                    this.domNode.destroy(); // TODO probably dead code
-                    this.domNode = null;
-                }
-                if (this._grid != null)
+                if (this._grid !== null)
                 {
                     this._grid.destroyRecursive();
                     this._grid = null;
                 }
-                if (this._addButton != null)
+                if (this._addButton !== null)
                 {
                     this._addButton.destroyRecursive();
                     this._addButton = null;
                 }
-                if (this._deleteButton != null)
+                if (this._deleteButton !== null)
                 {
                     this._deleteButton.destroyRecursive();
                     this._deleteButton = null;
                 }
+                if (this._filterBox !== null)
+                {
+                    this._filterBox.destroyRecursive();
+                    this._filterBox = null;
+                }
+                this.inherited(arguments);
+                if (this.domNode)
+                {
+                    domConstruct.destroy(this.domNode );
+                    this.domNode = null;
+                }
+
             },
             onChange: function (newValue)
             {

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js
index 51d7c3a..84a6f3e 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js
@@ -20,6 +20,7 @@
  */
 define(["dojo/parser",
         "dojo/query",
+        "dojo/_base/lang",
         "dojo/_base/connect",
         "dijit/registry",
         "dojox/html/entities",
@@ -31,11 +32,13 @@ define(["dojo/parser",
         "qpid/management/addQueue",
         "qpid/management/addExchange",
         "qpid/management/editVirtualHostNode",
+        "qpid/management/addVirtualHost",
         "dojox/grid/EnhancedGrid",
         "dojo/text!showVirtualHostNode.html",
         "dojo/domReady!"],
     function (parser,
               query,
+              lang,
               connect,
               registry,
               entities,
@@ -47,6 +50,7 @@ define(["dojo/parser",
               addQueue,
               addExchange,
               editVirtualHostNode,
+              AddVirtualHostDialog,
               EnhancedGrid,
               template)
     {
@@ -85,6 +89,25 @@ define(["dojo/parser",
             this.editNodeButton = registry.byNode(query(".editNodeButton", containerNode)[0]);
             this.deleteNodeButton = registry.byNode(query(".deleteNodeButton", containerNode)[0]);
             this.virtualHostGridPanel = registry.byNode(query(".virtualHostGridPanel", containerNode)[0]);
+            this.addVirtualHostButton = registry.byNode(query(".addVHButton", containerNode)[0]);
+            this.addVirtualHostButton.on("click", lang.hitch(this, function ()
+            {
+                var dialog = new AddVirtualHostDialog({
+                    management: this.management,
+                    virtualhostNodeType: this.vhostNodeUpdater.type.innerHTML,
+                    virtualhostNodeModelObject: this.modelObj
+                });
+                dialog.show();
+                dialog.on("done", lang.hitch(this, function (update)
+                {
+                    dialog.hideAndDestroy();
+                    if (update)
+                    {
+                        this.vhostNodeUpdater.update();
+                    }
+                }));
+            }));
+            this.addVirtualHostButton.domNode.style.display = "none";
             this.deleteNodeButton.on("click", function (e)
             {
                 if (confirm("Deletion of virtual host node will delete both configuration and message data.\n\n"
@@ -268,7 +291,8 @@ define(["dojo/parser",
 
             this.tabObject.virtualHostGridPanel.domNode.style.display = data.virtualhosts ? "block" : "none";
             util.updateUpdatableStore(this.tabObject.vhostsGrid, data.virtualhosts);
-        }
+            this.tabObject.addVirtualHostButton.domNode.style.display =data.virtualhosts ? "none" : "";
+        };
 
         return VirtualHostNode;
     });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js
index 5a0be0e..fc6b43d 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js
@@ -53,7 +53,7 @@ define(["dojo/_base/declare",
               template)
     {
 
-        return declare("qpid.management.addVirtualHostDialog",
+        return declare("qpid.management.addVirtualHost",
             [dijit._WidgetBase, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin, Evented],
             {
                 //Strip out the apache comment header from the template html as comments unsupported.
@@ -66,6 +66,7 @@ define(["dojo/_base/declare",
                 virtualHostType: null,
                 typeFields: null,
                 context: null,
+                contextEditorPane: null,
 
                 // constructor parameters
                 management: null,
@@ -110,13 +111,12 @@ define(["dojo/_base/declare",
                 },
                 hideAndDestroy: function ()
                 {
-                    //this.addVirtualHost.hide();  // Seems to upset destroy??
                     this.destroy();
                 },
                 destroy: function ()
                 {
-                    this.addVirtualHost.destroyRecursive(false);
-                    domConstruct.destroy(this.typeFields);
+                    this._destroyTypeFields();
+                    this.addVirtualHost.destroyRecursive();
                     this.inherited(arguments);
                 },
                 _onCancel: function (data)
@@ -152,12 +152,7 @@ define(["dojo/_base/declare",
                 },
                 _onVhTypeChanged: function (type)
                 {
-                    var widgets = registry.findWidgets(this.typeFields);
-                    array.forEach(widgets, function (item)
-                    {
-                        item.destroyRecursive();
-                    });
-                    domConstruct.empty(this.typeFields);
+                    this._destroyTypeFields();
                     this.virtualHostContext.removeDynamicallyAddedInheritedContext();
                     if (type)
                     {
@@ -169,9 +164,9 @@ define(["dojo/_base/declare",
                                 typeUI.show({
                                     containerNode: this.typeFields,
                                     parent: this,
-                                    metadata: metadata
+                                    metadata: metadata,
+                                    type: type
                                 });
-                                util.applyMetadataToWidgets(this.typeFields, "VirtualHost", type, metadata);
                             }
                             catch (e)
                             {
@@ -179,6 +174,23 @@ define(["dojo/_base/declare",
                             }
                         }));
                     }
+                },
+                _destroyTypeFields: function()
+                {
+                    var widgets = registry.findWidgets(this.typeFields);
+                    array.forEach(widgets, function (item)
+                    {
+                        item.destroyRecursive();
+                    });
+                    domConstruct.empty(this.typeFields);
+                },
+                on: function (type, listener)
+                {
+                    this.inherited(arguments);
+                    if (type === "done")
+                    {
+                        this.addVirtualHost.on("hide", function(){listener(false);});
+                    }
                 }
 
             });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
index 8428be2..f8b378e 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js
@@ -87,16 +87,11 @@ define(["dojo/_base/event",
                 this.reader = window.FileReader ? new FileReader() : undefined;
 
                 this.dialog = registry.byId("addVirtualHostNodeAndVirtualHost");
+                this.dialog.on("hide", lang.hitch(this, this._cancel));
                 this.addButton = registry.byId("addVirtualHostNodeAndVirtualHost.addButton");
                 this.cancelButton = registry.byId("addVirtualHostNodeAndVirtualHost.cancelButton");
-                this.cancelButton.on("click", function (e)
-                {
-                    that._cancel(e);
-                });
-                this.addButton.on("click", function (e)
-                {
-                    that._add(e);
-                });
+                this.cancelButton.on("click", lang.hitch(this, this._cancel));
+                this.addButton.on("click", lang.hitch(this, this._add));
 
                 this.virtualHostNodeTypeFieldsContainer = dom.byId("addVirtualHostNode.typeFields");
                 this.virtualHostNodeSelectedFileContainer = dom.byId("addVirtualHostNode.selectedFile");
@@ -282,12 +277,7 @@ define(["dojo/_base/event",
             },
             _typeChanged: function (type, typeFieldsContainer, urlStem, category)
             {
-                var widgets = registry.findWidgets(typeFieldsContainer);
-                array.forEach(widgets, function (item)
-                {
-                    item.destroyRecursive();
-                });
-                domConstruct.empty(typeFieldsContainer);
+                this._destroyContainerWidgets(typeFieldsContainer);
                 if (category)
                 {
                     var context = this["v" + category.substring(1) + "Context"];
@@ -307,9 +297,9 @@ define(["dojo/_base/event",
                             typeUI.show({
                                 containerNode: typeFieldsContainer,
                                 parent: that,
-                                metadata: metadata
+                                metadata: metadata,
+                                type: type
                             });
-                            util.applyMetadataToWidgets(typeFieldsContainer, category, type, metadata);
                         }
                         catch (e)
                         {
@@ -318,6 +308,18 @@ define(["dojo/_base/event",
                     });
                 }
             },
+            _destroyContainerWidgets: function(typeFieldsContainer)
+            {
+                if (typeFieldsContainer)
+                {
+                    var widgets = registry.findWidgets(typeFieldsContainer);
+                    array.forEach(widgets, function (item)
+                    {
+                        item.destroyRecursive();
+                    });
+                    domConstruct.empty(typeFieldsContainer);
+                }
+            },
             _vhnFileFlagChanged: function (selected)
             {
                 this.virtualHostForm.domNode.style.display = selected ? "none" : "block";
@@ -352,6 +354,8 @@ define(["dojo/_base/event",
             _cancel: function (e)
             {
                 util.abortReaderSafely(this.reader);
+                this._destroyContainerWidgets(this.virtualHostNodeTypeFieldsContainer);
+                this._destroyContainerWidgets(this.virtualHostTypeFieldsContainer);
                 this.dialog.hide();
             },
             _add: function (e)

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js
index b21da80..b6ffc22 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js
@@ -50,6 +50,7 @@ define(["dojo/_base/xhr",
             {
                 dom.byId("addVirtualHost.diskFlowControls").style.display = "none";
             }
+            util.applyMetadataToWidgets(this.containerNode, "VirtualHost", data.type, data.metadata);
 
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js
index 8ff96d4..ea69a3a 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js
@@ -25,15 +25,19 @@ define(["dojo/_base/xhr",
         "dojo/json",
         "dijit/registry",
         "dojo/text!virtualhostnode/json/add.html",
+        "qpid/common/util",
         "dijit/form/ValidationTextBox",
         "dijit/form/CheckBox",
-        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template)
+        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template, util)
 {
     return {
         show: function (data)
         {
             this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
-            parser.parse(this.containerNode);
+            parser.parse(this.containerNode).then(function (instances)
+            {
+                util.applyMetadataToWidgets(data.containerNode, "VirtualHostNode", data.type, data.metadata);
+            });
         }
     };
 });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html b/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html
index 0a3d106..cafdbb5 100644
--- a/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html
+++ b/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html
@@ -47,6 +47,7 @@
       <button data-dojo-type="dijit.form.Button" class="stopNodeButton" type="button" data-dojo-props="disabled: true">Stop</button>
       <button data-dojo-type="dijit.form.Button" class="editNodeButton" type="button" data-dojo-props="disabled: true">Edit</button>
       <button data-dojo-type="dijit.form.Button" class="deleteNodeButton" data-dojo-props="iconClass: 'dijitIconDelete'">Delete</button>
+      <button data-dojo-type="dijit.form.Button" class="addVHButton" type="button" >Add Virtual Host</button>
     </div>
     <br/>
     <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Virtual Host'" class="clear virtualHostGridPanel">

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/add.js
----------------------------------------------------------------------
diff --git a/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/add.js b/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/add.js
index d53185d..ec3ba24 100644
--- a/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/add.js
+++ b/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/add.js
@@ -23,14 +23,18 @@ define(["dojo/_base/xhr",
         "dojo/json",
         "dijit/registry",
         "dojo/text!virtualhost/memory/add.html",
+        "qpid/common/util",
         "dijit/form/ValidationTextBox",
-        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template)
+        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template, util)
 {
     return {
         show: function (data)
         {
             this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
-            parser.parse(this.containerNode);
+            parser.parse(this.containerNode).then(function (instances)
+            {
+                util.applyMetadataToWidgets(data.containerNode, "VirtualHost", data.type, data.metadata);
+            });
         }
     };
 });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/0e4b9c55/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js
----------------------------------------------------------------------
diff --git a/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js b/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js
index a30aa76..ac797d7 100644
--- a/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js
+++ b/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js
@@ -25,14 +25,18 @@ define(["dojo/_base/xhr",
         "dojo/json",
         "dijit/registry",
         "dojo/text!virtualhostnode/memory/add.html",
+        "qpid/common/util",
         "dijit/form/ValidationTextBox",
-        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template)
+        "dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template, util)
 {
     return {
         show: function (data)
         {
             this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
-            parser.parse(this.containerNode);
+            parser.parse(this.containerNode).then(function (instances)
+            {
+                util.applyMetadataToWidgets(data.containerNode, "VirtualHostNode", data.type, data.metadata);
+            });
         }
     };
 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org