Skip to content

Commit

Permalink
Working on Global config tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Rossi committed Nov 28, 2015
1 parent 68b4c7d commit 3597b3f
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/apachegui/conf/ConfigurationTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static JSONObject toTreeJSON(ParsableLine parsableLines[], String rootNod

children.put("id", 0);
children.put("name", rootNodeName);
children.put("type", "");
children.put("type", "rootNode");
children.put("value", "");
children.put("file", SettingsDao.getInstance().getSetting(Constants.CONF_FILE));
children.put("lineOfStart", -1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

<div id="global_tree_container">


</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//TODO stub out this file into a re-usable widget for GlobalTree.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,85 @@
define([ "dojo/_base/declare"
define([
"dojo/_base/declare",
"dojo/request",
"dojo/dom",
"dojo/data/ItemFileWriteStore",
"dojo/store/Observable",
"net/apachegui/RefreshableTree",
"dijit/Tree",
"dijit/tree/ForestStoreModel",
"dojo/dom-construct"

], function(declare){
], function(declare, request, dom, ItemFileWriteStore, Observable, RefreshableTree, Tree, ForestStoreModel, domConstruct){

declare("net.apachegui.globalsettings.GlobalTree", null, {

initialized: false,

init: function () {
if(this.initialized===false) {
this.buildGlobalTree();
this.addListeners();
this.initialized=true;
}
},

buildGlobalTree: function() {
request.get('../web/GlobalTree', {
query: {
option: 'getGlobalTree'
},
handleAs: 'json',
preventCache: true,
sync: false
}).response.then(function (response) {
var data = response.data;
var tree = data.tree;

var store = new ItemFileWriteStore({
data : tree
});
store = new Observable(store);

var treeModel = new ForestStoreModel({
store : store,
query : {
"type" : "rootNode"
},
rootId : 0,
childrenAttrs : [ "children" ],
id : 'GlobalTreeModel'
});

var HostTreeNode = declare(Tree._TreeNode, {
_setLabelAttr : {
node : "labelNode",
type : "innerHTML"
}
});

var hostTree = new RefreshableTree({
model : treeModel,
showRoot : false,
autoExpand : true,
openOnClick : true,
id : 'GlobalTreeTree',
persist : true,
_createTreeNode : function(args) {
return new HostTreeNode(args);
}
});

var div = document.createElement('div');
div.id = 'global_tree';
div.appendChild(hostTree.domNode);

domConstruct.place(div, dom.byId('global_tree_container'), 'last');

hostTree.startup();

});
},

addListeners: function() {

}
Expand Down

0 comments on commit 3597b3f

Please sign in to comment.