Modified: 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp/edit.js
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp/edit.js?rev=1741609&r1=1741608&r2=1741609&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp/edit.js
 (original)
+++ 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp/edit.js
 Fri Apr 29 11:04:40 2016
@@ -36,89 +36,105 @@ define(["dojo/_base/event",
         "dijit/form/NumberSpinner",
         "dojox/validate/us",
         "dojox/validate/web",
-        "dojo/domReady!"],
-  function (event, dom, domConstruct, json, query, parser,  registry, util, 
template, entities)
-  {
+        "dojo/domReady!"], function (event, dom, domConstruct, json, query, 
parser, registry, util, template, entities)
+       {
 
-    var httpManagementEditor =
-    {
-      init: function()
-      {
-        var that=this;
-        this.containerNode = domConstruct.create("div", {innerHTML: template});
-        parser.parse(this.containerNode).then(function(instances){ 
that._postParse();});
-      },
-      _postParse: function()
-      {
-        var that=this;
-        this.allFieldsContainer = dom.byId("editHttpManagement.contentPane");
-        this.dialog = registry.byId("editHttpManagementDialog");
-        this.saveButton = registry.byId("editHttpManagement.saveButton");
-        this.cancelButton = registry.byId("editHttpManagement.cancelButton");
-        this.cancelButton.on("click", function(e){that._cancel(e);});
-        this.saveButton.on("click", function(e){that._save(e);});
-        this.form = registry.byId("editHttpManagementForm");
-        this.form.on("submit", function(){return false;});
-      },
-      show: function(management, modelObj, data)
-      {
-        this.management = management;
-        this.modelObj = modelObj;
-        var that=this;
-        management.load(modelObj,  { actuals: true }).then(
-            function(actualData)
-            {
-                that._show(actualData[0]);
-            });
-      },
-      destroy: function()
-      {
-        if (this.dialog)
-        {
-            this.dialog.destroyRecursive();
-            this.dialog = null;
-        }
+           var httpManagementEditor = {
+               init: function ()
+               {
+                   var that = this;
+                   this.containerNode = domConstruct.create("div", {innerHTML: 
template});
+                   parser.parse(this.containerNode).then(function (instances)
+                                                         {
+                                                             that._postParse();
+                                                         });
+               },
+               _postParse: function ()
+               {
+                   var that = this;
+                   this.allFieldsContainer = 
dom.byId("editHttpManagement.contentPane");
+                   this.dialog = registry.byId("editHttpManagementDialog");
+                   this.saveButton = 
registry.byId("editHttpManagement.saveButton");
+                   this.cancelButton = 
registry.byId("editHttpManagement.cancelButton");
+                   this.cancelButton.on("click", function (e)
+                   {
+                       that._cancel(e);
+                   });
+                   this.saveButton.on("click", function (e)
+                   {
+                       that._save(e);
+                   });
+                   this.form = registry.byId("editHttpManagementForm");
+                   this.form.on("submit", function ()
+                   {
+                       return false;
+                   });
+               },
+               show: function (management, modelObj, data)
+               {
+                   this.management = management;
+                   this.modelObj = modelObj;
+                   var that = this;
+                   management.load(modelObj, {actuals: true}).then(function 
(actualData)
+                                                                   {
+                                                                       
that._show(actualData[0]);
+                                                                   });
+               },
+               destroy: function ()
+               {
+                   if (this.dialog)
+                   {
+                       this.dialog.destroyRecursive();
+                       this.dialog = null;
+                   }
 
-        if (this.containerNode)
-        {
-            domConstruct.destroy(this.containerNode);
-            this.containerNode = null;
-        }
-      },
-      _cancel: function(e)
-      {
-          this.dialog.hide();
-      },
-      _save: function(e)
-      {
-          event.stop(e);
-          if(this.form.validate())
-          {
-              var data = util.getFormWidgetValues(this.form, this.initialData);
-              var that=this;
-              this.management.update(this.modelObj, data).then( function(x){ 
that.dialog.hide();} );
-          }
-          else
-          {
-              alert('Form contains invalid data.  Please correct first');
-          }
-      },
-      _show:function(actualData)
-      {
-          this.initialData = actualData;
-          util.applyToWidgets(this.allFieldsContainer,  "Plugin", 
"MANAGEMENT-HTTP", actualData, this.management.metadata);
-          this.dialog.startup();
-          this.dialog.show();
-          if (!this.resizeEventRegistered)
-          {
-            this.resizeEventRegistered = true;
-            
util.resizeContentAreaAndRepositionDialog(dom.byId("editHttpManagement.contentPane"),
 this.dialog);
-          }
-      }
-    };
+                   if (this.containerNode)
+                   {
+                       domConstruct.destroy(this.containerNode);
+                       this.containerNode = null;
+                   }
+               },
+               _cancel: function (e)
+               {
+                   this.dialog.hide();
+               },
+               _save: function (e)
+               {
+                   event.stop(e);
+                   if (this.form.validate())
+                   {
+                       var data = util.getFormWidgetValues(this.form, 
this.initialData);
+                       var that = this;
+                       this.management.update(this.modelObj, 
data).then(function (x)
+                                                                        {
+                                                                            
that.dialog.hide();
+                                                                        });
+                   }
+                   else
+                   {
+                       alert('Form contains invalid data.  Please correct 
first');
+                   }
+               },
+               _show: function (actualData)
+               {
+                   this.initialData = actualData;
+                   util.applyToWidgets(this.allFieldsContainer,
+                                       "Plugin",
+                                       "MANAGEMENT-HTTP",
+                                       actualData,
+                                       this.management.metadata);
+                   this.dialog.startup();
+                   this.dialog.show();
+                   if (!this.resizeEventRegistered)
+                   {
+                       this.resizeEventRegistered = true;
+                       
util.resizeContentAreaAndRepositionDialog(dom.byId("editHttpManagement.contentPane"),
+                                                                 this.dialog);
+                   }
+               }
+           };
 
-    httpManagementEditor.init();
+           httpManagementEditor.init();
 
-    return httpManagementEditor;
-  }
-);
+           return httpManagementEditor;
+       });

