code: public static void processTreeRequest(String treeId, TreeElement treeRoot, HttpServletRequest request, HttpServletResponse response)
      {
          assert(treeId != null) : "parameter treeId must not be null.";
          assert(treeRoot != null) : "parameter treeRoot must not be null.";
          assert(request != null) : "paramater request must not be null.";
  
          // check the root node to see if it is a TreeRootElement.  if it is, then we
          // use it to change the selected node.  Otherwise we will do a recursive search
          // of the tree to select the node.
          String selectNode = request.getParameter(TreeElement.SELECTED_NODE);
          if (selectNode != null) {
              if (treeRoot instanceof ITreeRootElement) {
                  ITreeRootElement root = (ITreeRootElement) treeRoot;
                  root.changeSelected(selectNode, request);
              }
              else {
                  setSelected(treeRoot, selectNode, request);
              }
          }
  
          // handle auto expand.
          String expandNode = null;
  
          // our we auto expanding this node?
          expandNode = request.getParameter(TreeElement.EXPAND_NODE);
  
          // if we are auto expanding flip the expand of this node if it was expanded
          if (expandNode != null) {
              TreeElement n = treeRoot.findNode(expandNode);
              if (n != null) {
                  n.onExpand(request, response);
                  n.setExpanded(!n.isExpanded());
              }
          }
      }
docs: If this tree was selected or expanded this will handle that processing.
  @param treeId
  @param treeRoot
  @param request