code: private void updateSelection(Object node)
      {
          State newState = getSelectionState(node);
          List<Object> descendants = 
              JTrees.getAllDescendants(getModel(), node);
          for (Object descendant : descendants)
          {
              setSelectionState(descendant, newState, false);
          }
          
          Object ancestor = JTrees.getParent(getModel(), node);
          while (ancestor != null)
          {
              List<Object> childrenOfAncestor = 
                  JTrees.getChildren(getModel(), ancestor);
              State stateForAncestor = computeState(childrenOfAncestor);
              setSelectionState(ancestor, stateForAncestor, false);
              ancestor = JTrees.getParent(getModel(), ancestor);
          }
      }
docs: Update the selection state of the given node based on the state
  of its children
  
  @param node The node