Modified: 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/port/amqp/show.js
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/port/amqp/show.js?rev=1741609&r1=1741608&r2=1741609&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/port/amqp/show.js
 (original)
+++ 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/port/amqp/show.js
 Fri Apr 29 11:04:40 2016
@@ -25,85 +25,114 @@ define(["dojo/query",
         "qpid/common/util",
         "qpid/common/UpdatableStore",
         "qpid/management/addVirtualHostAlias",
-        "dojo/domReady!"],
-    function (query, template, EnhancedGrid, registry, util, UpdatableStore, 
addVirtualHostAlias) {
-        function AmqpPort(params) {
-            var that = this;
-            util.parse(params.typeSpecificDetailsNode, template, function () {
-                that.postParse(params);
-            });
-            this.modelObj = params.modelObj;
-            this.portUpdater = params.portUpdater;
-            this.management = params.management;
-        }
+        "dojo/domReady!"], function (query, template, EnhancedGrid, registry, 
util, UpdatableStore, addVirtualHostAlias)
+       {
+           function AmqpPort(params)
+           {
+               var that = this;
+               util.parse(params.typeSpecificDetailsNode, template, function ()
+               {
+                   that.postParse(params);
+               });
+               this.modelObj = params.modelObj;
+               this.portUpdater = params.portUpdater;
+               this.management = params.management;
+           }
 
-        AmqpPort.prototype.postParse = function (params) {
-            var that = this;
-            var gridProperties = {
-                height: 400,
-                sortInfo: 2,
-/*
-                canSort: function(column) { return false; },
-*/
-                plugins: {
-                    indirectSelection: true,  // KW TODO checkme
-                    pagination: {
-                        pageSizes: [10, 25, 50, 100],
-                        description: true,
-                        sizeSwitch: true,
-                        pageStepper: true,
-                        gotoButton: true,
-                        maxPageStep: 4,
-                        position: "bottom"
-                    }
-                }
-            };
+           AmqpPort.prototype.postParse = function (params)
+           {
+               var that = this;
+               var gridProperties = {
+                   height: 400,
+                   sortInfo: 2, /*
+                    canSort: function(column) { return false; },
+                    */
+                   plugins: {
+                       indirectSelection: true,  // KW TODO checkme
+                       pagination: {
+                           pageSizes: [10, 25, 50, 100],
+                           description: true,
+                           sizeSwitch: true,
+                           pageStepper: true,
+                           gotoButton: true,
+                           maxPageStep: 4,
+                           position: "bottom"
+                       }
+                   }
+               };
 
-            this.addButton = registry.byNode(query(".addButton", 
params.typeSpecificDetailsNode)[0]);
-            this.addButton.on("click", function (e) {
-                addVirtualHostAlias.show(that.management, that.modelObj);
-            });
-            this.deleteButton = registry.byNode(query(".deleteButton", 
params.typeSpecificDetailsNode)[0]);
-            this.deleteButton.on("click", function (e) {
-                util.deleteSelectedObjects(
-                    that.virtualHostAliasesGrid.grid,
-                    "Are you sure you want to delete virtual host alias",
-                    that.management,
-                    {type: "virtualhostalias", parent:that.modelObj},
-                    that.portUpdater);
-            });
+               this.addButton = registry.byNode(query(".addButton", 
params.typeSpecificDetailsNode)[0]);
+               this.addButton.on("click", function (e)
+               {
+                   addVirtualHostAlias.show(that.management, that.modelObj);
+               });
+               this.deleteButton = registry.byNode(query(".deleteButton", 
params.typeSpecificDetailsNode)[0]);
+               this.deleteButton.on("click", function (e)
+               {
+                   util.deleteSelectedObjects(that.virtualHostAliasesGrid.grid,
+                                              "Are you sure you want to delete 
virtual host alias",
+                                              that.management,
+                                              {
+                                                  type: "virtualhostalias",
+                                                  parent: that.modelObj
+                                              },
+                                              that.portUpdater);
+               });
 
-            this.virtualHostAliasesGrid = new 
UpdatableStore(params.data.virtualhostaliases, query(".virtualHostAliasesGrid", 
params.typeSpecificDetailsNode)[0],
-                [
-                    {name: "Priority", field: "priority", width: "20%"},
-                    {name: "Name", field: "name", width: "40%"},
-                    {name: "Type", field: "type", width: "40%"}
-                ], function (obj) {
-                    obj.grid.on("rowDblClick",
-                        function (evt) {
-                            var idx = evt.rowIndex;
-                            var theItem = this.getItem(idx);
-                            var aliasModelObj = {name: theItem.name, type: 
"virtualhostalias", parent: that.modelObj};
-                            that.management.load(aliasModelObj, {actuals: 
true, depth: 0}).then(
-                                function (data) {
-                                    addVirtualHostAlias.show(that.management, 
aliasModelObj, data[0]);
-                                }
-                            );
-                        });
-                }, gridProperties, EnhancedGrid);
-        }
+               this.virtualHostAliasesGrid = new 
UpdatableStore(params.data.virtualhostaliases, query(
+                   ".virtualHostAliasesGrid",
+                   params.typeSpecificDetailsNode)[0], [{
+                   name: "Priority",
+                   field: "priority",
+                   width: "20%"
+               },
+                   {
+                       name: "Name",
+                       field: "name",
+                       width: "40%"
+                   },
+                   {
+                       name: "Type",
+                       field: "type",
+                       width: "40%"
+                   }], function (obj)
+               {
+                   obj.grid.on("rowDblClick", function (evt)
+                   {
+                       var idx = evt.rowIndex;
+                       var theItem = this.getItem(idx);
+                       var aliasModelObj = {
+                           name: theItem.name,
+                           type: "virtualhostalias",
+                           parent: that.modelObj
+                       };
+                       that.management.load(aliasModelObj,
+                                            {
+                                                actuals: true,
+                                                depth: 0
+                                            }).then(function (data)
+                                                    {
+                                                        
addVirtualHostAlias.show(that.management,
+                                                                               
  aliasModelObj,
+                                                                               
  data[0]);
+                                                    });
+                   });
+               }, gridProperties, EnhancedGrid);
+           }
 
-        AmqpPort.prototype.update = function (restData) {
-            if (this.virtualHostAliasesGrid) {
-                if 
(this.virtualHostAliasesGrid.update(restData.virtualhostaliases)) {
-/*
-                    this.virtualHostAliasesGrid.grid.sort();
-                    this.virtualHostAliasesGrid.grid.update();
-*/
-                }
-            }
-        }
+           AmqpPort.prototype.update = function (restData)
+           {
+               if (this.virtualHostAliasesGrid)
+               {
+                   if 
(this.virtualHostAliasesGrid.update(restData.virtualhostaliases))
+                   {
+                       /*
+                        this.virtualHostAliasesGrid.grid.sort();
+                        this.virtualHostAliasesGrid.grid.update();
+                        */
+                   }
+               }
+           }
 
-        return AmqpPort;
-    }
-);
+           return AmqpPort;
+       });

