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

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


      setChanged();
      notifyObservers(null);
      nodes = null;
    }
    if (obj instanceof PdfObjectTreeNode) {
      PdfObjectTreeNode node = (PdfObjectTreeNode)obj;
      nodes.expandNode(node);
      if (node.isRecursive()) {
        pdfTree.selectNode(node.getAncestor());
        return;
      }/*
      if (node.isIndirect()) {
        xref.selectRowByReference(node.getNumber());
        return;
      }*/
      render(node.getPdfObject());
    }
  }
 
View Full Code Here


   * @param ref  the reference number of the indirect object.
   * @return  the TreeNode representing the PDF object
   */
  public PdfObjectTreeNode getNode(int ref) {
    int idx = objects.getIndexByRef(ref);
    PdfObjectTreeNode node = nodes.get(idx);
    if (node.getPdfObject().isNull()) {
      node = PdfObjectTreeNode.getInstance(objects.loadObjectByReference(ref), ref);
      nodes.set(idx, node);
    }
    return node;
  }
View Full Code Here

  public void expandNode(PdfObjectTreeNode node) {
    if (node.getChildCount() > 0) {
      return;
    }
    PdfObject object = node.getPdfObject();
    PdfObjectTreeNode leaf;
    switch (object.type()) {
    case PdfObject.INDIRECT:
      PdfIndirectReference ref = (PdfIndirectReference)object;
      leaf = getNode(ref.getNumber());
      addNodes(node, leaf);
View Full Code Here

   * @param  key    the key of the item corresponding with the node we need
   */
  @SuppressWarnings("unchecked")
        public PdfObjectTreeNode getChildNode(PdfObjectTreeNode node, PdfName key) {
    Enumeration<PdfObjectTreeNode> children = node.breadthFirstEnumeration();
    PdfObjectTreeNode child;
    while (children.hasMoreElements()) {
      child = children.nextElement();
      if (child.isDictionaryNode(key)) {
        if (child.isIndirectReference()) {
          expandNode(child);
          child = (PdfObjectTreeNode)child.getFirstChild();
        }
        expandNode(child);
        return child;
      }
    }
View Full Code Here

      ObjectLoader loader = (ObjectLoader)obj;
      String[] pagelabels = PdfPageLabels.getPageLabels(loader.getReader());
      int i = 0;
      TreeNodeFactory factory = loader.getNodes();
      PdfTrailerTreeNode trailer = controller.getPdfTree().getRoot();
      PdfObjectTreeNode catalog = factory.getChildNode(trailer, PdfName.ROOT);
      PdfPagesTreeNode pages = (PdfPagesTreeNode)factory.getChildNode(catalog, PdfName.PAGES);
      if (pages == null) {
        return;
      }
      Enumeration<PdfObjectTreeNode> p = pages.depthFirstEnumeration();
      PdfObjectTreeNode  child;
      StringBuffer buf;
      while (p.hasMoreElements()) {
        child = p.nextElement();
        if (child instanceof PdfPageTreeNode) {
          buf = new StringBuffer("Page ");
          buf.append(++i);
          if (pagelabels != null) {
            buf.append(" ( ");
            buf.append(pagelabels[i - 1]);
            buf.append(" )");
          }
          child.setUserObject(buf.toString());
          list.add((PdfPageTreeNode)child);
        }
      }
    }
    setModel(new JTableAutoModel(this));
View Full Code Here

    }
    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));
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);
    }
    PdfObjectTreeNode next = factory.getChildNode(child, PdfName.NEXT);
    if (next != null) {
      loadOutline(factory, parent, next);
    }
  }
View Full Code Here

   */
  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

    }
    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 form = factory.getChildNode(catalog, PdfName.ACROFORM);
      if (form == null) {
        return;
      }
      PdfObjectTreeNode fields = factory.getChildNode(form, PdfName.FIELDS);
      FormTreeNode root = new FormTreeNode();
      if (fields != null) {
        FormTreeNode node = new FormTreeNode(fields);
        node.setUserObject("Fields");
        loadFields(factory, node, fields);
        root.add(node);
      }
      PdfObjectTreeNode xfa = factory.getChildNode(form, PdfName.XFA);
      if (xfa != null) {
        XfaTreeNode node = new XfaTreeNode(xfa);
        node.setUserObject("XFA");
        loadXfa(factory, node, xfa);
        root.add(node);
View Full Code Here

      }
    }
    else if (object_node.isDictionary()) {
      FormTreeNode leaf = new FormTreeNode(object_node);
      form_node.add(leaf);
      PdfObjectTreeNode kids = factory.getChildNode(object_node, PdfName.KIDS);
      loadFields(factory, leaf, kids);
    }
  }
View Full Code Here

TOP

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

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.