org.icepdf.ri.common.tools
Class LineAnnotationHandler
java.lang.Object
org.icepdf.ri.common.tools.CommonToolHandler
org.icepdf.ri.common.tools.SelectionBoxHandler
org.icepdf.ri.common.tools.LineAnnotationHandler
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.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
| Methods inherited from class org.icepdf.ri.common.tools.SelectionBoxHandler |
clearRectangle, getCurrentRect, getRectToDraw, isOverPageComponent, paintSelectionBox, resetRectangle, setCurrentRect, setRectToDraw, setSelectionSize, updateDrawableRect, updateSelectionSize |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
stroke
protected static java.awt.BasicStroke stroke
lineColor
protected static java.awt.Color lineColor
internalColor
protected static java.awt.Color internalColor
startLineEnding
protected static org.icepdf.core.pobjects.Name startLineEnding
endLineEnding
protected static org.icepdf.core.pobjects.Name endLineEnding
startOfLine
protected java.awt.geom.Point2D startOfLine
endOfLine
protected java.awt.geom.Point2D endOfLine
borderStyle
protected org.icepdf.core.pobjects.annotations.BorderStyle borderStyle
LineAnnotationHandler
public LineAnnotationHandler(DocumentViewController documentViewController,
AbstractPageViewComponent pageViewComponent,
DocumentViewModel documentViewModel)
- 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.documentViewModel - view model.
paintTool
public void paintTool(java.awt.Graphics g)
- Description copied from interface:
ToolHandler
- Paints the tools pre-annotation creation state.
- Specified by:
paintTool in interface ToolHandler
- Parameters:
g - graphics context
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased in interface java.awt.event.MouseListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
convertToPageSpace
protected java.awt.Rectangle convertToPageSpace()
- Convert the shapes that make up the annotation to page space so that
they will scale correctly at different zooms.
- Returns:
- transformed bBox.
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered in interface java.awt.event.MouseListener
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited in interface java.awt.event.MouseListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
installTool
public void installTool()
- Description copied from interface:
ToolHandler
- Callback code that allows post construct task to take place when the
tool is selected via the
AbstractDocumentView.setToolMode(int)
call.
- Specified by:
installTool in interface ToolHandler
uninstallTool
public void uninstallTool()
- Description copied from interface:
ToolHandler
- Callback code that allows pre destroy task to take place when the
tool is unselected via the
AbstractDocumentView.setToolMode(int)
call.
- Specified by:
uninstallTool in interface ToolHandler
setSelectionRectangle
public void setSelectionRectangle(java.awt.Point cursorLocation,
java.awt.Rectangle selection)
- Specified by:
setSelectionRectangle in class SelectionBoxHandler