Modified: 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/port/http/show.js
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/port/http/show.js?rev=1741609&r1=1741608&r2=1741609&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/port/http/show.js
 (original)
+++ 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/port/http/show.js
 Fri Apr 29 11:04:40 2016
@@ -18,24 +18,26 @@
  * under the License.
  *
  */
-define(["qpid/common/util",
-        "dojo/text!port/http/show.html",
-        "qpid/common/TypeTabExtension",
-        "dojo/domReady!"],
-    function (util, template, TypeTabExtension)
-    {
-        function HttpPort(params)
-        {
-            TypeTabExtension.call(this, params.containerNode, template, 
"Port", params.data.type, params.metadata, params.data);
-        }
+define(["qpid/common/util", "dojo/text!port/http/show.html", 
"qpid/common/TypeTabExtension", "dojo/domReady!"],
+       function (util, template, TypeTabExtension)
+       {
+           function HttpPort(params)
+           {
+               TypeTabExtension.call(this,
+                                     params.containerNode,
+                                     template,
+                                     "Port",
+                                     params.data.type,
+                                     params.metadata,
+                                     params.data);
+           }
 
-        util.extend(HttpPort, TypeTabExtension);
+           util.extend(HttpPort, TypeTabExtension);
 
-        HttpPort.prototype.update = function (restData)
-        {
-            TypeTabExtension.prototype.update.call(this, restData);
-        }
+           HttpPort.prototype.update = function (restData)
+           {
+               TypeTabExtension.prototype.update.call(this, restData);
+           }
 
-        return HttpPort;
-    }
-);
+           return HttpPort;
+       });

