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 extendingAnnotation
- Direct Known Subclasses:
ArrowAnnotationWrangler
,EllipseAnnotationWrangler
,FreehandAnnotationWrangler
,IconWrangler
,JWTImageAnnotationWrangler
,LineAnnotationWrangler
,PolygonAnnotationWrangler
,TextAnnotationWrangler
,TextHighlightAnnotationWrangler
Wrangler used for any Type without a special Wrangler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Set how many mouse interactions must be made in order to create an annotation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResizeAnnotationsGesture.BoundsType
protected T
protected Point2D
protected Point2D
protected static final double
protected static final double
protected double
The customizable minimum height of an annotation.protected double
The customizable minimum width of an annotation.protected final SelectionInspector
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterCreate
(EditEvent e, T selected, Object... params) Default implementation.protected double
calcMinWidth
(double cellWidth) Calculates the minimum width of an annotation.void
contribute
(ContributionContext cc, MenuBuilder builder, List<? extends Annotation> selected) Contributes to the annotation toolbar.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.getHandles
(PageView pageView, Page page, T annotation) Creates handles for a specific annotation.double
Returns the minimum height of an annotation in docp units.double
Returns the minimum width of an annotation in docp units.boolean
handleCreateEditEvent
(EditEvent e, T annotation) Invoked during the creation of an annotation.void
handleEditEvent
(EditEvent e, T selected, AnnotationEditor editor) Invoked when an existing annotation shall be edited.boolean
isSelectionPoint
(Annotation annotation, Point2D mousePoint, int tolerance, boolean b, int lineWidthFactor) boolean
isSelectionTouchPoint
(Annotation annotation, Point2D touchPoint) void
setCreationMode
(DefaultWrangler.CreationMode creationMode) void
setMinimumHeight
(double minHeight) Sets the minimum height of an annotation in millimeters.void
setMinimumWidth
(double minWidth) Sets the minimum width of an annotation in docp units.protected void
updateCreated
(EditEvent e, T annotationBeingCreated, Point2D createStart, Point2D createEnd)
-
Field Details
-
MINIMUM_HEIGHT
protected static final double MINIMUM_HEIGHT -
MINIMUM_WIDTH
protected static final double MINIMUM_WIDTH -
minimumWidth
protected double minimumWidthThe customizable minimum width of an annotation. Can be set from the underlying profile. -
minimumHeight
protected double minimumHeightThe customizable minimum height of an annotation. Can be set from the underlying profile. -
boundsType
-
EMPTY_HANDLE_LIST
-
selectionInspector
-
createAnno
-
createStart
-
createEnd
-
-
Constructor Details
-
DefaultWrangler
public DefaultWrangler()
-
-
Method Details
-
getHandles
Description copied from class:Wrangler
Creates handles for a specific annotation.- Specified by:
getHandles
in classWrangler<T extends Annotation>
- Parameters:
pageView
- PageView the annotation is shown on (for example for repaint calls)page
- The page that contains the annotationannotation
- The annotation the wrangler should create handles for- Returns:
- Handles that can be used to edit the annotation
-
handleCreateEditEvent
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 classWrangler<T extends Annotation>
- Parameters:
e
- An event that controls a part of the creationannotation
- The annotation that shall be created- Returns:
- True when creation finished, false else
-
afterCreate
Default implementation.Does nothing. May be overwritten in subclasses.
- Specified by:
afterCreate
in classWrangler<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
-
isSelectionPoint
public boolean isSelectionPoint(Annotation annotation, Point2D mousePoint, int tolerance, boolean b, int lineWidthFactor) - Specified by:
isSelectionPoint
in classAnnotationWrangler
-
isSelectionTouchPoint
-
handleEditEvent
Description copied from class:Wrangler
Invoked when an existing annotation shall be edited.- Specified by:
handleEditEvent
in classWrangler<T extends Annotation>
- Parameters:
e
- The event that triggered the editingselected
- The annotation to be editededitor
- The annotation editor that provides all editing options for the 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
-
setCreationMode
-
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
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 classWrangler<T extends Annotation>
- Parameters:
a
- the annotation in questiond
- the document it is part ofs
- the current selection of annotations- Returns:
- The css-value for the cursor, e.g. "pointer"
-