- java.lang.Object
-
- org.icepdf.ri.common.tools.CommonToolHandler
-
- Direct Known Subclasses:
AnnotationSelectionHandler,DestinationHandler,InkAnnotationHandler,SelectionBoxHandler,TextAnnotationHandler
public abstract class CommonToolHandler extends Object
Common logic to all annotation handlers.- Since:
- 5.0
-
-
Field Summary
Fields Modifier and Type Field Description protected DocumentViewControllerdocumentViewControllerprotected AbstractPageViewComponentpageViewComponentprotected Preferencespreferences
-
Constructor Summary
Constructors Constructor Description CommonToolHandler(DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent)Create a new common tool handler.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcheckAndApplyPreferences()protected Point2D.FloatconvertToPageSpace(Point location)Converts the location point from g2d to page space.protected Point2D[]convertToPageSpace(Point... points)Converts the given point from g2d space to page space.protected RectangleconvertToPageSpace(Rectangle rect)Convert the shapes that make up the annotation to page space so that they will scale correctly at different zooms.protected ShapeconvertToPageSpace(Shape shape)Convert the shapes that make up the annotation to page space so that they will scale correctly at different zooms.protected AffineTransformgetPageTransform()protected AffineTransformgetPageTransform(AbstractPageViewComponent pageViewComponent)protected AffineTransformgetToPageSpaceTransform()protected AffineTransformgetToPageSpaceTransform(AbstractPageViewComponent pageViewComponent)
-
-
-
Field Detail
-
pageViewComponent
protected final AbstractPageViewComponent pageViewComponent
-
documentViewController
protected DocumentViewController documentViewController
-
preferences
protected final Preferences preferences
-
-
Constructor Detail
-
CommonToolHandler
public CommonToolHandler(DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent)
Create a new common tool handler. The tool handle can operate on a view or at the page level. If the handler only operates at the view level then pageViewComponent can be set to null;- Parameters:
documentViewController- parent view controllerpageViewComponent- page view component tool acts on, can be null for view tool handlers.
-
-
Method Detail
-
checkAndApplyPreferences
protected abstract void checkAndApplyPreferences()
-
getToPageSpaceTransform
protected AffineTransform getToPageSpaceTransform()
-
getToPageSpaceTransform
protected AffineTransform getToPageSpaceTransform(AbstractPageViewComponent pageViewComponent)
-
getPageTransform
protected AffineTransform getPageTransform()
-
getPageTransform
protected AffineTransform getPageTransform(AbstractPageViewComponent pageViewComponent)
-
convertToPageSpace
protected Rectangle convertToPageSpace(Rectangle rect)
Convert the shapes that make up the annotation to page space so that they will scale correctly at different zooms.- Parameters:
rect- rectangle of rectangle to convert to page space.- Returns:
- transformed bBox.
-
convertToPageSpace
protected Point2D.Float convertToPageSpace(Point location)
Converts the location point from g2d to page space.- Parameters:
location- location to convert.- Returns:
- converted point with Point2D precision.
-
convertToPageSpace
protected Shape convertToPageSpace(Shape shape)
Convert the shapes that make up the annotation to page space so that they will scale correctly at different zooms.- Parameters:
shape- shape to convert to page space.- Returns:
- transformed bBox.
-
-