|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.faceless.pdf2.viewer2.DocumentPanel
public class DocumentPanel
A DocumentPanel is the basic component that displays a PDF, and may be
instantiated on it's own or as part of a PDFViewer. It contains a
DocumentViewport and optionally one or more SidePanel objects on the
left, and may process PDFActions on the PDF.
See the viewer tutorial for more detail on how to use this class and the "viewer" package.
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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
DocumentPanel()
Create a new DocumentPanel |
|
| Method Summary | |
|---|---|
void |
addActionHandler(ActionHandler actionhandler)
Add a ActionHandler to this DocumentPanel. |
void |
addAnnotationComponentFactory(AnnotationComponentFactory annotationfactory)
Add a AnnotationComponentFactory to this
DocumentPanel. |
void |
addDocumentPanelListener(DocumentPanelListener listener)
Add a DocumentPanelListener to this DocumentPanel. |
void |
addSidePanelFactory(SidePanelFactory panelfactory)
Add a SidePanelFactory to this
DocumentPanel. |
JSManager |
getJSManager()
Return the JSManager object for this DocumentPanel. |
PDFPage |
getPage()
Return the PDFPage currently being displayed by the DocumentViewport. |
int |
getPageNumber()
Return the pagenumber of the currently displayed page starting at 0, or -1 if no page is being displayed. |
PDFParser |
getParser()
Get the PDFParser being used to parse this PDF. |
PDF |
getPDF()
Return the PDF currently being displayed by this DocumentPanel |
String |
getSelectedSidePanel()
Return the name of the currently selected SidePanel, or
null if no panels are displayed. |
Map |
getSidePanels()
Return a read-only map containing the SidePanel objects in use by this
DocumentPanel. |
PDFViewer |
getViewer()
Return the PDFViewer that contains this DocumentPanel. |
DocumentViewport |
getViewport()
Return the DocumentViewport contained by this DocumentPanel |
float |
getZoom()
Return the current zoom level. |
void |
print(PrintService service,
PrintRequestAttributeSet atts)
Display a Print dialog for printing this document, or if a PrintService is
specified, print directly to that service without displaying a dialog. |
void |
raiseRedrawnEvent()
Raise a "redrawn" event on this DocumentPanel. |
void |
redraw(Object o)
Redraw the specified object. |
void |
removeDocumentPanelListener(DocumentPanelListener listener)
Remove a DocumentPanelListener from this DocumentPanel. |
boolean |
runAction(PDFAction action)
Run the specified action on the PDF. |
void |
setJSManager(JSManager jsmanager)
Set the JSManager object for this DocumentPanel. |
void |
setPage(PDFPage page)
Set the page to display in the DocumentViewport. |
void |
setPage(PDFPage page,
float x,
float y,
float zoom)
Set the page to display in the DocumentViewport. |
void |
setPageNumber(int i)
Set the page being displayed. |
void |
setPDF(PDF pdf)
Set the PDF to be displayed by this DocumentFrame. |
void |
setSelectedSidePanel(String name)
Set the currently displayed SidePanel |
void |
setSidePanelSize(int threshold,
int preferred)
Control the size of the leftmost pane. |
void |
setViewport(DocumentViewport viewport)
Set the DocumentViewport used by this DocumentPanel. |
void |
setZoom(float zoom)
Set the current zoom level |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DocumentPanel()
| Method Detail |
|---|
public void setViewport(DocumentViewport viewport)
DocumentViewport used by this DocumentPanel.
viewport - the Viewportpublic DocumentViewport getViewport()
DocumentViewport contained by this DocumentPanel
public JSManager getJSManager()
public void setJSManager(JSManager jsmanager)
public PDFViewer getViewer()
PDFViewer that contains this DocumentPanel.
Note a DocumentPanel does not have to be contained inside
a PDFViewer, in which case this method will return null.
public void setSidePanelSize(int threshold,
int preferred)
threshold - the minimum size, below which the panel is assumed to be closedpreferred - the default size of the leftmost pane when openedpublic void addSidePanelFactory(SidePanelFactory panelfactory)
SidePanelFactory to this
DocumentPanel. When a PDF is set, the panels that are
appropriate for that PDF will be created from this list of factories.
panelfactory - the factorypublic void addAnnotationComponentFactory(AnnotationComponentFactory annotationfactory)
AnnotationComponentFactory to this
DocumentPanel. Any PDF's displayed by this panel will have annotations
created by these factories.
annotationfactory - the factorypublic void addActionHandler(ActionHandler actionhandler)
ActionHandler to this DocumentPanel.
Any actions passed to runAction(org.faceless.pdf2.PDFAction) will by handled by this list of handlers.
actionhandler - the handlerpublic boolean runAction(PDFAction action)
ActionHandlers, which should be registered
with this class via the addActionHandler() method.
action - the PDFAction to run.
public void addDocumentPanelListener(DocumentPanelListener listener)
DocumentPanelListener to this DocumentPanel.
listener - the listenerpublic void removeDocumentPanelListener(DocumentPanelListener listener)
DocumentPanelListener from this DocumentPanel.
listener - the listenerpublic void raiseRedrawnEvent()
public Map getSidePanels()
SidePanel objects in use by this
DocumentPanel. The map is keyed by the name of the panel and the
values are the SidePanel objects.
public void setSelectedSidePanel(String name)
SidePanel
name - the name of the SidePanel to display, or null to hide
the side panel frame. If no such panel exists this method performs no action.public String getSelectedSidePanel()
SidePanel, or
null if no panels are displayed.
public void setPDF(PDF pdf)
DocumentFrame.
pdf - the PDFpublic PDFParser getParser()
public PDF getPDF()
DocumentPanel
public PDFPage getPage()
DocumentViewport.
If no PDF is set or the first page is still being rendered, this method will return
null.
public void setPageNumber(int i)
setPage(getPDF().getPage(i)).
public int getPageNumber()
public float getZoom()
public void setZoom(float zoom)
zoom - the zoom levelpublic void setPage(PDFPage page)
DocumentViewport. The page is displayed
at it's top-left and at the current zoom level.
page - the page
public void setPage(PDFPage page,
float x,
float y,
float zoom)
DocumentViewport. The page is displayed
at the co-ordinates supplied and at the specified zoom level.
page - the pagex - the left-most position of the page to display, in units relative to PagePanel.getFullPageView(org.faceless.pdf2.PDFPage)y - the top-most position of the page to display, in units relative to PagePanel.getFullPageView(org.faceless.pdf2.PDFPage)zoom - the zoom levelpublic void redraw(Object o)
SidePanel.redraw(java.lang.Object)
and DocumentViewport.redraw(java.lang.Object) methods, and should be called when the PDF has been
updated somehow - ie a page or annotation has been altered.
param o the Object that has been altered - typically a PDFPage or PDFAnnotation
public void print(PrintService service,
PrintRequestAttributeSet atts)
throws PrintException,
PrinterException
PrintService is
specified, print directly to that service without displaying a dialog.
service - the PrintService to print to. If this value is null
a dialog will be displayed allowing the selection of a service.atts - the print attributes - may be set to an AttributeSet to control the
printing, or null to use the default.
PrintException
PrinterException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||