Package com.sun.pdfview

Examples of com.sun.pdfview.OutlineNode


    ByteBuffer buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
    pdfFile = new PDFFile(buf);

    pageStart = 0;
    pageEnd = pdfFile.getNumPages();
    OutlineNode on = pdfFile.getOutline();
    if (on != null) {
      for (int i = 0; i < on.getChildCount(); i++) {
        OutlineNode child = (OutlineNode) on.getChildAt(i);
        GoToAction act = (GoToAction) child.getAction();

        //Find the beginning of the chapter selected,
        //then take the page start and page end number
        if (child.toString().toLowerCase().startsWith(marker.getChapterPrefix().toLowerCase())) {
          currentOutline = child;
          pageStart = pdfFile.getPageNumber(act.getDestination()
              .getPage());
          if (i + 1 < on.getChildCount()) {
            OutlineNode childAfter = (OutlineNode) on
                .getChildAt(i + 1);
            GoToAction actAfter = (GoToAction) childAfter
                .getAction();
            pageEnd = pdfFile.getPageNumber(actAfter
                .getDestination().getPage());
          }// else if child is the last one, pageEnd is already set.
          break;
View Full Code Here


   */
  @Override
  public void valueChanged(TreeSelectionEvent e) {

    TreePath path = e.getNewLeadSelectionPath();
    OutlineNode selectedNode = (OutlineNode) path.getLastPathComponent();
    GoToAction act = (GoToAction) selectedNode.getAction();

    try {
      int pageNode = pdfFile
          .getPageNumber(act.getDestination().getPage());
      bar.setValue(pageNode - pageStart);
View Full Code Here

     * Someone changed the selection of the outline tree.  Go to the new
     * page.
     */
    public void valueChanged(TreeSelectionEvent e) {
        if (e.isAddedPath()) {
            OutlineNode node = (OutlineNode) e.getPath().getLastPathComponent();
            if (node == null) {
                return;
            }

            try {
                PDFAction action = node.getAction();
                if (action == null) {
                    return;
                }

                if (action instanceof GoToAction) {
View Full Code Here

TOP

Related Classes of com.sun.pdfview.OutlineNode

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.