private void initChildren() {
    BinTreeTableNode root = (BinTreeTableNode) getRoot();

    BinClass clazz = (BinClass) root.getBin();

    BinMethod[] overriddables = OverrideMethodsRefactoring.getOverridableMethods(clazz);

    // group by subclass
    MultiValueMap map = new MultiValueMap();

    for (int i = 0; i < overriddables.length; i++) {
      map.putAll(overriddables[i].getOwner(), overriddables[i]);
    }

    isEmpty = (overriddables.length == 0);

    List keys = new ArrayList(map.keySet());

    Collections.sort(keys, new TypeRefHierarchyComparator());

    for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
      BinTypeRef item = (BinTypeRef) iter.next();

      //      if (Assert.enabled) {
      //        Assert.must(!item.equals(targetClass.getOwner()),
      //            "overridable should be only superclass methods!");
      //      }
      BinTreeTableNode node = new BinTreeTableNode(item);

      root.addChild(node);

      addMethodNodes(node, map.get(item));
    }
  }
  public List getSelectedList() {
    List result = new ArrayList();

    BinTreeTableNode rootNode = (BinTreeTableNode) getRoot();

    for (int i = 0, max = rootNode.getChildCount(); i < max; i++) {
      BinTreeTableNode subclassNode = (BinTreeTableNode) rootNode.getChildAt(i);
      //      if (!subclassNode.isSelected()) {
      //        continue;
      //      }

      for (int j = 0, maxJ = subclassNode.getChildCount(); j < maxJ; ++j) {
        BinTreeTableNode methodNode = (BinTreeTableNode) subclassNode.getChildAt(j);

        if (methodNode.isSelected()) {
          result.add(methodNode.getBin());
        }
      }
    }

    // FIXES tests ;)
    Collections.sort(
        result,
        new Comparator() {
          public int compare(Object obj1, Object obj2) {
            return ((BinMethod) obj1).getName().compareTo(((BinMethod) obj2).getName());
          }
        });

    return result;
  }
  private void addMethodNodes(BinTreeTableNode parentNode, List collection) {
    Collections.sort(
        collection,
        new Comparator() {
          public int compare(Object obj1, Object obj2) {
            return ((BinMethod) obj1).getName().compareTo(((BinMethod) obj2).getName());
          }
        });

    for (Iterator iter = collection.iterator(); iter.hasNext(); ) {
      BinMethod item = (BinMethod) iter.next();

      BinTreeTableNode child = new BinTreeTableNode(item);

      parentNode.addChild(child);

      child.setSelected(item.isAbstract());
    }
  }
 /**
  * The idea is that this method will be called every time a node is inserted or removed from the
  * tree. (BTW we are assuming here that it is impossible to change a priority of an existing
  * node.)
  */
 protected void invalidateCacheOfVisibleChildren() {
   super.invalidateCacheOfVisibleChildren();
   if (model != null) {
     model.notifyNodesAddedOrRemoved();
   }
 }