 # fills the treeview accordingly
 fillTree = (parent, keys) ->
   for name, subkeys of keys
+    fullname = ((parent?.get("fullname") && (parent.get("fullname") + ".")) || "") + name
     node = Ext.create "KeyModel",
       name: name
+      fullname: fullname
     parent.appendChild(node)
     fillTree(node, subkeys)
 

# Calls given callback with the hash as an argument
# Currently uses mockmule.
getMuleKeys = (fn) ->
  url = "http://localhost:3000/key?jsonp=callback"
  window.callback = (response) ->
      keys = response.data
      fn(keys)
  scriptTag = document.createElement("script")
  scriptTag.src=url
  scriptTag.type="text/javascript"

  width: "20%"
  split: true
  displayField: "name"
  listeners:
    selectionchange: (me, selected) ->
      console.log('muleview.coffee\\ 32: selected[0].get("fullname"):', selected[0].get("fullname"));
  # rootVisible: false
  store: treeStore

