- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JLayeredPane
-
- org.icepdf.ri.common.views.AbstractPageViewComponent
-
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,PageViewComponent
- Direct Known Subclasses:
PageThumbnailComponent,PageViewComponentImpl
public abstract class AbstractPageViewComponent extends JLayeredPane implements PageViewComponent
This class contains all the functionality for showing a pages content. This view works closely with the clip provided by a parent JScrollPane component to optimize memory usage. Page content is painted to a back buffer which is painted by the component when ready. The back buffer is scaled on subsequent paints to show content and is later replaced with a new buffer that is painted with the current page properties.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractPageViewComponent.PageBufferStoreSynchronized page buffer property store, insures that a page capture occurs using the correct properties.classAbstractPageViewComponent.PageImageCaptureTaskThe worker of any successful page paint.-
Nested classes/interfaces inherited from class javax.swing.JLayeredPane
JLayeredPane.AccessibleJLayeredPane
-
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 Modifier and Type Field Description protected DocumentViewControllerdocumentViewControllerprotected DocumentViewModeldocumentViewModelprotected GraphicsConfigurationgraphicsConfigurationprotected static intPAGE_BOUNDARY_BOXprotected intpageBoundaryBoxprotected static intpageBufferPaddingprotected AbstractPageViewComponent.PageBufferStorepageBufferStoreprotected FutureTask<Object>pageImageCaptureTaskprotected intpageIndexprotected floatpageRotationprotected RectanglepageSizeprotected PageTreepageTreeprotected floatpageZoomprotected booleanpaintAnnotationsprotected booleanpaintSearchHighlightprotected DocumentViewparentDocumentViewprotected static booleanprogressivePaint-
Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
-
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 AbstractPageViewComponent(DocumentViewModel documentViewModel, PageTree pageTree, int pageIndex, int width, int height)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalculateBufferLocation()Calculates where we should be painting the new buffer and kicks off the worker if the buffer is deemed dirty.protected voidcalculatePageSize(Rectangle pageSize, float rotation, float zoom)Calculates the page size for the rotation and zoom.protected static doublecalculateScaleForDefaultScreen()voidclearSelectedText()voidclearSelectionRectangle()Clear any internal data structures that represent selected text and repaint the component.PagegetPage()intgetPageIndex()Gets the page index which this PageViewComponent is drawing.DocumentViewgetParentDocumentView()DimensiongetPreferredSize()DimensiongetSize()static booleanisAnnotationTool(int displayTool)protected voidpaintComponent(Graphics g)voidreinitialize()voidsetDocumentViewCallback(DocumentView parentDocumentView)Set the parent Document View class which is responsible for drawing and the general management of PageViewComponents for a particular view.voidsetSelectionRectangle(Point cursorLocation, Rectangle selection)Sets the text that is contained in the specified rectangle and the given mouse pointer.voidupdateView(String propertyConstant, Object oldValue, Object newValue)Called from parent controls when a UI control has manipulated the view, property change is picked up and the view is updated accordingly.-
Methods inherited from class javax.swing.JLayeredPane
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition
-
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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, 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, updateUI
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, 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, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.icepdf.ri.common.views.PageViewComponent
dispose, getParent, pageInitializedCallback, pageTeardownCallback
-
-
-
-
Field Detail
-
PAGE_BOUNDARY_BOX
protected static final int PAGE_BOUNDARY_BOX
- See Also:
- Constant Field Values
-
pageBufferPadding
protected static int pageBufferPadding
-
progressivePaint
protected static boolean progressivePaint
-
paintAnnotations
protected boolean paintAnnotations
-
paintSearchHighlight
protected final boolean paintSearchHighlight
- See Also:
- Constant Field Values
-
parentDocumentView
protected DocumentView parentDocumentView
-
documentViewModel
protected DocumentViewModel documentViewModel
-
documentViewController
protected DocumentViewController documentViewController
-
pageTree
protected PageTree pageTree
-
pageIndex
protected int pageIndex
-
pageSize
protected Rectangle pageSize
-
pageZoom
protected float pageZoom
-
pageRotation
protected float pageRotation
-
pageBoundaryBox
protected int pageBoundaryBox
-
pageBufferStore
protected AbstractPageViewComponent.PageBufferStore pageBufferStore
-
graphicsConfiguration
protected GraphicsConfiguration graphicsConfiguration
-
pageImageCaptureTask
protected FutureTask<Object> pageImageCaptureTask
-
-
Constructor Detail
-
AbstractPageViewComponent
public AbstractPageViewComponent(DocumentViewModel documentViewModel, PageTree pageTree, int pageIndex, int width, int height)
-
-
Method Detail
-
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
getPreferredSizein classJComponent
-
clearSelectedText
public void clearSelectedText()
-
setSelectionRectangle
public void setSelectionRectangle(Point cursorLocation, Rectangle selection)
Sets the text that is contained in the specified rectangle and the given mouse pointer. The cursor and selection rectangle must be in page space.- Parameters:
cursorLocation- location of cursor or mouse.selection- rectangle of text to include in selection.
-
clearSelectionRectangle
public void clearSelectionRectangle()
Clear any internal data structures that represent selected text and repaint the component.
-
reinitialize
public void reinitialize()
-
getPageIndex
public int getPageIndex()
Description copied from interface:PageViewComponentGets the page index which this PageViewComponent is drawing.- Specified by:
getPageIndexin interfacePageViewComponent- Returns:
- zero pages page index of the page drawn by this component.
-
getPage
public Page getPage()
-
setDocumentViewCallback
public void setDocumentViewCallback(DocumentView parentDocumentView)
Description copied from interface:PageViewComponentSet the parent Document View class which is responsible for drawing and the general management of PageViewComponents for a particular view.- Specified by:
setDocumentViewCallbackin interfacePageViewComponent- Parameters:
parentDocumentView- type of view, single page, continuous, etc.
-
getParentDocumentView
public DocumentView getParentDocumentView()
-
isAnnotationTool
public static boolean isAnnotationTool(int displayTool)
-
updateView
public void updateView(String propertyConstant, Object oldValue, Object newValue)
Called from parent controls when a UI control has manipulated the view, property change is picked up and the view is updated accordingly. Responds to PropertyConstants.DOCUMENT_VIEW_ROTATION_CHANGE and PropertyConstants.DOCUMENT_VIEW_ZOOM_CHANGE. If the worker is currently working is cancel with interrupts.- Specified by:
updateViewin interfacePageViewComponent- Parameters:
propertyConstant- document view change property.oldValue- old valuenewValue- new value
-
calculatePageSize
protected void calculatePageSize(Rectangle pageSize, float rotation, float zoom)
Calculates the page size for the rotation and zoom. The new values are assigned to the pageSize.- Parameters:
pageSize- rectangle to update, new rectangle will not be created.rotation- rotation of page.zoom- zoom of page
-
calculateScaleForDefaultScreen
protected static double calculateScaleForDefaultScreen()
-
paintComponent
protected void paintComponent(Graphics g)
- Overrides:
paintComponentin classJComponent
-
calculateBufferLocation
protected void calculateBufferLocation()
Calculates where we should be painting the new buffer and kicks off the worker if the buffer is deemed dirty. The Parent scrollpane viewport is taken into account to set up the clipping.
-
-