Type Parameters:
T -

public class IconWrangler<T extends ShapeBasedAnnotation> extends DefaultWrangler<T>
This wrangler is intended to be used in conjunction with the IconRenderer. The Wrangler will set the correct anno size after creating it (the size of the icon).

The wrangler has 2 parameters: iconWidth+iconHeight. Those parameters should be set for every wrangler in the profile. As fallback, the size might be retrieved from an IconRenderer, if such renderer is used for the annotation in question.

Additionally, the wrangler computes the "is selection point" by checking if the click is inside the image.

  • Field Details

    • iconWidth

      protected int iconWidth
      Profile injected parameter to set the width of the icon in px
    • iconHeight

      protected int iconHeight
      Profile injected parameter to set the height of the icon in px
  • Constructor Details

    • IconWrangler

      public IconWrangler()
  • Method Details

    • updateCreated

      protected void updateCreated(EditEvent e, T createAnno, Point2D createStart, Point2D createEnd)
      Overrides:
      updateCreated in class DefaultWrangler<T extends ShapeBasedAnnotation>
    • isSelectionPoint

      public boolean isSelectionPoint(Annotation annotation, Point2D mousePoint, int tolerance, boolean b, int lineWidthFactor)
      Overrides:
      isSelectionPoint in class DefaultWrangler<T extends ShapeBasedAnnotation>
    • getAnnoRectangle

      protected Rectangle2D getAnnoRectangle(T anno)
      Returns a rectangle with the size of the icon.

      This method will use the "iconWidth" and "iconHeight" profile parameters to determine the anno size. If those values are not present in the profile, it is checked if a IconRenderer is used for rendering. In that case, the values from the renderer will be used.

      If there is no value in the profile and no IconRenderer, a warning is logged and no user operations are possible with that annotation.

      Returns:
      a rectangle (at position 0, 0) with the size of the annotation (in jadice document units; ready to use in isSelectionPoint and the like)
    • getHandles

      public List<? extends Handle> getHandles(PageView pageView, Page page, T annotation)
      Description copied from class: Wrangler
      Creates handles for a specific annotation.
      Overrides:
      getHandles in class DefaultWrangler<T extends ShapeBasedAnnotation>
      Parameters:
      pageView - PageView the annotation is shown on (for example for repaint calls)
      page - The page that contains the annotation
      annotation - The annotation the wrangler should create handles for
      Returns:
      Handles that can be used to edit the annotation
    • getIconWidth

      public int getIconWidth()
    • setIconWidth

      public void setIconWidth(int iconWidth)
    • getIconHeight

      public int getIconHeight()
    • setIconHeight

      public void setIconHeight(int iconHeight)