Class DefaultWrangler<T extends Annotation>

java.lang.Object
com.levigo.jadice.annotation.AnnotationWrangler
com.levigo.jadice.web.client.internal.annotation.Wrangler<T>
com.levigo.jadice.web.client.internal.annotation.wrangler.DefaultWrangler<T>
Type Parameters:
T - class extending Annotation
Direct Known Subclasses:
ArrowAnnotationWrangler, EllipseAnnotationWrangler, FreehandAnnotationWrangler, IconWrangler, JWTImageAnnotationWrangler, LineAnnotationWrangler, PolygonAnnotationWrangler, TextAnnotationWrangler, TextHighlightAnnotationWrangler

public class DefaultWrangler<T extends Annotation> extends Wrangler<T>
Wrangler used for any Type without a special Wrangler
  • Field Details

    • MINIMUM_HEIGHT

      protected static final double MINIMUM_HEIGHT
    • MINIMUM_WIDTH

      protected static final double MINIMUM_WIDTH
    • minimumWidth

      protected double minimumWidth
      The customizable minimum width of an annotation. Can be set from the underlying profile.
    • minimumHeight

      protected double minimumHeight
      The customizable minimum height of an annotation. Can be set from the underlying profile.
    • boundsType

    • EMPTY_HANDLE_LIST

      public static final List<Handle> EMPTY_HANDLE_LIST
    • selectionInspector

      protected final SelectionInspector selectionInspector
    • createAnno

      protected T extends Annotation createAnno
    • createStart

      protected Point2D createStart
    • createEnd

      protected Point2D createEnd
  • Constructor Details

    • DefaultWrangler

      public DefaultWrangler()
  • Method Details

    • getHandles

      public List<? extends Handle> getHandles(PageView pageView, Page page, T annotation)
      Description copied from class: Wrangler
      Creates handles for a specific annotation.
      Specified by:
      getHandles in class Wrangler<T extends Annotation>
      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
    • handleCreateEditEvent

      public boolean handleCreateEditEvent(EditEvent e, T annotation)
      Description copied from class: Wrangler
      Invoked during the creation of an annotation.

      Can be invoked multiple times. For example during the creation of a polygon based annotation each mouse down event could indicate a new corner of the polygon at the current mouse position.

      Specified by:
      handleCreateEditEvent in class Wrangler<T extends Annotation>
      Parameters:
      e - An event that controls a part of the creation
      annotation - The annotation that shall be created
      Returns:
      True when creation finished, false else
    • afterCreate

      public void afterCreate(EditEvent e, T selected, Object... params)
      Default implementation.

      Does nothing. May be overwritten in subclasses.

      Specified by:
      afterCreate in class Wrangler<T extends Annotation>
      Parameters:
      e - The last mouse event that is related to the creation.
      selected - The created annotation.
      params - An optional array containing parameters.
    • updateCreated

      protected void updateCreated(EditEvent e, T annotationBeingCreated, Point2D createStart, Point2D createEnd)
    • isSelectionPoint

      public boolean isSelectionPoint(Annotation annotation, Point2D mousePoint, int tolerance, boolean b, int lineWidthFactor)
      Specified by:
      isSelectionPoint in class AnnotationWrangler
    • isSelectionTouchPoint

      public boolean isSelectionTouchPoint(Annotation annotation, Point2D touchPoint)
    • handleEditEvent

      public void handleEditEvent(EditEvent e, T selected, AnnotationEditor editor)
      Description copied from class: Wrangler
      Invoked when an existing annotation shall be edited.
      Specified by:
      handleEditEvent in class Wrangler<T extends Annotation>
      Parameters:
      e - The event that triggered the editing
      selected - The annotation to be edited
      editor - The annotation editor that provides all editing options for the annotation
    • contribute

      public void contribute(ContributionContext cc, MenuBuilder builder, List<? extends Annotation> selected)
      Description copied from class: Wrangler
      Contributes to the annotation toolbar.
      Specified by:
      contribute in class Wrangler<T extends Annotation>
      Parameters:
      cc - The contribution context
      builder - The menu builder
      selected - The selected annotation
    • getMinimumWidth

      public double getMinimumWidth()
      Returns the minimum width of an annotation in docp units.
      Returns:
      the minimum width of an annotation
    • setMinimumWidth

      public void setMinimumWidth(double minWidth)
      Sets the minimum width of an annotation in docp units. Used to inject the value defined in an underlying annotation profile.
      Parameters:
      minWidth - the minimum width of an annotation
    • getMinimumHeight

      public double getMinimumHeight()
      Returns the minimum height of an annotation in docp units.
      Returns:
      the minimum height of an annotation
    • setMinimumHeight

      public void setMinimumHeight(double minHeight)
      Sets the minimum height of an annotation in millimeters. Used to inject the value defined in an underlying annotation profile.
      Parameters:
      minHeight - the minimum height of an annotation
    • getCreationMode

      public DefaultWrangler.CreationMode getCreationMode()
    • setCreationMode

      public void setCreationMode(DefaultWrangler.CreationMode creationMode)
    • calcMinWidth

      protected double calcMinWidth(double cellWidth)
      Calculates the minimum width of an annotation.
      Parameters:
      cellWidth - The width of a grid cell
      Returns:
      The minimum width of the annotation
    • getCursor

      public String getCursor(Annotation a, Document d, AnnotationSelection s)
      Returns the css-value for the cursor to be used when hovering the Annotation this wrangler is attached to. Call UIStyler.get().cursorStyle().{any function} for possible return values.

      The default wrangler differentiates between an annotation that can be changed and one that can't.
      To make this difference visible, change the value of UNCHANGEABLE_ANNO_CURSOR in cursorStyle.gss.

      Specified by:
      getCursor in class Wrangler<T extends Annotation>
      Parameters:
      a - the annotation in question
      d - the document it is part of
      s - the current selection of annotations
      Returns:
      The css-value for the cursor, e.g. "pointer"