Class TextAnnotationWrangler
java.lang.Object
com.levigo.jadice.annotation.AnnotationWrangler
com.levigo.jadice.web.client.internal.annotation.Wrangler<TextAnnotation>
com.levigo.jadice.web.client.internal.annotation.wrangler.DefaultWrangler<TextAnnotation>
com.levigo.jadice.web.client.internal.annotation.wrangler.TextAnnotationWrangler
- Direct Known Subclasses:
CalloutAnnotationWrangler,IconifiedTextAnnotationWrangler,StampAnnotationWrangler
Manages the creation of text annotations.
This class is referenced in annotation profiles by its full classname. It supports parameterization via annotation profiles.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumPossible values for the initial cursor position in the TextEditor.static enumPossible values for the behavior of the TextEditor when an outside click occursstatic enumstatic classstatic enumPossible values for initial text selection in the TextEditor.Nested classes/interfaces inherited from class com.levigo.jadice.web.client.internal.annotation.wrangler.DefaultWrangler
DefaultWrangler.CreationMode, DefaultWrangler.ForceAnnotationUpright -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TextAnnotationWrangler.CursorPositionProfile-injected parameter that defines the initial cursor position in the TextEditor.Profile injected parameter that defines the behavior of the TextEditor on an outside click.protected intProfile-injected parameter.protected intProfile-injected parameter.protected booleanProfile-injected parameter.protected TextAnnotationWrangler.ExpandHeightProfile injected parameter that defines the behavior of the annotation according to the text lengthprotected DefaultWrangler.ForceAnnotationUprightProfile-injected parameter that defines the initial behavior for rotated Pagesprotected Booleanprotected TextAnnotationWrangler.TextSelectionProfile-injected parameter that defines the initial text selection behavior in the TextEditor.Fields 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 TypeMethodDescriptionvoidafterCreate(EditEvent editEvent, TextAnnotation selected, Object... params) Opens the text editor directly after creating a text based annotation.protected RectanglecalculateEditorBounds(PageView pageView, Page page, TextAnnotation selected) Calculates the editor bounds which should be the same size and position as the text annotation.voidcontribute(ContributionContext cc, MenuBuilder builder, List<? extends Annotation> selected) Contributes an icon to open the text editor popup.protected TextEditorcreateTextEditor(int editorMinWidth, int editorMinHeight, TextAnnotation selected, double pageHeight) Creates a text editor.intReturns the minimum text editor height.intReturns the minimum text editor width.getHandles(PageView pageView, Page page, TextAnnotation annotation) Creates handles for a specific annotation.protected EffectIcongetIcon(List<? extends Annotation> selected, Document doc) protected ToggleIconFontgetIconFont(List<? extends Annotation> selected, Document doc) protected floatgetMultiplier(PageView pageView, Page page) This method calculates the multiplier for the correct translation of units for a correct presentation and positioning of the editor.voidhandleEditEvent(EditEvent e, TextAnnotation selected, AnnotationEditor editor) Called whenever a text annotation is edited.booleanIndicates whether this wrangler executes an action after annotation creation.booleanisSelectionPoint(Annotation annotation, Point2D mousePoint, int tolerance, boolean b, int lineWidthFactor) booleanReturns if the handle to rotate the annotation is displayed.protected voidopenTextEditor(TextAnnotation selected, Page page, RenderControls controls, PageView pageView, int editorMinWidth, int editorMinHeight) Opens the text editor in a new popup.booleanThis can be overriden by any subclass to disable the initial resizing when an annotation is added with a single click.voidsetCursorPosition(TextAnnotationWrangler.CursorPosition cursorPosition) voidsetEditorBehaviorOnOutsideClick(TextAnnotationWrangler.EditorBehaviorOnOutsideClick behaviorOnOutsideClick) voidsetEditorHeight(int editorHeight) Used to inject the value defined in the annotation profile.voidsetEditorWidth(int width) Used to inject the value defined in the annotation profile.voidsetExecuteActionAfterCreation(boolean executeActionAfterCreation) Used to inject the value defined in the annotation profile.voidsetExpandHeight(TextAnnotationWrangler.ExpandHeight expandHeight) Used to inject the value defined in the annotation profile.voidsetForceAnnotationUpright(DefaultWrangler.ForceAnnotationUpright forceAnnotationUpright) voidsetShowRotationHandle(boolean showRotationHandle) Used to inject the value defined in the annotation profile.voidsetTextSelection(TextAnnotationWrangler.TextSelection textSelection) protected voidupdateCreated(EditEvent editEvent, TextAnnotation createAnno, Point2D createStart, Point2D createEnd) Methods inherited from class com.levigo.jadice.web.client.internal.annotation.wrangler.DefaultWrangler
calcMinWidth, getCreationMode, getCursor, getMinimumHeight, getMinimumWidth, handleCreateEditEvent, isSelectionTouchPoint, setCreationMode, setMinimumHeight, setMinimumWidth
-
Field Details
-
executeActionAfterCreation
protected boolean executeActionAfterCreationProfile-injected parameter. Instructs this wrangler implementation to open the text editor automatically after creating a text annotation.Defaults to false.
-
showRotationHandle
-
editorWidth
protected int editorWidthProfile-injected parameter. Instructs this wrangler implementation to open the text editor with the minimum width defined in the annotation profile.Defaults to 50 px.
-
editorHeight
protected int editorHeightProfile-injected parameter. Instructs this wrangler implementation to open the text editor with the minimum width defined in the annotation profile.Defaults to 50 px.
-
textSelection
Profile-injected parameter that defines the initial text selection behavior in the TextEditor. -
cursorPosition
Profile-injected parameter that defines the initial cursor position in the TextEditor. -
forceAnnotationUpright
Profile-injected parameter that defines the initial behavior for rotated Pages -
editorBehaviorOnOutsideClick
Profile injected parameter that defines the behavior of the TextEditor on an outside click. -
expandHeight
Profile injected parameter that defines the behavior of the annotation according to the text length
-
-
Constructor Details
-
TextAnnotationWrangler
public TextAnnotationWrangler()
-
-
Method Details
-
setExpandHeight
Used to inject the value defined in the annotation profile.- Parameters:
expandHeight- The value defined in the annotation profile.
-
setExecuteActionAfterCreation
public void setExecuteActionAfterCreation(boolean executeActionAfterCreation) Used to inject the value defined in the annotation profile.- Parameters:
executeActionAfterCreation- The value defined in the annotation profile.
-
setEditorWidth
public void setEditorWidth(int width) Used to inject the value defined in the annotation profile.- Parameters:
width- The value defined in the annotation profile.
-
setEditorHeight
public void setEditorHeight(int editorHeight) Used to inject the value defined in the annotation profile.- Parameters:
editorHeight- The value defined in the annotation profile.
-
isExecuteActionAfterCreation
public boolean isExecuteActionAfterCreation()Indicates whether this wrangler executes an action after annotation creation.- Returns:
- True, if
afterCreate(EditEvent, TextAnnotation, Object...)will be called after each annotation creation. False, else.
-
getEditorWidth
public int getEditorWidth()Returns the minimum text editor width.- Returns:
- The minimum text editor width in px.
-
getEditorHeight
public int getEditorHeight()Returns the minimum text editor height.- Returns:
- The minimum text editor height in px.
-
isShowRotationHandle
public boolean isShowRotationHandle()Returns if the handle to rotate the annotation is displayed.- Returns:
- If the rotation handle is shown.
-
setShowRotationHandle
public void setShowRotationHandle(boolean showRotationHandle) Used to inject the value defined in the annotation profile.- Parameters:
showRotationHandle- The value defined in the annotation profile.
-
getHandles
Description copied from class:WranglerCreates handles for a specific annotation.- Overrides:
getHandlesin classDefaultWrangler<TextAnnotation>- 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
-
isSelectionPoint
public boolean isSelectionPoint(Annotation annotation, Point2D mousePoint, int tolerance, boolean b, int lineWidthFactor) - Overrides:
isSelectionPointin classDefaultWrangler<TextAnnotation>
-
handleEditEvent
Called whenever a text annotation is edited.Opens the text editor when a selected annotation is double clicked and appropriate permissions are existing.
- Overrides:
handleEditEventin classDefaultWrangler<TextAnnotation>- Parameters:
e- The event that triggered the editingselected- The annotation to be editededitor- The annotation editor that provides all editing options for the annotation
-
createTextEditor
protected TextEditor createTextEditor(int editorMinWidth, int editorMinHeight, TextAnnotation selected, double pageHeight) Creates a text editor. The editor for normal text annotations does not have a minimum size.- Parameters:
pageHeight-- Returns:
- a new text editor instance.
-
updateCreated
protected void updateCreated(EditEvent editEvent, TextAnnotation createAnno, Point2D createStart, Point2D createEnd) - Overrides:
updateCreatedin classDefaultWrangler<TextAnnotation>
-
afterCreate
Opens the text editor directly after creating a text based annotation.Places the text editor popup at the upper left corner of the created annotation.
- Overrides:
afterCreatein classDefaultWrangler<TextAnnotation>- Parameters:
editEvent- the last mouse event that is related to the creation.selected- the created annotation.params- an array containing the coordinates of the upper left corner of the annotation. The text editor is placed there.
-
getIcon
- Returns:
- the icon used for the
AnnotationEditor
-
getIconFont
- Returns:
- the icon used for the
AnnotationEditor
-
getTextSelection
-
setTextSelection
-
getCursorPosition
-
setCursorPosition
-
getForceAnnotationUpright
- Overrides:
getForceAnnotationUprightin classDefaultWrangler<TextAnnotation>
-
setForceAnnotationUpright
public void setForceAnnotationUpright(DefaultWrangler.ForceAnnotationUpright forceAnnotationUpright) - Overrides:
setForceAnnotationUprightin classDefaultWrangler<TextAnnotation>
-
setEditorBehaviorOnOutsideClick
public void setEditorBehaviorOnOutsideClick(TextAnnotationWrangler.EditorBehaviorOnOutsideClick behaviorOnOutsideClick) -
getEditorBehaviorOnOutsideClick
-
calculateEditorBounds
Calculates the editor bounds which should be the same size and position as the text annotation. After that the position will be slightly adapted according to the line width of the annotation.- Parameters:
pageView- thePageViewcontaining theAnnotationpage- the page containing theAnnotationselected- the selectedAnnotation- Returns:
- the calculated editor bounds
-
getMultiplier
This method calculates the multiplier for the correct translation of units for a correct presentation and positioning of the editor.- Parameters:
pageView- thePageViewcontaining theAnnotationpage- thePagecontaining theAnnotation- Returns:
- returns the multiplier for correct unit translation
-
scaleByEditorWidth
public boolean scaleByEditorWidth()This can be overriden by any subclass to disable the initial resizing when an annotation is added with a single click.
-