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 enumSet how many mouse interactions must be made in order to create an annotation.static enumHow to behave on rotated Pages -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResizeAnnotationsGesture.BoundsTypeprotected Tprotected Point2Dprotected Point2Dprotected DefaultWrangler.ForceAnnotationUprightProfile-injected parameter that defines the initial behavior for rotated Pagesprotected static final doubleprotected static final doubleprotected doubleThe customizable minimum height of an annotation.protected doubleThe customizable minimum width of an annotation.protected final SelectionInspector -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterCreate(EditEvent e, T selected, Object... params) Default implementation.protected doublecalcMinWidth(double cellWidth) Calculates the minimum width of an annotation.voidcontribute(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.doubleReturns the minimum height of an annotation in docp units.doubleReturns the minimum width of an annotation in docp units.booleanhandleCreateEditEvent(EditEvent e, T annotation) Invoked during the creation of an annotation.voidhandleEditEvent(EditEvent e, T selected, AnnotationEditor editor) Invoked when an existing annotation shall be edited.booleanisSelectionPoint(Annotation annotation, Point2D mousePoint, int tolerance, boolean b, int lineWidthFactor) booleanisSelectionTouchPoint(Annotation annotation, Point2D touchPoint) voidsetCreationMode(DefaultWrangler.CreationMode creationMode) voidsetForceAnnotationUpright(DefaultWrangler.ForceAnnotationUpright forceAnnotationUpright) voidsetMinimumHeight(double minHeight) Sets the minimum height of an annotation in millimeters.voidsetMinimumWidth(double minWidth) Sets the minimum width of an annotation in docp units.protected voidupdateCreated(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. -
forceAnnotationUpright
Profile-injected parameter that defines the initial behavior for rotated Pages -
boundsType
-
EMPTY_HANDLE_LIST
-
selectionInspector
-
createAnno
-
createStart
-
createEnd
-
-
Constructor Details
-
DefaultWrangler
public DefaultWrangler()
-
-
Method Details
-
getHandles
Description copied from class:WranglerCreates handles for a specific annotation.- Specified by:
getHandlesin 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:WranglerInvoked 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:
handleCreateEditEventin 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:
afterCreatein 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:
isSelectionPointin classAnnotationWrangler
-
isSelectionTouchPoint
-
handleEditEvent
Description copied from class:WranglerInvoked when an existing annotation shall be edited.- Specified by:
handleEditEventin 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
-
getForceAnnotationUpright
-
setForceAnnotationUpright
public void setForceAnnotationUpright(DefaultWrangler.ForceAnnotationUpright forceAnnotationUpright) -
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:
getCursorin 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"
-