/**
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
public void update(Observable observable, Object obj) {
if (obj == null) {
setModel(new DefaultTreeModel(new OutlineTreeNode()));
repaint();
return;
}
if (obj instanceof ObjectLoader) {
ObjectLoader loader = (ObjectLoader)obj;
TreeNodeFactory factory = loader.getNodes();
PdfTrailerTreeNode trailer = controller.getPdfTree().getRoot();
PdfObjectTreeNode catalog = factory.getChildNode(trailer, PdfName.ROOT);
PdfObjectTreeNode outline = factory.getChildNode(catalog, PdfName.OUTLINES);
if (outline == null) {
return;
}
OutlineTreeNode root = new OutlineTreeNode();
loadOutline(factory, root, factory.getChildNode(outline, PdfName.FIRST));
setModel(new DefaultTreeModel(root));
}
}