docs: function ResetTreeWithRootInfo(root_docs, entity_counts, filter_manager){
  
      // Nuke current tree and put in "spinner" placeholder.
      try {
  	jQuery('#' + bid).jstree(true).destroy();
  	console.log('found a tree and destroyed it');
      }catch(err){
  	console.log('no tree found');
      }
      //jQuery('#' + bid).empty();
      jQuery('#' + bid).html('<h4>Loading tree...</h4>');
      
      // Convert a term callback into the proper json. This method is
      // used for the initial graph creation.
      function _roots2json(doc){
  
  	var root_id = doc['annotation_class'];
  	console.log("_roots2json: " +
  		    doc + ', ' +
  		    root_id + ', ' +
  		    entity_counts[root_id]);
  
  	// Extract the intersting graphs.
  	var topo_graph_field = 'topology_graph_json';
  	var trans_graph_field = 'regulates_transitivity_graph_json';
  	var topo_graph = new model.graph();
  	topo_graph.load_base_json(JSON.parse(doc[topo_graph_field]));
  	var trans_graph = new model.graph();
  	trans_graph.load_base_json(JSON.parse(doc[trans_graph_field]));
  
  	//
  	var kids_p = false;
  	var kids = [];
  	us.each(topo_graph.get_child_nodes(root_id), function(kid){
  	    kids.push({
  		'id': kid.id(),
  		'text': kid.label() || kid.id()
  	    });
  	});
  	if( kids.length > 0 ){
  	    kids_p = true;
  	}
  
  	// Using the badge template, get the spans for the IDs.
  	var ac_badges = new CountBadges(filter_manager);
  	var id_to_badge_text =
  		ac_badges.make_badge(root_id, entity_counts[root_id]);
  	var lbl_txt = doc['annotation_class_label'] || root_id;
  	    
  	var tmpl = {
  	    'id': root_id,
  	    'icon': 'glyphicon glyphicon-record',
  	    'text': lbl_txt + id_to_badge_text,
  	    //'icon': "string",
  	    'state': {
  		'opened': false,
  		'disabled': false,
  		'selected': false
  	    },
  	    'children': kids_p,
  	    'li_attr': {},
  	    'a_attr': {}
  	};
  
  	return tmpl;
      }
  
      // Convert a term children's into the proper json.
      function _resp2json(doc){
  	console.log("_resp2json: " + doc);
  
  	var kids = []; // ret
  
  	// Extract the intersting graphs.
  	var topo_graph_field = 'topology_graph_json';
  	var trans_graph_field = 'regulates_transitivity_graph_json';
  	var topo_graph = new model.graph();
  	topo_graph.load_base_json(JSON.parse(doc[topo_graph_field]));
  	var trans_graph = new model.graph();
  	trans_graph.load_base_json(JSON.parse(doc[trans_graph_field]));
  
  	//console.log('topo: ' + doc[topo_graph_field]);
  
  	// Collect child ids.
  	var child_ids = [];
  	us.each(topo_graph.get_child_nodes(doc['id']), function(kid){
  	    child_ids.push(kid.id());
  	});
  
  	// Using the badger, get the spans for the IDs.
  	var ac_badges = new CountBadges(filter_manager);
  	var ids_to_badge_text = ac_badges.get_future_badges(child_ids);
  
  	//
  	us.each(topo_graph.get_child_nodes(doc['id']), function(kid){
  
  	    // Extract some info.
  	    var oid = doc['id'];
  	    var sid = kid.id();
  	    var preds = topo_graph.get_predicates(sid, oid);
  	    var imgsrc = bbop.resourcify(sd.image_base, preds[0], 'gif');
  
  	    var lbl_txt =  kid.label() || sid;
  	    
  	    // Push template.
  	    kids.push({
  		'id': sid,
  		'text': lbl_txt + ids_to_badge_text[sid],
  		'icon': imgsrc,
  		'state': {
  		    'opened': false,
  		    'disabled': false,
  		    'selected': false
  		},
  		'children': true, // unknowable w/o lookahead
  		'li_attr': {},
  		'a_attr': {}
  	    });
  	});
  
  	return kids;
      }
  
      ///
      /// The initial search manager.
      ///
  
      var roots = [];
      us.each(root_docs, function(doc){
  	var json = _roots2json(doc);
  	roots.push(json);
      });
  
      //console.log(JSON.stringify(json));
      
      // Render initial widget.
      jQuery('#' + bid).empty();
      jQuery('#' + bid).jstree({
  	'plugins' : ['sort'],
  	'core': {
  	    'multiple': false,
  	    'data': function(jstree_node, cb){
  		console.log("initial node work: " + jstree_node.id);
  		if( jstree_node.id === '#' ){
  		    cb(roots);
  		}else{
  		    var csearch = _create_manager('ontology');
  		    csearch.register('search', function(resp,man){
  			var children = [];
  			if( resp && resp.documents() &&
  			    resp.documents()[0] ){
  				children = _resp2json(resp.documents()[0]);
  			    }
  			cb(children);
  		    });
  		    csearch.set_id(jstree_node.id);
  		    csearch.search();
  		}
  	    }
  	}
      });
      // .on("create_node.jstree", function(node){
      // 	console.log('create_node.jstree', node);
      //   });
  
      ///
      /// The info shield.
      ///
  
      jQuery('#' + bid).on('select_node.jstree', function(node, data){
  
  	//console.log('node', node);
  
  	// Collect selection (possibly more than one).
  	var r = [];
  	us.each(data.selected, function(item){
  	    r.push(data.instance.get_node(item)['id']);
  	});
  	console.log('Selected: ' + r.join(', '));
  	if( r.length !== 1 ){
  	    alert('selection got weird: ' + r.length);
  	}else{
  
  	    //
  	    var o = _create_manager('ontology');
  	    var tid = r[0];
  	    o.set_id(tid);
  	    o.register('search', function(resp){
  
  		console.log('resp', resp);
  
  		var doc = resp.get_doc(0);
  		var confc = gconf.get_class('ontology');
  
  		// Add-ons.
  		var add_ons = [];
  
  		// Add a link to the entity search.
  		var ann_man = _create_manager('bioentity');
  		ann_man.add_query_filter('regulates_closure', tid);
  		//ann_man.add_query_filter('isa_partof_closure', tid);
  
  		// Stack on the filters from the filter box.
  		var filter_strs = _get_filters(filter_manager);
  		us.each(filter_strs, function(fas){
  		    ann_man.add_query_filter_as_string(fas, []);
  		});
  
  		// Produce final URL.
  		var lstate = ann_man.get_filter_query_string();
  		var lurl = linker.url(lstate, 'search', 'bioentity');
  
  		add_ons.push(['Gene products', '<a href="' + lurl + '" target="_blank"><b>retrieve gene products annotated to this term for this filter set</b></a>']);
  
  		// 
  		widgets.display.term_shield(doc, confc, linker, {}, add_ons);
  	    });
  	    o.search();
  	}
      });
  
  }