Class TextSelectionPageHandler

  • All Implemented Interfaces:
    MouseListener, MouseMotionListener, EventListener, MouseInputListener, ToolHandler
    Direct Known Subclasses:
    HighLightAnnotationHandler

    public class TextSelectionPageHandler
    extends TextSelection
    implements ToolHandler
    Handles Paint and mouse/keyboard logic around text selection and search highlighting. there is on text handler instance of each pageComponent used to display the document.
    The highlight colour by default is #FFF600 but can be set using color or hex values names using the system property "org.icepdf.core.views.page.text.highlightColor"
    The highlight colour by default is #FFF600 but can be set using color or hex values names using the system property "org.icepdf.core.views.page.text.selectionColor"
    Since:
    4.0
    • Field Detail

      • isMouseDrag

        protected boolean isMouseDrag
      • isClearSelection

        protected boolean isClearSelection
    • Constructor Detail

      • TextSelectionPageHandler

        public TextSelectionPageHandler​(DocumentViewController documentViewController,
                                        AbstractPageViewComponent pageViewComponent)
        New Text selection handler. Make sure to correctly and remove this mouse and text listeners.
        Parameters:
        pageViewComponent - page component that this handler is bound to.
        documentViewController - view model.
    • Method Detail

      • setDocumentViewController

        public void setDocumentViewController​(DocumentViewController documentViewController)
      • mouseClicked

        public void mouseClicked​(MouseEvent e)
        When the mouse is double-clicked we select the word the mouse if over. When the mouse is triple clicked we select the line of text that the mouse is over.
        Specified by:
        mouseClicked in interface MouseListener
      • mousePressed

        public void mousePressed​(MouseEvent e)
        Invoked when a mouse button has been pressed on a component.
        Specified by:
        mousePressed in interface MouseListener
      • mouseReleased

        public void mouseReleased​(MouseEvent e)
        Invoked when a mouse button has been released on a component.
        Specified by:
        mouseReleased in interface MouseListener
      • mouseDragged

        public void mouseDragged​(MouseEvent e)
        Invoked when a mouse button is pressed on a component and then dragged. MOUSE_DRAGGED events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).
        Due to platform-dependent Drag&Drop implementations, MOUSE_DRAGGED events may not be delivered during a native Drag&Drop operation.
        Specified by:
        mouseDragged in interface MouseMotionListener
      • mouseMoved

        public void mouseMoved​(MouseEvent e)
        Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
        Specified by:
        mouseMoved in interface MouseMotionListener
      • cancelSelection

        public void cancelSelection()
      • paintTool

        public void paintTool​(Graphics g)
        Description copied from interface: ToolHandler
        Paints the tools pre-annotation creation state.
        Specified by:
        paintTool in interface ToolHandler
        Parameters:
        g - graphics context