/** * Only load children as needed, so don't have to load OutlineItems that the user has not even * browsed to */ private void ensureChildrenLoaded() { if (!loadedChildren) { loadedChildren = true; int count = item.getSubItemCount(); for (int i = 0; i < count; i++) { OutlineItem child = item.getSubItem(i); OutlineItemTreeNode childTreeNode = new OutlineItemTreeNode(pageTree, child); add(childTreeNode); } } }
public NodeUserObject(PageTree pageTree, OutlineItemTreeNode outlineItemTreeNode) { super(outlineItemTreeNode); // append the destination page number if (outlineItemTreeNode.getOutlineItem().getDest() != null) { goToPage = pageTree.getPageNumber( outlineItemTreeNode.getOutlineItem().getDest().getPageReference()); } else if (outlineItemTreeNode.getOutlineItem().getAction() != null) { OutlineItem item = outlineItemTreeNode.getOutlineItem(); Destination dest; if (item.getAction() != null) { Action action = item.getAction(); if (action instanceof GoToAction) { dest = ((GoToAction) action).getDestination(); } else { Library library = action.getLibrary(); Hashtable entries = action.getEntries(); dest = new Destination(library, library.getObject(entries, "D")); } goToPage = pageTree.getPageNumber(dest.getPageReference()); } } // set title setText(outlineItemTreeNode.getOutlineItem().getTitle()); // setup not state. setLeafIcon("tree_document.gif"); setBranchContractedIcon("tree_document.gif"); setBranchExpandedIcon("tree_document.gif"); // is item a node or a leaf. if (outlineItemTreeNode.getOutlineItem().getSubItemCount() > 0) { setLeaf(false); } else { setLeaf(true); } }