Package org.faceless.pdf2.viewer2
Class NullDocumentViewport
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.faceless.pdf2.viewer2.DocumentViewport
-
- org.faceless.pdf2.viewer2.NullDocumentViewport
-
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
public class NullDocumentViewport extends DocumentViewport
A DocumentViewport that doesn't display anything. There's no use for this class in the normal viewer, but it's sometimes useful when only aSidePanel
should be displayed in theDocumentPanel
- Since:
- 2.12
- See Also:
- Serialized Form
-
-
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 org.faceless.pdf2.viewer2.DocumentViewport
CURSOR_GRAB, CURSOR_GRABBING, interpagemargin, margin, mouseWheelUnit, ZOOM_FIT, ZOOM_FITHEIGHT, ZOOM_FITWIDTH, ZOOM_NONE
-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors Constructor Description NullDocumentViewport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPagePanelInteractionListener(PagePanelInteractionListener listener)
Add aPagePanelInteractionListener
to anyPagePanel
objects that have been or will be created by this DocumentViewportvoid
addPagePanelListener(PagePanelListener listener)
Add aPagePanelListener
to anyPagePanel
objects that have been or will be created by this DocumentViewportAdjustable
getAdjustable(int position)
Return the "Adjustable" object for the specified position - typically this is the horizontal or verticalJScrollBar
, although this method may returnnull
or accept other parameters.PDFPage
getPage()
Return the PDFPage in use byDocumentViewport.getPagePanel()
PagePanel
getPagePanel()
Get the currently displayed PagePanel.Collection<PagePanel>
getPagePanels()
Returns a read only Collection containing all the PagePanels currently displayed in this Viewport.Dimension
getPreferredSize()
PDFPage
getRenderingPage()
Return the page that is currently in the process of rendering.JComponent
getView()
Get the JComponent that directly contains the PagePanel objects, not including scrollbars or other similar items.Dimension
getViewportSize()
Return the size in pixels of the space available to display pages in this viewport, not including scrollbars or other decorationfloat
getZoom()
Get the current zoom levelboolean
isDraggable()
Indicates whether the contents of this viewport can be dragged with the mouse to position them.void
removePagePanelInteractionListener(PagePanelInteractionListener listener)
Remove aPagePanelInteractionListener
from anyPagePanel
objects that have been created by this DocumentViewportvoid
removePagePanelListener(PagePanelListener listener)
Remove aPagePanelListener
from anyPagePanel
objects that have been created by this DocumentViewportvoid
setAdjustableValues(int horizontal, int vertical)
Set the values of the adjustables returned byDocumentViewport.getAdjustable(int)
.void
setDraggable(boolean draggable)
Sets whether to allow the contents of this viewport to be dragged with the mouse.void
setPage(PDFPage page, double x, double y, double zoom)
Set the currently displayed page.void
setRenderingHints(RenderingHints hints)
Set theRenderingHints
that should be used when rendering the pagesvoid
setZoom(float zoom)
Set the zoom level of this DocumentViewport.-
Methods inherited from class org.faceless.pdf2.viewer2.DocumentViewport
ensureVisible, getBorderColor, getDefaultRenderingHints, getDocumentPanel, getNextSelectablePageIndex, getPreviousSelectablePageIndex, getShadowColor, getTargetZoom, getZoomMode, isPageVisible, isSmoothScrolling, paintPageBorder, propertyChange, setDocumentPanel, setZoomMode, smoothScroll
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Method Detail
-
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
getPreferredSize
in classJComponent
-
setRenderingHints
public void setRenderingHints(RenderingHints hints)
Description copied from class:DocumentViewport
Set theRenderingHints
that should be used when rendering the pages- Specified by:
setRenderingHints
in classDocumentViewport
-
setPage
public void setPage(PDFPage page, double x, double y, double zoom)
Description copied from class:DocumentViewport
Set the currently displayed page. The exact implementation of this depends on the type of viewport, but the idea is that the specified page and position becomes the primary focus of this viewport.- Specified by:
setPage
in classDocumentViewport
- Parameters:
page
- the page to displayx
- the left-most X position of the page, relative toPagePanel.getFullPageView(org.faceless.pdf2.PDFPage)
. A value of NaN means keep the current value. 0 means the left edgey
- the top-most Y position of the page, relative toPagePanel.getFullPageView(org.faceless.pdf2.PDFPage)
. A value of NaN means keep the current value. 0 means the top edgezoom
- the zoom level. A value of <= 0 or NaN means keep the current zoom. A value of one means 72dpi
-
setZoom
public void setZoom(float zoom)
Description copied from class:DocumentViewport
Set the zoom level of this DocumentViewport. The page and position should remain unchanged if possible.- Specified by:
setZoom
in classDocumentViewport
-
getZoom
public float getZoom()
Description copied from class:DocumentViewport
Get the current zoom level- Specified by:
getZoom
in classDocumentViewport
-
getPagePanel
public PagePanel getPagePanel()
Description copied from class:DocumentViewport
Get the currently displayed PagePanel. As forsetPage()
, the exact implementation of this method depends on the type of viewport, but the idea is it returns the PagePanel that is the primary focus of this viewport.- Specified by:
getPagePanel
in classDocumentViewport
-
getView
public JComponent getView()
Description copied from class:DocumentViewport
Get the JComponent that directly contains the PagePanel objects, not including scrollbars or other similar items.- Specified by:
getView
in classDocumentViewport
-
getPagePanels
public Collection<PagePanel> getPagePanels()
Description copied from class:DocumentViewport
Returns a read only Collection containing all the PagePanels currently displayed in this Viewport.- Overrides:
getPagePanels
in classDocumentViewport
-
getPage
public PDFPage getPage()
Description copied from class:DocumentViewport
Return the PDFPage in use byDocumentViewport.getPagePanel()
- Overrides:
getPage
in classDocumentViewport
-
getRenderingPage
public PDFPage getRenderingPage()
Description copied from class:DocumentViewport
Return the page that is currently in the process of rendering. If the page has rendered this method returns the same asDocumentViewport.getPage()
- Specified by:
getRenderingPage
in classDocumentViewport
-
getViewportSize
public Dimension getViewportSize()
Description copied from class:DocumentViewport
Return the size in pixels of the space available to display pages in this viewport, not including scrollbars or other decoration- Specified by:
getViewportSize
in classDocumentViewport
-
getAdjustable
public Adjustable getAdjustable(int position)
Description copied from class:DocumentViewport
Return the "Adjustable" object for the specified position - typically this is the horizontal or verticalJScrollBar
, although this method may returnnull
or accept other parameters. The adjustable is measured in AWT space (pixels from the top left). This method may return null if there is no adjustable.- Specified by:
getAdjustable
in classDocumentViewport
- Parameters:
position
- one ofAdjustable.HORIZONTAL
orAdjustable.VERTICAL
-
setAdjustableValues
public void setAdjustableValues(int horizontal, int vertical)
Description copied from class:DocumentViewport
Set the values of the adjustables returned byDocumentViewport.getAdjustable(int)
. Calling this method is preferable to setting the values of each adjustable individually when both are to be set- Specified by:
setAdjustableValues
in classDocumentViewport
- Parameters:
horizontal
- the value for theAdjustable.HORIZONTAL
adjustable.vertical
- the value for theAdjustable.VERTICAL
adjustable.
-
addPagePanelListener
public void addPagePanelListener(PagePanelListener listener)
Description copied from class:DocumentViewport
Add aPagePanelListener
to anyPagePanel
objects that have been or will be created by this DocumentViewport- Specified by:
addPagePanelListener
in classDocumentViewport
- Parameters:
listener
- the listener
-
removePagePanelListener
public void removePagePanelListener(PagePanelListener listener)
Description copied from class:DocumentViewport
Remove aPagePanelListener
from anyPagePanel
objects that have been created by this DocumentViewport- Specified by:
removePagePanelListener
in classDocumentViewport
- Parameters:
listener
- the listener
-
addPagePanelInteractionListener
public void addPagePanelInteractionListener(PagePanelInteractionListener listener)
Description copied from class:DocumentViewport
Add aPagePanelInteractionListener
to anyPagePanel
objects that have been or will be created by this DocumentViewport- Specified by:
addPagePanelInteractionListener
in classDocumentViewport
- Parameters:
listener
- the listener
-
removePagePanelInteractionListener
public void removePagePanelInteractionListener(PagePanelInteractionListener listener)
Description copied from class:DocumentViewport
Remove aPagePanelInteractionListener
from anyPagePanel
objects that have been created by this DocumentViewport- Specified by:
removePagePanelInteractionListener
in classDocumentViewport
- Parameters:
listener
- the listener
-
isDraggable
public boolean isDraggable()
Description copied from class:DocumentViewport
Indicates whether the contents of this viewport can be dragged with the mouse to position them.- Specified by:
isDraggable
in classDocumentViewport
-
setDraggable
public void setDraggable(boolean draggable)
Description copied from class:DocumentViewport
Sets whether to allow the contents of this viewport to be dragged with the mouse.- Specified by:
setDraggable
in classDocumentViewport
- Parameters:
draggable
- if true, contents may be dragged
-
-