Skip to content

Commit

Permalink
Refactored tree initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Rossi committed Dec 22, 2015
1 parent 13a0879 commit 0b239ae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
13 changes: 9 additions & 4 deletions src/main/webapp/resources/net/apachegui/ConfigurationTree.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//TODO stub out this file into a re-usable widget for GlobalTree.js
//TODO VirtualHost js should end up using this widget
//TODO VirtualHost js should end up using this widget (started)
define([
"dojo/_base/declare",
"dojo/dom",
Expand Down Expand Up @@ -27,7 +27,11 @@ define([
menu: null,
currentTreeItem: null,
editable: true,
treeJSON: {},
treeJSON: {
identifier: "id",
items: [],
label: "name"
},
autoExpand: false,
inputAutoSuggest: null,

Expand All @@ -52,7 +56,7 @@ define([
*/
constructor: function(params){
this.id = params.id;
this.treeJSON = params.treeJSON || {};
this.treeJSON = params.treeJSON || this.treeJSON;
this.autoExpand = params.autoExpand || false;
this.loadTreeJSON = params.loadTreeJSON || this.loadTreeJSON;

Expand Down Expand Up @@ -111,7 +115,7 @@ define([
});

this.menu.addChild(new MenuItem({
label : "Exapnd All",
label : "Expand All",
onClick : function() {
that.expandAll();
}
Expand Down Expand Up @@ -163,6 +167,7 @@ define([

startup: function() {
this.tree.startup();
this.reload();
},

destroy: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,14 @@ define([
},

buildGlobalTree: function() {
var that = this;

this.loadGlobalTreeJSON(function(treeJSON) {
that.configTree = new ConfigurationTree({
id: 'global_tree',
treeJSON: treeJSON,
loadTreeJSON: that.loadGlobalTreeJSON
});
that.configTree.startup();
that.addListeners();

domConstruct.place(that.configTree.domNode, dom.byId('global_tree_container'), 'last');
this.configTree = new ConfigurationTree({
id: 'global_tree',
loadTreeJSON: this.loadGlobalTreeJSON
});
this.configTree.startup();
this.addListeners();

domConstruct.place(this.configTree.domNode, dom.byId('global_tree_container'), 'last');
},

addListeners: function() {
Expand Down

0 comments on commit 0b239ae

Please sign in to comment.