- java.lang.Object
-
- org.icepdf.ri.common.tools.CommonToolHandler
-
- org.icepdf.ri.common.tools.SelectionBoxHandler
-
- org.icepdf.ri.common.tools.LineAnnotationHandler
-
- All Implemented Interfaces:
MouseListener,MouseMotionListener,EventListener,MouseInputListener,ToolHandler
- Direct Known Subclasses:
LineArrowAnnotationHandler
public class LineAnnotationHandler extends SelectionBoxHandler implements ToolHandler
LineAnnotationHandler tool is responsible for painting representation of a line on the screen during a click and drag mouse event. The first point is recorded on mousePressed and the line is drawn from first point the current location of the mouse.
Once the mouseReleased event is fired this handler will create new LineAnnotation and respective AnnotationComponent. The addition of the Annotation object to the page is handled by the annotation callback.- Since:
- 5.0
-
-
Field Summary
Fields Modifier and Type Field Description protected BorderStyleborderStyleprotected static NameendLineEndingprotected PointendOfLineprotected static ColorinternalColorprotected static ColorlineColorprotected static intopacityprotected static NamestartLineEndingprotected PointstartOfLineprotected static BasicStrokestroke-
Fields inherited from class org.icepdf.ri.common.tools.SelectionBoxHandler
currentRect, dash1, previousRectDrawn, rectToDraw, selectionBoxColour
-
Fields inherited from class org.icepdf.ri.common.tools.CommonToolHandler
documentViewController, pageViewComponent, preferences
-
-
Constructor Summary
Constructors Constructor Description LineAnnotationHandler(DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent)New Text selection handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckAndApplyPreferences()voidinstallTool()Callback code that allows post construct task to take place when the tool is selected via theAbstractDocumentView.setToolMode(int)call.voidmouseClicked(MouseEvent e)voidmouseDragged(MouseEvent e)voidmouseEntered(MouseEvent e)voidmouseExited(MouseEvent e)voidmouseMoved(MouseEvent e)voidmousePressed(MouseEvent e)voidmouseReleased(MouseEvent e)voidpaintTool(Graphics g)Paints the tools pre-annotation creation state.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.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
-
stroke
protected static final BasicStroke stroke
-
lineColor
protected static Color lineColor
-
internalColor
protected static Color internalColor
-
opacity
protected static int opacity
-
startLineEnding
protected static Name startLineEnding
-
endLineEnding
protected static Name endLineEnding
-
startOfLine
protected Point startOfLine
-
endOfLine
protected Point endOfLine
-
borderStyle
protected final BorderStyle borderStyle
-
-
Constructor Detail
-
LineAnnotationHandler
public LineAnnotationHandler(DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent)
New Text selection handler. Make sure to correctly and and remove this mouse and text listeners.- Parameters:
pageViewComponent- page component that this handler is bound to.documentViewController- view controller.
-
-
Method Detail
-
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
-
mousePressed
public void mousePressed(MouseEvent e)
- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
public void mouseReleased(MouseEvent e)
- Specified by:
mouseReleasedin interfaceMouseListener
-
checkAndApplyPreferences
protected void checkAndApplyPreferences()
- Specified by:
checkAndApplyPreferencesin classCommonToolHandler
-
mouseDragged
public void mouseDragged(MouseEvent e)
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseClicked
public void mouseClicked(MouseEvent e)
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseExited
public void mouseExited(MouseEvent e)
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseMoved
public void mouseMoved(MouseEvent e)
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
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
-
setSelectionRectangle
public void setSelectionRectangle(Point cursorLocation, Rectangle selection)
- Specified by:
setSelectionRectanglein classSelectionBoxHandler
-
-