- 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
-
- org.icepdf.ri.common.tools.HighLightAnnotationHandler
-
- All Implemented Interfaces:
ActionListener,KeyListener,MouseListener,MouseMotionListener,EventListener,MouseInputListener,ToolHandler
- Direct Known Subclasses:
RedactionAnnotationHandler,StrikeOutAnnotationHandler,UnderLineAnnotationHandler
public class HighLightAnnotationHandler extends TextSelectionPageHandler implements ActionListener, KeyListener
HighLightAnnotationHandler tool extends TextSelectionPageHandler which takes care visually selected text as the mouse is dragged across text on the current page.
Once the mouseReleased event is fired this handler will create new HighLightAnnotation and respective AnnotationComponent. The addition of the Annotation object to the page is handled by the annotation callback. Once create the handler will deselect the text and the newly created annotation will be displayed.- Since:
- 5.0
-
-
Field Summary
Fields Modifier and Type Field Description protected MarkupAnnotationannotationprotected static booleanenableHighlightContentsProperty when enabled will set the /contents key value to the selected text of the markup annotation.protected NamemarkupSubType-
Fields inherited from class org.icepdf.ri.common.tools.TextSelectionPageHandler
isClearSelection, isMouseDrag
-
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 HighLightAnnotationHandler(DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(ActionEvent e)protected voidcheckAndApplyPreferences()voidcreateMarkupAnnotation(ArrayList<Shape> highlightBounds)protected voidcreateMarkupAnnotationFromTextSelection(MouseEvent e)protected StringgetSelectedText()static ArrayList<Shape>getSelectedTextBounds(AbstractPageViewComponent pageViewComponent, AffineTransform pageTransform)voidinstallTool()Callback code that allows post construct task to take place when the tool is selected via theAbstractDocumentView.setToolMode(int)call.voidkeyPressed(KeyEvent keyEvent)voidkeyReleased(KeyEvent keyEvent)voidkeyTyped(KeyEvent keyEvent)voidmouseClicked(MouseEvent evt)Check for double and triple click word and line selectionvoidmouseReleased(MouseEvent e)Invoked when a mouse button has been released on a component.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.TextSelectionPageHandler
cancelSelection, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, paintTool, setDocumentViewController, setSelectionRectangle
-
Methods inherited from class org.icepdf.ri.common.tools.TextSelection
calculateTextSelectionExclusion, 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
-
-
-
-
Field Detail
-
enableHighlightContents
protected static boolean enableHighlightContents
Property when enabled will set the /contents key value to the selected text of the markup annotation.
-
markupSubType
protected Name markupSubType
-
annotation
protected MarkupAnnotation annotation
-
-
Constructor Detail
-
HighLightAnnotationHandler
public HighLightAnnotationHandler(DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent)
-
-
Method Detail
-
keyTyped
public void keyTyped(KeyEvent keyEvent)
- Specified by:
keyTypedin interfaceKeyListener
-
keyPressed
public void keyPressed(KeyEvent keyEvent)
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
public void keyReleased(KeyEvent keyEvent)
- Specified by:
keyReleasedin interfaceKeyListener
-
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- Overrides:
installToolin classTextSelectionPageHandler
-
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- Overrides:
uninstallToolin classTextSelectionPageHandler
-
actionPerformed
public void actionPerformed(ActionEvent e)
- Specified by:
actionPerformedin interfaceActionListener
-
mouseClicked
public void mouseClicked(MouseEvent evt)
Check for double and triple click word and line selection- Specified by:
mouseClickedin interfaceMouseListener- Overrides:
mouseClickedin classTextSelectionPageHandler- Parameters:
evt- mouse event
-
mouseReleased
public void mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classTextSelectionPageHandler
-
checkAndApplyPreferences
protected void checkAndApplyPreferences()
- Overrides:
checkAndApplyPreferencesin classTextSelection
-
getSelectedText
protected String getSelectedText()
-
createMarkupAnnotationFromTextSelection
protected void createMarkupAnnotationFromTextSelection(MouseEvent e)
-
getSelectedTextBounds
public static ArrayList<Shape> getSelectedTextBounds(AbstractPageViewComponent pageViewComponent, AffineTransform pageTransform)
-
-