Class PDFViewer

All Implemented Interfaces:
KeyListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, TreeSelectionListener, RootPaneContainer, WindowConstants, PageChangeListener

public class PDFViewer extends JFrame implements KeyListener, PageChangeListener, TreeSelectionListener
The Class PDFViewer.
See Also:
  • Field Details

    • TITLE

      public static final String TITLE
      The Constant TITLE.
      See Also:
    • curFile

      protected transient PDFFile curFile
      The current PDFFile.
    • page

      protected transient PagePanel page
      The page display.
    • fspp

      protected transient PagePanel fspp
      The full screen page display, or null if not in full screen mode.
    • curpage

      protected int curpage
      The current page number (starts at 0), or -1 if no page.
  • Constructor Details

    • PDFViewer

      public PDFViewer(boolean useThumbs)
      Create a new PdfDialog based on a user, with or without a thumbnail panel.
      Parameters:
      useThumbs - true if the thumb panel should exist, false if not.
  • Method Details

    • init

      protected void init()
      Initialize this PdfDialog by creating the GUI.
    • gotoPage

      public void gotoPage(int pagenum)
      Notifies the listener that it should go to a particular page number.

      Changes the displayed page, desyncing if we're not on the same page as a presenter.

      Specified by:
      gotoPage in interface PageChangeListener
      Parameters:
      pagenum - a Integer object.
    • forceGotoPage

      public void forceGotoPage(int pagenum)
      Changes the displayed page.
      Parameters:
      pagenum - the page to display
    • setEnabling

      public void setEnabling()
      Enable or disable all of the actions based on the current state.
    • openFile

      public void openFile(URL url) throws IOException
      open a URL to a PDF file. The file is read in and processed with an in-memory buffer.
      Parameters:
      url - the url
      Throws:
      IOException - if any.
    • openFile

      public void openFile(URL url, URLConnection httpcon) throws IOException
      open a URL to a PDF file. The file is read in and processed with an in-memory buffer.
      Parameters:
      url - the url
      Throws:
      IOException - if any.
    • openFile

      public void openFile(File file) throws IOException

      Open a specific pdf file. Creates a DocumentInfo from the file, and opens that.

      Note: Mapping the file locks the file until the PDFFile is closed.

      Parameters:
      file - the file to open
      Throws:
      IOException - if any.
    • openError

      public void openError(String message)
      Display a dialog indicating an error.
      Parameters:
      message - the message
    • doOpen

      public void doOpen(String name)
      Open a local file, given a string filename.
      Parameters:
      name - the name of the file to open
    • doOpen

      public void doOpen(String name, URL url, URLConnection httpcon)
      Open a local file, given a string filename.
      Parameters:
      name - a String object.
      url - a URL object.
      httpcon - a URLConnection object.
    • doPageSetup

      public void doPageSetup()
      Posts the Page Setup dialog.
    • doPrint

      public void doPrint()
      Print the current document.
    • doFit

      public void doFit(boolean width, boolean height)
      makes the page fit in the window
      Parameters:
      width - a boolean.
      height - a boolean.
    • doThumbs

      public void doThumbs(boolean show)
      Shows or hides the thumbnails by moving the split pane divider.
      Parameters:
      show - the show
    • doZoom

      public void doZoom(float factor)
      Do zoom.
      Parameters:
      factor - the factor
    • doNext

      public void doNext()
      Goes to the next page.
    • doPrev

      public void doPrev()
      Goes to the previous page.
    • doFirst

      public void doFirst()
      Goes to the first page.
    • doLast

      public void doLast()
      Goes to the last page.
    • doOutline

      public void doOutline()
      Open outline. the root of the outline, or null if there is no outline./
    • doCloseOutline

      public void doCloseOutline()

      doCloseOutline.

    • keyPressed

      public void keyPressed(KeyEvent evt)

      Handle a key press for navigation.

      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent evt)
      Specified by:
      keyReleased in interface KeyListener
    • keyTyped

      public void keyTyped(KeyEvent evt)

      gets key presses and tries to build a page if they're numeric.

      Specified by:
      keyTyped in interface KeyListener
    • valueChanged

      public void valueChanged(TreeSelectionEvent e)

      Someone changed the selection of the outline tree. Go to the new page.

      Specified by:
      valueChanged in interface TreeSelectionListener