org.icepdf.ri.common.tools
Class SelectionBoxHandler

java.lang.Object
  extended by org.icepdf.ri.common.tools.CommonToolHandler
      extended by org.icepdf.ri.common.tools.SelectionBoxHandler
Direct Known Subclasses:
FreeTextAnnotationHandler, LineAnnotationHandler, LinkAnnotationHandler, SquareAnnotationHandler, TextSelection, ZoomInPageHandler, ZoomInViewHandler

public abstract class SelectionBoxHandler
extends CommonToolHandler

Handles the drawing of a selection box commonly used for selection type tools.

Since:
4.0

Field Summary
protected  java.awt.Rectangle currentRect
           
protected static float[] dash1
           
protected  java.awt.Rectangle previousRectDrawn
           
protected  java.awt.Rectangle rectToDraw
           
protected static java.awt.Color selectionBoxColour
           
protected static java.awt.BasicStroke stroke
           
 
Fields inherited from class org.icepdf.ri.common.tools.CommonToolHandler
documentViewController, documentViewModel, pageViewComponent
 
Constructor Summary
protected SelectionBoxHandler(DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent, DocumentViewModel documentViewModel)
           
 
Method Summary
 void clearRectangle(java.awt.Component component)
           
 java.awt.Rectangle getCurrentRect()
           
 java.awt.Rectangle getRectToDraw()
           
protected  PageViewComponentImpl isOverPageComponent(java.awt.Container container, java.awt.event.MouseEvent e)
          Utility method for determining if the mouse event occurred over a page in the page view.
static void paintSelectionBox(java.awt.Graphics g, java.awt.Rectangle rectToDraw)
           
 void resetRectangle(int x, int y)
           
 void setCurrentRect(java.awt.Rectangle currentRect)
           
 void setRectToDraw(java.awt.Rectangle rectToDraw)
           
abstract  void setSelectionRectangle(java.awt.Point cursorLocation, java.awt.Rectangle selection)
           
 void setSelectionSize(java.awt.Rectangle rect, java.awt.Component component)
           
 void updateDrawableRect(int compWidth, int compHeight)
          Update the drawable rectangle so that it does not extend bast the edge of the page.
 void updateSelectionSize(int x, int y, java.awt.Component component)
          Update the size of the selection rectangle.
 
Methods inherited from class org.icepdf.ri.common.tools.CommonToolHandler
convertMouseToPageSpace, convertRectangleToPageSpace, convertToPageSpace, convertToPageSpace, convertToPageSpace, getPageTransform, getPageTransform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dash1

protected static float[] dash1

stroke

protected static java.awt.BasicStroke stroke

currentRect

protected java.awt.Rectangle currentRect

rectToDraw

protected java.awt.Rectangle rectToDraw

previousRectDrawn

protected java.awt.Rectangle previousRectDrawn

selectionBoxColour

protected static java.awt.Color selectionBoxColour
Constructor Detail

SelectionBoxHandler

protected SelectionBoxHandler(DocumentViewController documentViewController,
                              AbstractPageViewComponent pageViewComponent,
                              DocumentViewModel documentViewModel)
Method Detail

setSelectionRectangle

public abstract void setSelectionRectangle(java.awt.Point cursorLocation,
                                           java.awt.Rectangle selection)

paintSelectionBox

public static void paintSelectionBox(java.awt.Graphics g,
                                     java.awt.Rectangle rectToDraw)

resetRectangle

public void resetRectangle(int x,
                           int y)

getCurrentRect

public java.awt.Rectangle getCurrentRect()

setCurrentRect

public void setCurrentRect(java.awt.Rectangle currentRect)

getRectToDraw

public java.awt.Rectangle getRectToDraw()

setRectToDraw

public void setRectToDraw(java.awt.Rectangle rectToDraw)

clearRectangle

public void clearRectangle(java.awt.Component component)

updateSelectionSize

public void updateSelectionSize(int x,
                                int y,
                                java.awt.Component component)
Update the size of the selection rectangle.

Parameters:
x - x-coordinate of the selection size update.
y - y-coordinate of the selection size update.

setSelectionSize

public void setSelectionSize(java.awt.Rectangle rect,
                             java.awt.Component component)

updateDrawableRect

public void updateDrawableRect(int compWidth,
                               int compHeight)
Update the drawable rectangle so that it does not extend bast the edge of the page.

Parameters:
compWidth - width of component being selected
compHeight - height of component being selected.

isOverPageComponent

protected PageViewComponentImpl isOverPageComponent(java.awt.Container container,
                                                    java.awt.event.MouseEvent e)
Utility method for determining if the mouse event occurred over a page in the page view.

Parameters:
e - mouse event in this coordinates space
Returns:
component that mouse event is over or null if not over a page.