org.icepdf.ri.common.tools
Class TextAnnotationHandler

java.lang.Object
  extended by org.icepdf.ri.common.tools.CommonToolHandler
      extended by org.icepdf.ri.common.tools.TextAnnotationHandler
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener, ToolHandler

public class TextAnnotationHandler
extends CommonToolHandler
implements ToolHandler

TextAnnotationHandler tool is responsible creating a new comment type TextAnnotation when a mouse click event is thrown on the page. The new TextAnnotation is placed at the point of the page where the click took place. The default icon state is set to comment and the respective PopupAnnotation is also created and shown.

The addition of the Annotation object to the page is handled by the annotation callback.

Since:
5.0

Field Summary
protected static java.awt.Color defaultFillColor
           
protected static java.awt.Dimension ICON_SIZE
           
 
Fields inherited from class org.icepdf.ri.common.tools.CommonToolHandler
documentViewController, documentViewModel, pageViewComponent
 
Constructor Summary
TextAnnotationHandler(DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent, DocumentViewModel documentViewModel)
           
 
Method Summary
static org.icepdf.core.pobjects.annotations.PopupAnnotation createPopupAnnotation(org.icepdf.core.util.Library library, java.awt.Rectangle bbox, org.icepdf.core.pobjects.annotations.MarkupAnnotation parent, java.awt.geom.AffineTransform pageSpace)
           
static org.icepdf.core.pobjects.annotations.TextAnnotation createTextAnnotation(org.icepdf.core.util.Library library, java.awt.Rectangle bbox, java.awt.geom.AffineTransform pageSpace)
           
 void installTool()
          Callback code that allows post construct task to take place when the tool is selected via the AbstractDocumentView.setToolMode(int) call.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paintTool(java.awt.Graphics g)
          Paints the tools pre-annotation creation state.
 void uninstallTool()
          Callback code that allows pre destroy task to take place when the tool is unselected via the AbstractDocumentView.setToolMode(int) call.
 
Methods inherited from class org.icepdf.ri.common.tools.CommonToolHandler
convertMouseToPageSpace, convertRectangleToPageSpace, convertToPageSpace, convertToPageSpace, getPageTransform, getPageTransform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultFillColor

protected static java.awt.Color defaultFillColor

ICON_SIZE

protected static final java.awt.Dimension ICON_SIZE
Constructor Detail

TextAnnotationHandler

public TextAnnotationHandler(DocumentViewController documentViewController,
                             AbstractPageViewComponent pageViewComponent,
                             DocumentViewModel documentViewModel)
Method Detail

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

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

createTextAnnotation

public static org.icepdf.core.pobjects.annotations.TextAnnotation createTextAnnotation(org.icepdf.core.util.Library library,
                                                                                       java.awt.Rectangle bbox,
                                                                                       java.awt.geom.AffineTransform pageSpace)

createPopupAnnotation

public static org.icepdf.core.pobjects.annotations.PopupAnnotation createPopupAnnotation(org.icepdf.core.util.Library library,
                                                                                         java.awt.Rectangle bbox,
                                                                                         org.icepdf.core.pobjects.annotations.MarkupAnnotation parent,
                                                                                         java.awt.geom.AffineTransform pageSpace)

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

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