Package com.itextpdf.rups.view.itext.treenodes

Examples of com.itextpdf.rups.view.itext.treenodes.OutlineTreeNode


  /** Creates a new outline tree. */
  public OutlineTree(PdfReaderController controller) {
    super();
    this.controller = controller;
    setCellRenderer(new IconTreeCellRenderer());
    setModel(new DefaultTreeModel(new OutlineTreeNode()));
    addTreeSelectionListener(this);
  }
View Full Code Here


  /**
   * @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));
    }
  }
View Full Code Here

 
  /**
   * Method that can be used recursively to load the outline hierarchy into the tree.
   */
  private void loadOutline(TreeNodeFactory factory, OutlineTreeNode parent, PdfObjectTreeNode child) {
    OutlineTreeNode childnode = new OutlineTreeNode(child);
    parent.add(childnode);
    PdfObjectTreeNode first = factory.getChildNode(child, PdfName.FIRST);
    if (first != null) {
      loadOutline(factory, childnode, first);
    }
View Full Code Here

   * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
   */
  public void valueChanged(TreeSelectionEvent evt) {
    if (controller == null)
      return;
    OutlineTreeNode selectednode = (OutlineTreeNode)this.getLastSelectedPathComponent();
    PdfObjectTreeNode node = selectednode.getCorrespondingPdfObjectNode();
    if (node != null)
      controller.selectNode(node);
  }
View Full Code Here

TOP

Related Classes of com.itextpdf.rups.view.itext.treenodes.OutlineTreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.