Modified: 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js?rev=1741609&r1=1741608&r2=1741609&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js
 (original)
+++ 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js
 Fri Apr 29 11:04:40 2016
@@ -18,8 +18,7 @@
  * under the License.
  *
  */
-define([
-        "qpid/common/util",
+define(["qpid/common/util",
         "dojo/_base/declare",
         "dojo/_base/array",
         "dojo/dom-construct",
@@ -38,170 +37,190 @@ define([
         "dojox/validate/us",
         "dojox/validate/web",
         "dojo/domReady!"],
-function (util, declare, array, domConstruct, win, query, json, _WidgetBase,
-            _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin, 
registry, template, entities)
- {
+       function (util, declare, array, domConstruct, win, query, json, 
_WidgetBase, _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin, 
registry, template, entities)
+       {
 
-  return declare("qpid.preferencesprovider.PreferencesProviderForm",
-                    [_WidgetBase, _OnDijitClickMixin, _TemplatedMixin, 
_WidgetsInTemplateMixin], {
+           return declare("qpid.preferencesprovider.PreferencesProviderForm",
+                          [_WidgetBase, _OnDijitClickMixin, _TemplatedMixin, 
_WidgetsInTemplateMixin],
+                          {
 
-    templateString: template,
-    domNode: null,
-    preferencesProviderForm : null,
-    preferencesProviderNameWidget : null,
-    preferencesProviderTypeWidget : null,
-    preferencesProviderTypeFieldsContainer: null,
-    metadata: null,
+                              templateString: template,
+                              domNode: null,
+                              preferencesProviderForm: null,
+                              preferencesProviderNameWidget: null,
+                              preferencesProviderTypeWidget: null,
+                              preferencesProviderTypeFieldsContainer: null,
+                              metadata: null,
 
-    buildRendering: function()
-    {
-        //Strip out the apache comment header from the template html as 
comments unsupported.
-        this.templateString = this.templateString.replace(/<!--[\s\S]*?-->/g, 
"");
-        this.inherited(arguments);
-    },
-    postCreate: function()
-    {
-        this.inherited(arguments);
-        var that = this;
+                              buildRendering: function ()
+                              {
+                                  //Strip out the apache comment header from 
the template html as comments unsupported.
+                                  this.templateString = 
this.templateString.replace(/<!--[\s\S]*?-->/g, "");
+                                  this.inherited(arguments);
+                              },
+                              postCreate: function ()
+                              {
+                                  this.inherited(arguments);
+                                  var that = this;
 
-        this.preferencesProviderNameWidget.set("regExpGen", 
util.nameOrContextVarRegexp);
+                                  
this.preferencesProviderNameWidget.set("regExpGen", 
util.nameOrContextVarRegexp);
 
-        if (this.metadata)
-        {
-            setMetadata(this.metadata);
-        }
-        this.preferencesProviderTypeWidget.on("change", 
function(type){that._preferencesProviderTypeChanged(type);});
-        this.preferencesProviderForm.on("submit", function() { return false; })
-    },
-    reset: function()
-    {
-        this.data = null;
-        this.preferencesProviderForm.reset();
-        this.preferencesProviderTypeWidget.set("value", "None");
-    },
-    submit: function(submitFunction, providerNotDefinedCallback)
-    {
-        if (this.preferencesProviderTypeWidget.get("value") != "None")
-        {
-            var preferencesProviderData = 
util.getFormWidgetValues(this.preferencesProviderForm, this.data)
-            submitFunction(preferencesProviderData);
-        }
-        else
-        {
-            providerNotDefinedCallback();
-        }
-    },
-    getPreferencesProviderName: function()
-    {
-        return this.preferencesProviderNameWidget.get("value");
-    },
-    setPreferencesProviderName: function(name)
-    {
-      if (!(this.data && this.data.name))
-      {
-        this.preferencesProviderNameWidget.set("value", name);
-      }
-    },
-    setMetadata: function(metadata)
-    {
-        this.metadata = metadata;
-        var supportedPreferencesProviderTypes = 
metadata.getTypesForCategory("PreferencesProvider");
-        supportedPreferencesProviderTypes.sort();
-        supportedPreferencesProviderTypes.splice(0,0,"None");
-        var preferencesProviderTypeStore = 
util.makeTypeStore(supportedPreferencesProviderTypes);
-        this.preferencesProviderTypeWidget.set("store", 
preferencesProviderTypeStore);
-    },
-    validate: function()
-    {
-        return this.preferencesProviderForm.validate();
-    },
-    setData: function(data)
-    {
-        this._load(data);
-    },
-    _load:function(data)
-    {
-        data = data || {}
-        this.data = data;
-        this.preferencesProviderNameWidget.set("value", data.name);
-        if (data.type == this.preferencesProviderTypeWidget.get("value"))
-        {
-            // re-create UI anyway
-            this._preferencesProviderTypeChanged(data.type);
-        }
-        else
-        {
-            this.preferencesProviderTypeWidget.set("value", data.type);
-        }
-    },
-    _preferencesProviderTypeChanged: function(type)
-    {
-        var typeFieldsContainer = this.preferencesProviderTypeFieldsContainer;
-        var widgets = registry.findWidgets(typeFieldsContainer);
-        array.forEach(widgets, function(item) { item.destroyRecursive();});
-        domConstruct.empty(typeFieldsContainer);
-        this._toggleWidgets(type);
-        if (type)
-        {
-            if (type == "None")
-            {
-                this.preferencesProviderNameWidget.set("value", "");
-            }
-            else
-            {
-                var that = this;
-                require([ "qpid/management/preferencesprovider/" + 
type.toLowerCase() + "/add"], function(typeUI)
-                {
-                    try
-                    {
-                        typeUI.show({containerNode:typeFieldsContainer, 
parent: that, data: that.data});
-                        if (that.metadata)
-                        {
-                            util.applyMetadataToWidgets(typeFieldsContainer, 
"PreferencesProvider", type, that.metadata);
-                        }
-                    }
-                    catch(e)
-                    {
-                        console.warn(e);
-                    }
-                });
-            }
-        }
-    },
-    _toggleWidgets: function(type)
-    {
-        if (this.disabled)
-        {
-            this.preferencesProviderNameWidget.set("disabled", true);
-            this.preferencesProviderTypeWidget.set("disabled", true);
-        }
-        else
-        {
-            if (this.data)
-            {
-                // editing
-                this.preferencesProviderNameWidget.set("disabled", true);
-                this.preferencesProviderTypeWidget.set("disabled", true);
-            }
-            else
-            {
-                this.preferencesProviderNameWidget.set("disabled", !type || 
type == "None");
-                this.preferencesProviderTypeWidget.set("disabled", false);
-            }
-        }
-    },
-    _setDisabledAttr: function(disabled)
-    {
-        this.inherited(arguments);
-        this.disabled = disabled;
-        if (disabled)
-        {
-            this.reset();
-        }
-        else
-        {
-            this._toggleWidgets(this.preferencesProviderTypeWidget.value);
-        }
-    }
-  });
-});
+                                  if (this.metadata)
+                                  {
+                                      setMetadata(this.metadata);
+                                  }
+                                  
this.preferencesProviderTypeWidget.on("change", function (type)
+                                  {
+                                      
that._preferencesProviderTypeChanged(type);
+                                  });
+                                  this.preferencesProviderForm.on("submit", 
function ()
+                                  {
+                                      return false;
+                                  })
+                              },
+                              reset: function ()
+                              {
+                                  this.data = null;
+                                  this.preferencesProviderForm.reset();
+                                  
this.preferencesProviderTypeWidget.set("value", "None");
+                              },
+                              submit: function (submitFunction, 
providerNotDefinedCallback)
+                              {
+                                  if 
(this.preferencesProviderTypeWidget.get("value") != "None")
+                                  {
+                                      var preferencesProviderData = 
util.getFormWidgetValues(this.preferencesProviderForm,
+                                                                               
              this.data)
+                                      submitFunction(preferencesProviderData);
+                                  }
+                                  else
+                                  {
+                                      providerNotDefinedCallback();
+                                  }
+                              },
+                              getPreferencesProviderName: function ()
+                              {
+                                  return 
this.preferencesProviderNameWidget.get("value");
+                              },
+                              setPreferencesProviderName: function (name)
+                              {
+                                  if (!(this.data && this.data.name))
+                                  {
+                                      
this.preferencesProviderNameWidget.set("value", name);
+                                  }
+                              },
+                              setMetadata: function (metadata)
+                              {
+                                  this.metadata = metadata;
+                                  var supportedPreferencesProviderTypes = 
metadata.getTypesForCategory(
+                                      "PreferencesProvider");
+                                  supportedPreferencesProviderTypes.sort();
+                                  supportedPreferencesProviderTypes.splice(0, 
0, "None");
+                                  var preferencesProviderTypeStore = 
util.makeTypeStore(
+                                      supportedPreferencesProviderTypes);
+                                  
this.preferencesProviderTypeWidget.set("store", preferencesProviderTypeStore);
+                              },
+                              validate: function ()
+                              {
+                                  return 
this.preferencesProviderForm.validate();
+                              },
+                              setData: function (data)
+                              {
+                                  this._load(data);
+                              },
+                              _load: function (data)
+                              {
+                                  data = data || {}
+                                  this.data = data;
+                                  
this.preferencesProviderNameWidget.set("value", data.name);
+                                  if (data.type == 
this.preferencesProviderTypeWidget.get("value"))
+                                  {
+                                      // re-create UI anyway
+                                      
this._preferencesProviderTypeChanged(data.type);
+                                  }
+                                  else
+                                  {
+                                      
this.preferencesProviderTypeWidget.set("value", data.type);
+                                  }
+                              },
+                              _preferencesProviderTypeChanged: function (type)
+                              {
+                                  var typeFieldsContainer = 
this.preferencesProviderTypeFieldsContainer;
+                                  var widgets = 
registry.findWidgets(typeFieldsContainer);
+                                  array.forEach(widgets, function (item)
+                                  {
+                                      item.destroyRecursive();
+                                  });
+                                  domConstruct.empty(typeFieldsContainer);
+                                  this._toggleWidgets(type);
+                                  if (type)
+                                  {
+                                      if (type == "None")
+                                      {
+                                          
this.preferencesProviderNameWidget.set("value", "");
+                                      }
+                                      else
+                                      {
+                                          var that = this;
+                                          
require(["qpid/management/preferencesprovider/" + type.toLowerCase()
+                                                   + "/add"], function (typeUI)
+                                                  {
+                                                      try
+                                                      {
+                                                          typeUI.show({
+                                                                          
containerNode: typeFieldsContainer,
+                                                                          
parent: that,
+                                                                          
data: that.data
+                                                                      });
+                                                          if (that.metadata)
+                                                          {
+                                                              
util.applyMetadataToWidgets(typeFieldsContainer,
+                                                                               
           "PreferencesProvider",
+                                                                               
           type,
+                                                                               
           that.metadata);
+                                                          }
+                                                      }
+                                                      catch (e)
+                                                      {
+                                                          console.warn(e);
+                                                      }
+                                                  });
+                                      }
+                                  }
+                              },
+                              _toggleWidgets: function (type)
+                              {
+                                  if (this.disabled)
+                                  {
+                                      
this.preferencesProviderNameWidget.set("disabled", true);
+                                      
this.preferencesProviderTypeWidget.set("disabled", true);
+                                  }
+                                  else
+                                  {
+                                      if (this.data)
+                                      {
+                                          // editing
+                                          
this.preferencesProviderNameWidget.set("disabled", true);
+                                          
this.preferencesProviderTypeWidget.set("disabled", true);
+                                      }
+                                      else
+                                      {
+                                          
this.preferencesProviderNameWidget.set("disabled", !type || type == "None");
+                                          
this.preferencesProviderTypeWidget.set("disabled", false);
+                                      }
+                                  }
+                              },
+                              _setDisabledAttr: function (disabled)
+                              {
+                                  this.inherited(arguments);
+                                  this.disabled = disabled;
+                                  if (disabled)
+                                  {
+                                      this.reset();
+                                  }
+                                  else
+                                  {
+                                      
this._toggleWidgets(this.preferencesProviderTypeWidget.value);
+                                  }
+                              }
+                          });
+       });

Modified: 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js?rev=1741609&r1=1741608&r2=1741609&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js
 (original)
+++ 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js
 Fri Apr 29 11:04:40 2016
@@ -17,14 +17,12 @@
  * under the License.
  */
 
-define(["dojo/query", "dijit/registry", "qpid/common/util"],
-  function (query, registry, util)
-  {
+define(["dojo/query", "dijit/registry", "qpid/common/util"], function (query, 
registry, util)
+{
     return {
         show: function (data)
         {
-            util.parseHtmlIntoDiv(data.containerNode, 
"preferencesprovider/filesystempreferences/add.html",
-            function()
+            util.parseHtmlIntoDiv(data.containerNode, 
"preferencesprovider/filesystempreferences/add.html", function ()
             {
                 if (data.data)
                 {
@@ -34,5 +32,4 @@ define(["dojo/query", "dijit/registry",
             });
         }
     };
-  }
-);
+});

Modified: 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/show.js
URL: 
http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/show.js?rev=1741609&r1=1741608&r2=1741609&view=diff
==============================================================================
--- 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/show.js
 (original)
+++ 
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/show.js
 Fri Apr 29 11:04:40 2016
@@ -18,31 +18,33 @@
  * under the License.
  *
  */
-define(["dojo/_base/xhr",
-        "dojo/parser",
-        "dojo/string",
-        "dojox/html/entities",
-        "dojo/query",
-        "dojo/domReady!"],
-    function (xhr, parser, json, entities, query) {
+define(["dojo/_base/xhr", "dojo/parser", "dojo/string", "dojox/html/entities", 
"dojo/query", "dojo/domReady!"],
+       function (xhr, parser, json, entities, query)
+       {
 
-  function FileSystemPreferences(containerNode) {
-    var that = this;
-    xhr.get({url: "preferencesprovider/filesystempreferences/show.html",
-      sync: true,
-      load:  function(template) {
-        containerNode.innerHTML = template;
-        parser.parse(containerNode).then(function(instances)
-        {
-            
that.preferencesProviderPath=query(".fileSystemPreferencesProviderPath", 
containerNode)[0];
-        });
-      }});
-  }
+           function FileSystemPreferences(containerNode)
+           {
+               var that = this;
+               xhr.get({
+                           url: 
"preferencesprovider/filesystempreferences/show.html",
+                           sync: true,
+                           load: function (template)
+                           {
+                               containerNode.innerHTML = template;
+                               parser.parse(containerNode).then(function 
(instances)
+                                                                {
+                                                                    
that.preferencesProviderPath = query(
+                                                                        
".fileSystemPreferencesProviderPath",
+                                                                        
containerNode)[0];
+                                                                });
+                           }
+                       });
+           }
 
-  FileSystemPreferences.prototype.update=function(data)
-  {
-    this.preferencesProviderPath.innerHTML = 
entities.encode(String(data["path"]));
-  };
+           FileSystemPreferences.prototype.update = function (data)
+           {
+               this.preferencesProviderPath.innerHTML = 
entities.encode(String(data["path"]));
+           };
 
-  return FileSystemPreferences;
-});
+           return FileSystemPreferences;
+       });




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to