- java.lang.Object
-
- org.icepdf.ri.common.tools.CommonToolHandler
-
- org.icepdf.ri.common.tools.SelectionBoxHandler
-
- org.icepdf.ri.common.tools.TextSelection
-
- org.icepdf.ri.common.tools.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 Summary
Fields Modifier and Type Field Description protected booleanisClearSelectionprotected booleanisMouseDrag-
Fields inherited from class org.icepdf.ri.common.tools.TextSelection
bottomMargin, bottomMarginExclusion, enableMarginExclusion, enableMarginExclusionBorder, lastMouseLocation, lastMousePressedLocation, logger, pageLock, selectedCount, topMargin, topMarginExclusion
-
Fields inherited from class org.icepdf.ri.common.tools.SelectionBoxHandler
currentRect, dash1, previousRectDrawn, rectToDraw, selectionBoxColour, stroke
-
Fields inherited from class org.icepdf.ri.common.tools.CommonToolHandler
documentViewController, pageViewComponent, preferences
-
-
Constructor Summary
Constructors Constructor Description TextSelectionPageHandler(DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent)New Text selection handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelSelection()voidinstallTool()Callback code that allows post construct task to take place when the tool is selected via theAbstractDocumentView.setToolMode(int)call.voidmouseClicked(MouseEvent e)When the mouse is double-clicked we select the word the mouse if over.voidmouseDragged(MouseEvent e)Invoked when a mouse button is pressed on a component and then dragged.voidmouseEntered(MouseEvent e)Invoked when the mouse enters a component.voidmouseExited(MouseEvent e)Invoked when the mouse exits a component.voidmouseMoved(MouseEvent e)Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.voidmousePressed(MouseEvent e)Invoked when a mouse button has been pressed on a component.voidmouseReleased(MouseEvent e)Invoked when a mouse button has been released on a component.voidpaintTool(Graphics g)Paints the tools pre-annotation creation state.voidsetDocumentViewController(DocumentViewController documentViewController)voidsetSelectionRectangle(Point cursorLocation, Rectangle selection)voiduninstallTool()Callback code that allows pre destroy task to take place when the tool is unselected via theAbstractDocumentView.setToolMode(int)call.-
Methods inherited from class org.icepdf.ri.common.tools.TextSelection
calculateTextSelectionExclusion, checkAndApplyPreferences, clearSelection, clearSelectionState, convertTextShapesToBounds, convertToPageSpace, lineSelectHandler, multiLineSelectHandler, paintSelectedText, paintTextBounds, selection, selectionEnd, selectionStart, selectionTextSelectIcon, setBottomMargin, setTopMargin, wordLineSelection, wordSelectHandler
-
Methods inherited from class org.icepdf.ri.common.tools.SelectionBoxHandler
clearRectangle, getCurrentRect, getRectToDraw, isOverPageComponent, paintRectangle, paintSelectionBox, resetRectangle, setCurrentRect, setRectToDraw, setSelectionSize, updateDrawableRect, updateSelectionSize
-
Methods inherited from class org.icepdf.ri.common.tools.CommonToolHandler
convertToPageSpace, convertToPageSpace, convertToPageSpace, convertToPageSpace, getPageTransform, getPageTransform, getToPageSpaceTransform, getToPageSpaceTransform
-
-
-
-
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:
mouseClickedin interfaceMouseListener
-
mousePressed
public void mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component.- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
public void mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseDragged
public void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged.MOUSE_DRAGGEDevents 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_DRAGGEDevents may not be delivered during a native Drag&Drop operation.- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseEntered
public void mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
public void mouseExited(MouseEvent e)
Invoked when the mouse exits a component.- Specified by:
mouseExitedin interfaceMouseListener
-
setSelectionRectangle
public void setSelectionRectangle(Point cursorLocation, Rectangle selection)
- Overrides:
setSelectionRectanglein classTextSelection
-
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:
mouseMovedin interfaceMouseMotionListener
-
cancelSelection
public void cancelSelection()
-
installTool
public void installTool()
Description copied from interface:ToolHandlerCallback code that allows post construct task to take place when the tool is selected via theAbstractDocumentView.setToolMode(int)call.- Specified by:
installToolin interfaceToolHandler
-
uninstallTool
public void uninstallTool()
Description copied from interface:ToolHandlerCallback code that allows pre destroy task to take place when the tool is unselected via theAbstractDocumentView.setToolMode(int)call.- Specified by:
uninstallToolin interfaceToolHandler
-
paintTool
public void paintTool(Graphics g)
Description copied from interface:ToolHandlerPaints the tools pre-annotation creation state.- Specified by:
paintToolin interfaceToolHandler- Parameters:
g- graphics context
-
-