Class ThumbnailPanel
- java.lang.Object
-
- org.faceless.pdf2.viewer2.ViewerFeature
-
- org.faceless.pdf2.viewer2.SidePanelFactory
-
- org.faceless.pdf2.viewer2.feature.ThumbnailPanel
-
public class ThumbnailPanel extends SidePanelFactory
Creates a
SidePanel
that displays the page thumbnails. Since release 2.10.2 the Thumbnail panel can also be used to reorder, delete and insert pages or entire documents. Modifying a document in this way requires theEncryptionHandler
on the document grants the "Assemble" right.It's also possible to add custom actions to a ThumbnailPanel by adding features implementing
ThumbnailPanel.ThumbnailSelectionAction
. These will be available via keyboard shortcut or the popup menu on the panel.The following initialization parameters can be specified to configure this feature.The name of this feature is ShowHideThumbnailseditable true
orfalse
, forsetEditable()
. Default is truedraggable true
orfalse
, forsetDraggable()
. Default is truescrollFollow true
orfalse
, forsetScrollFollow()
. Default is trueusePageLabels true
orfalse
, forsetUsePageLabels()
. Default is truethumbnailSize number
, forsetThumbnailSize()
. Default is 100This 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.8
- See Also:
ThumbnailPanel.ThumbnailSelectionAction
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ThumbnailPanel.SinglePagePanel
AJPanel
representing a single page image.static interface
ThumbnailPanel.ThumbnailSelectionAction
This interface should be implemented by anyViewerFeature
that should be available as an action on theThumbnailPanel.View
, either by the popup menu or by keypress.static class
ThumbnailPanel.ThumbnailSidePanel
This type ofSidePanel
is returned from a call tocreateSidePanel()
.static class
ThumbnailPanel.View
This class is the JPanel containing all the thumbnails.
-
Constructor Summary
Constructors Constructor Description ThumbnailPanel()
Create a new ThumbnailPanel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAction(ThumbnailPanel.ThumbnailSelectionAction action)
/** If this ThumbnailPanel is part of a DocumentPanel with no viewer, use this method add addThumbnailPanel.ThumbnailSelectionAction
actions to the panel.SidePanel
createSidePanel()
Create and return a newSidePanel
.void
initialize(PDFViewer viewer)
Called when the feature is first added to a viewervoid
setDraggable(boolean draggable)
Determines whether SidePanels created by this factory can be edited by dragging pages around or dragging new documents in.void
setEditable(boolean editmode)
Determine whether SidePanels created by this factory allow pages to be edited in any way - either reordered via dragging or through any editingThumbnailPanel.ThumbnailSelectionAction
.void
setScrollFollow(boolean follow)
Set whether the thumbnail panel should scroll to follow the currently selected page or not.void
setThumbnailSize(int thumbnailsize)
Set the size of the longest dimension of each thumbnail.void
setUsePageLabels(boolean uselabels)
Set whether to number the pages using the "page labels" if defined on this PDF, or whether to always use the physical page number.-
Methods inherited from class org.faceless.pdf2.viewer2.SidePanelFactory
isSidePanelRequired, toString
-
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, isEnabledByDefault, setFeatureName, teardown
-
-
-
-
Method Detail
-
setEditable
public void setEditable(boolean editmode)
Determine whether SidePanels created by this factory allow pages to be edited in any way - either reordered via dragging or through any editingThumbnailPanel.ThumbnailSelectionAction
. The default is true, but this may be overridden by the PDF itself if it is encrypted and doesn't allow editing. s* Pages may not be edited if the PDF is not yet fully loaded.- Parameters:
editmode
- true if SidePanels created by this Factory allow alterations to the PDF- Since:
- 2.10.2
-
setDraggable
public void setDraggable(boolean draggable)
Determines whether SidePanels created by this factory can be edited by dragging pages around or dragging new documents in. This is distinct fromsetEditable(boolean)
- if that flag is true but this flag false, the document can still be edited by other means via the Thumbnail panel. The default is true- Parameters:
draggable
- if the PDF can be edited by dragging
-
setScrollFollow
public void setScrollFollow(boolean follow)
Set whether the thumbnail panel should scroll to follow the currently selected page or not. The default is true.- Parameters:
follow
- whether to follow the currently selected page in the viewport- Since:
- 2.11.6
-
setUsePageLabels
public void setUsePageLabels(boolean uselabels)
Set whether to number the pages using the "page labels" if defined on this PDF, or whether to always use the physical page number. The default is true.- Parameters:
uselabels
- if true, use the page labels if defined- Since:
- 2.11.19
- See Also:
PDF.getPageLabel(int)
,PageNumber.setUsePageLabels(boolean)
-
addAction
public void addAction(ThumbnailPanel.ThumbnailSelectionAction action)
/** If this ThumbnailPanel is part of a DocumentPanel with no viewer, use this method add addThumbnailPanel.ThumbnailSelectionAction
actions to the panel.- Since:
- 2.12
-
setThumbnailSize
public void setThumbnailSize(int thumbnailsize)
Set the size of the longest dimension of each thumbnail. The default is 100, although this can be changed by the "thumbnailSize" property or via the user-interface while running the viewer.- Since:
- 2.11.13
-
initialize
public void initialize(PDFViewer viewer)
Description copied from class:ViewerFeature
Called when the feature is first added to a viewer- Overrides:
initialize
in classViewerFeature
-
createSidePanel
public SidePanel createSidePanel()
Description copied from class:SidePanelFactory
Create and return a newSidePanel
.- Specified by:
createSidePanel
in classSidePanelFactory
-
-