Example #1
0
  protected void genChildren(Hashtable linkTable, OutlineNode node, Hashtable visited, Article root)
      throws ZenoException {

    Integer nodeId = new Integer(node.getId());
    OutlineNode rnode = (OutlineNode) visited.get(nodeId);
    if (rnode != null) {
      node.setDuplicate(true);
      node.setOriginalPosition(rnode.getPosition());
      rnode.setDuplicated(true);
      return;
    }

    visited.put(nodeId, node);

    List links = (List) linkTable.get(nodeId);
    if (links != null) {
      Iterator it = links.iterator();
      while (it.hasNext()) {
        LinkImpl link1 = (LinkImpl) it.next();
        OutlineNode cnode = genOutlineNode(link1, nodeId.intValue());
        if (root != null) cnode.genMark(root);
        if (!extended || cnode.getResource() != null) node.add(cnode);
      }
      Collections.sort(node.getChildren(), comparator);
    }
    Iterator cit = node.getChildren().iterator();
    int nr = 1;
    while (cit.hasNext()) {
      OutlineNode cnode = (OutlineNode) cit.next();
      String newPosition = node.getPosition() + "." + nr++;
      cnode.setPosition(newPosition);
      genChildren(linkTable, cnode, visited, root);
    }
  }