Package org.faceless.pdf2.viewer2
Class LinearizedSupport
- java.lang.Object
-
- org.faceless.pdf2.viewer2.LinearizedSupport
-
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
public class LinearizedSupport extends Object implements PropertyChangeListener
A class which handles all the support for Linearized document loaded by a DocumentPanel.This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.
- Since:
- 2.14
- See Also:
DocumentPanel.getLinearizedSupport()
,PDF.getLoadState(int)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
getLoadProgress()
Get the progress of the document load, from 0 to 1 (fully loaded)void
invokeOnCompletion(Runnable precondition, Runnable task)
Schedule the task to be run on the EDT when the precondition task (run in a background thread) has completed.void
invokeOnDocumentLoad(Runnable r)
Run an event when all pages have been loaded.void
invokeOnPageLoad(int pagenumber, Runnable r)
Run an event when the specified page has loaded.void
invokeOnPageLoadWithDialog(int pagenumber, Runnable r)
Run an event when the specified page has loaded.boolean
isFullyLoaded()
Return true if the PDF is fully loaded, false otherwiseboolean
isPageLoaded(int pagenumber)
Return true if the specified page is loaded, false otherwisevoid
propertyChange(PropertyChangeEvent event)
-
-
-
Method Detail
-
propertyChange
public void propertyChange(PropertyChangeEvent event)
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
invokeOnPageLoadWithDialog
public void invokeOnPageLoadWithDialog(int pagenumber, Runnable r)
Run an event when the specified page has loaded. A progress dialog will be displayed until it has. This method will also trigger a load of the page if it's not already been done.- Parameters:
pagenumber
- the page numberr
- the task to run on load, which will be run on the Swing EDT
-
invokeOnPageLoad
public void invokeOnPageLoad(int pagenumber, Runnable r)
Run an event when the specified page has loaded. No progress updates will be displayed, and the page load will not be triggered.- Parameters:
pagenumber
- the page numberr
- the task to run on load, which will be run on the Swing EDT
-
invokeOnDocumentLoad
public void invokeOnDocumentLoad(Runnable r)
Run an event when all pages have been loaded. No progress updates will be displayed, and the page load will not be forced.- Parameters:
r
- the task to run on load, which will be run on the Swing EDT
-
invokeOnCompletion
public void invokeOnCompletion(Runnable precondition, Runnable task)
Schedule the task to be run on the EDT when the precondition task (run in a background thread) has completed. For example, to run a task on the event queue only when the form is completely loaded:invokeOnCompletion(new Runnable() { public void run() { pdf.getForm().getElements(); } }, new Runable() { public void run() { // Do something with form. } }
- Parameters:
precondition
- the Runnable object that must complete first - will be run in a background threadtask
- the optional task to be run when the precondition completes - will be run on the EDT
-
isPageLoaded
public boolean isPageLoaded(int pagenumber)
Return true if the specified page is loaded, false otherwise- Parameters:
pagenumber
- the pagenumber to query
-
isFullyLoaded
public boolean isFullyLoaded()
Return true if the PDF is fully loaded, false otherwise
-
getLoadProgress
public float getLoadProgress()
Get the progress of the document load, from 0 to 1 (fully loaded)
-
-