Class ThumbnailPanel.View
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.faceless.pdf2.viewer2.feature.ThumbnailPanel.View
-
- All Implemented Interfaces:
Autoscroll
,DropTargetListener
,ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,Runnable
,EventListener
,Accessible
,Scrollable
,DocumentPanelListener
- Enclosing class:
- ThumbnailPanel
public static class ThumbnailPanel.View extends JPanel implements Scrollable, DocumentPanelListener, Autoscroll, PropertyChangeListener, DropTargetListener, Runnable
This class is the JPanel containing all the thumbnails. It serves as a DropTarget or drag-and-drop, as a the Scrollable content of the SidePanel, and handles actions when the document is updated, when a popup has run on the selected panels, and when a keypress is received (by way of its
InputMap
andActionMap
. New actions may be registered with this class by addingThumbnailPanel.ThumbnailSelectionAction
s to the viewer. These should respect this objectsisEditable()
flag if they're going to modify the file.This class fires "selection"
PropertyChangeEvent
s when the list of selected pages is changed, and "selected" events when the current page is changed.There's no need to acccess this class unless you're implementing your own
ThumbnailPanel.ThumbnailSelectionAction
- 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 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
autoscroll(Point p)
void
documentUpdated(DocumentPanelEvent event)
The document has been updated - check for loading, closing or changing the current page.void
doLayout()
void
dragEnter(DropTargetDragEvent event)
void
dragExit(DropTargetEvent event)
void
dragOver(DropTargetDragEvent event)
void
drop(DropTargetDropEvent event)
Accept a Drop.void
dropActionChanged(DropTargetDragEvent event)
Insets
getAutoscrollInsets()
DocumentPanel
getDocumentPanel()
Get the DocumentPanel this View relates toDimension
getPreferredScrollableViewportSize()
Dimension
getPreferredSize()
int
getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
boolean
getScrollableTracksViewportHeight()
boolean
getScrollableTracksViewportWidth()
int
getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
List<PDFPage>
getSelectedPages()
Return aList
of selected pagesString
getSelectedPagesDescription()
Get a String describing the currently selected pagesboolean
isAnythingDraggableSelected()
Return true if the any draggable panels in this ThumbnailPanel are selectedboolean
isDragTargetValid(DropTargetEvent event)
boolean
isEditable()
Return true if the PDF in the panel can be edited.boolean
isEntireDraggablePDFSelected()
Return true if the selected draggable panels in this ThumbnailPanel include an entire PDF.boolean
isFactoryEditable()
Return true if this ThumbnailPanel will never allow editing.void
paintComponent(Graphics g)
void
propertyChange(PropertyChangeEvent event)
The PDF fired a property change - document may have had its page list altered.void
run()
void
scrollRectToVisible(Rectangle r)
Scroll smoothly to the specified rectangle by animating the processvoid
setBounds(int x, int y, int width, int height)
void
setSelectedPages(List<PDFPage> pages)
Set the list of selected pages.-
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, 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, 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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Method Detail
-
documentUpdated
public void documentUpdated(DocumentPanelEvent event)
The document has been updated - check for loading, closing or changing the current page.- Specified by:
documentUpdated
in interfaceDocumentPanelListener
-
propertyChange
public void propertyChange(PropertyChangeEvent event)
The PDF fired a property change - document may have had its page list altered.- Specified by:
propertyChange
in interfacePropertyChangeListener
-
getSelectedPagesDescription
public String getSelectedPagesDescription()
Get a String describing the currently selected pages
-
setSelectedPages
public void setSelectedPages(List<PDFPage> pages)
Set the list of selected pages.- Parameters:
pages
- a non-empty list of PDFPage objects
-
isFactoryEditable
public boolean isFactoryEditable()
Return true if this ThumbnailPanel will never allow editing. This value is fixed over the life of the panel- Since:
- 2.13
-
isEditable
public boolean isEditable()
Return true if the PDF in the panel can be edited. This value may vary over the life of the DocumentPanel.
-
getDocumentPanel
public DocumentPanel getDocumentPanel()
Get the DocumentPanel this View relates to
-
dragOver
public void dragOver(DropTargetDragEvent event)
- Specified by:
dragOver
in interfaceDropTargetListener
-
dragEnter
public void dragEnter(DropTargetDragEvent event)
- Specified by:
dragEnter
in interfaceDropTargetListener
-
dragExit
public void dragExit(DropTargetEvent event)
- Specified by:
dragExit
in interfaceDropTargetListener
-
isDragTargetValid
public boolean isDragTargetValid(DropTargetEvent event)
-
drop
public void drop(DropTargetDropEvent event)
Accept a Drop. This method will update the PDF page list, which will fire an event which this class is listening for.- Specified by:
drop
in interfaceDropTargetListener
-
dropActionChanged
public void dropActionChanged(DropTargetDragEvent event)
- Specified by:
dropActionChanged
in interfaceDropTargetListener
-
setBounds
public void setBounds(int x, int y, int width, int height)
-
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
getPreferredSize
in classJComponent
-
getPreferredScrollableViewportSize
public Dimension getPreferredScrollableViewportSize()
- Specified by:
getPreferredScrollableViewportSize
in interfaceScrollable
-
getScrollableUnitIncrement
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
- Specified by:
getScrollableUnitIncrement
in interfaceScrollable
-
getScrollableBlockIncrement
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
- Specified by:
getScrollableBlockIncrement
in interfaceScrollable
-
getScrollableTracksViewportWidth
public boolean getScrollableTracksViewportWidth()
- Specified by:
getScrollableTracksViewportWidth
in interfaceScrollable
-
getScrollableTracksViewportHeight
public boolean getScrollableTracksViewportHeight()
- Specified by:
getScrollableTracksViewportHeight
in interfaceScrollable
-
paintComponent
public void paintComponent(Graphics g)
- Overrides:
paintComponent
in classJComponent
-
autoscroll
public void autoscroll(Point p)
- Specified by:
autoscroll
in interfaceAutoscroll
-
getAutoscrollInsets
public Insets getAutoscrollInsets()
- Specified by:
getAutoscrollInsets
in interfaceAutoscroll
-
scrollRectToVisible
public void scrollRectToVisible(Rectangle r)
Scroll smoothly to the specified rectangle by animating the process- Overrides:
scrollRectToVisible
in classJComponent
-
isEntireDraggablePDFSelected
public boolean isEntireDraggablePDFSelected()
Return true if the selected draggable panels in this ThumbnailPanel include an entire PDF.- Since:
- 2.26
-
isAnythingDraggableSelected
public boolean isAnythingDraggableSelected()
Return true if the any draggable panels in this ThumbnailPanel are selected- Since:
- 2.26
-
-