});
}
public void setSelectedAutoGroup(final Integer selectedAutoGroupId) {
AutoGroupTreeNode selectedNode = autoGroupNodeMap.get(selectedAutoGroupId);
if (treeGrid != null && treeGrid.getTree() != null && selectedNode != null
&& null != treeGrid.getTree().findById(selectedNode.getID())) {
// This is the case where the tree was previously loaded and we get fired to look at a different
// node in the same tree and just have to switch the selection
this.selectedNodeId = selectedNode.getID();
updateSelection();
} else {
// This is for cases where we have to load the tree fresh including down to the currently visible node
final ResourceGroupGWTServiceAsync resourceGroupService = GWTServiceLookup.getResourceGroupService();
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.addFilterId(selectedAutoGroupId);
criteria.addFilterVisible(false);
criteria.fetchResourceType(true);
CoreGUI.showBusy(true);;
resourceGroupService.findResourceGroupsByCriteria(criteria, new AsyncCallback<PageList<ResourceGroup>>() {
public void onFailure(Throwable caught) {
CoreGUI.showBusy(false);;
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_node(), caught);
}
public void onSuccess(PageList<ResourceGroup> result) {
final ResourceGroup backingGroup = result.get(0);
// load the tree up to the autogroup's parent resource. Don't select the resource node
// to avoid an unnecessary navigation to the resource, we just need the tree in place so
// we can navigate to the autogroup node.
loadTree(backingGroup.getAutoGroupParentResource().getId(), false, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.showBusy(false);;
CoreGUI.getErrorHandler().handleError(MSG.view_tree_common_loadFailed_children(), caught);
}
public void onSuccess(Void arg) {
// get the node ID and use it to add a map entry, then call this again to finish up...
selectedNodeId = AutoGroupTreeNode.idOf(backingGroup.getAutoGroupParentResource(),
backingGroup.getResourceType());
AutoGroupTreeNode agNode = (AutoGroupTreeNode) treeGrid.getTree().findById(selectedNodeId);
autoGroupNodeMap.put(backingGroup.getId(), agNode);
updateSelection();
CoreGUI.showBusy(false);;
}