Class IconWrangler<T extends ShapeBasedAnnotation>
- Type Parameters:
T
-
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.levigo.jadice.web.client.internal.annotation.wrangler.DefaultWrangler
DefaultWrangler.CreationMode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Profile injected parameter to set the height of the icon in pxprotected int
Profile injected parameter to set the width of the icon in pxFields inherited from class com.levigo.jadice.web.client.internal.annotation.wrangler.DefaultWrangler
boundsType, createAnno, createEnd, createStart, EMPTY_HANDLE_LIST, MINIMUM_HEIGHT, MINIMUM_WIDTH, minimumHeight, minimumWidth, selectionInspector
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Rectangle2D
getAnnoRectangle
(T anno) Returns a rectangle with the size of the icon.getHandles
(PageView pageView, Page page, T annotation) Creates handles for a specific annotation.int
int
boolean
isSelectionPoint
(Annotation annotation, Point2D mousePoint, int tolerance, boolean b, int lineWidthFactor) void
setIconHeight
(int iconHeight) void
setIconWidth
(int iconWidth) protected void
updateCreated
(EditEvent e, T createAnno, Point2D createStart, Point2D createEnd) Methods inherited from class com.levigo.jadice.web.client.internal.annotation.wrangler.DefaultWrangler
afterCreate, calcMinWidth, contribute, getCreationMode, getCursor, getMinimumHeight, getMinimumWidth, handleCreateEditEvent, handleEditEvent, isSelectionTouchPoint, setCreationMode, setMinimumHeight, setMinimumWidth
-
Field Details
-
iconWidth
protected int iconWidthProfile injected parameter to set the width of the icon in px -
iconHeight
protected int iconHeightProfile injected parameter to set the height of the icon in px
-
-
Constructor Details
-
IconWrangler
public IconWrangler()
-
-
Method Details
-
updateCreated
- Overrides:
updateCreated
in classDefaultWrangler<T extends ShapeBasedAnnotation>
-
isSelectionPoint
public boolean isSelectionPoint(Annotation annotation, Point2D mousePoint, int tolerance, boolean b, int lineWidthFactor) - Overrides:
isSelectionPoint
in classDefaultWrangler<T extends ShapeBasedAnnotation>
-
getAnnoRectangle
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
Description copied from class:Wrangler
Creates handles for a specific annotation.- Overrides:
getHandles
in classDefaultWrangler<T extends ShapeBasedAnnotation>
- 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
-
getIconWidth
public int getIconWidth() -
setIconWidth
public void setIconWidth(int iconWidth) -
getIconHeight
public int getIconHeight() -
setIconHeight
public void setIconHeight(int iconHeight)
-