Class Wrangler<Type extends Annotation>

java.lang.Object
com.levigo.jadice.annotation.AnnotationWrangler
com.levigo.jadice.web.client.internal.annotation.Wrangler<Type>
Type Parameters:
Type - class extending Annotation
Direct Known Subclasses:
DefaultWrangler

public abstract class Wrangler<Type extends Annotation> extends AnnotationWrangler
Base class of all wranglers.

Provides generic methods for creating, editing and managing annotations. Does not know specific annotation types.

  • Constructor Details

    • Wrangler

      public Wrangler()
  • Method Details

    • getHandles

      public abstract List<? extends Handle> getHandles(PageView pageView, Page page, Type annotation)
      Creates handles for a specific 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 abstract boolean handleCreateEditEvent(EditEvent e, Type annotation)
      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.

      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 abstract void afterCreate(EditEvent e, Type createdAnnotation, Object... params)
      Invoked after the creation of an annotation is finished.

      Can be used to process an annotation immediately after its creation. For example after the creation of a text based annotation this method could be used to open the text editor.

      Parameters:
      e - The event of the last call to handleCreateEditEvent(EditEvent, Annotation)
      createdAnnotation - The newly created annotation
      params - An optional array containing parameters
    • handleEditEvent

      public abstract void handleEditEvent(EditEvent e, Type selected, AnnotationEditor editor)
      Invoked when an existing annotation shall be edited.
      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 abstract void contribute(ContributionContext cc, MenuBuilder builder, List<? extends Annotation> selected)
      Contributes to the annotation toolbar.
      Parameters:
      cc - The contribution context
      builder - The menu builder
      selected - The selected annotation
    • getCursor

      public abstract 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.
      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"