Class CoreControls.AnnotationManager
Represents an object that manages the Annotations that appear on a Document's pages when displayed in a DocumentViewer.
Constructor Attributes | Constructor Name and Description |
---|---|
CoreControls.AnnotationManager(docViewer)
Creates a new instance of AnnotationManager.
|
Field Attributes | Field Name and Description |
---|---|
The scale of the hit box of the annotation control points.
|
|
The size of annotation control points.
|
|
The default annotation fill color.
|
|
The default annotation stroke color.
|
|
The default annotation stroke thickness.
|
Method Attributes | Method Name and Description |
---|---|
AddAnnotation(annotation, imported)
Adds the specified annotation to the managed list of annotations
|
|
AddAnnotations(annotations, imported)
Adds the specified annotations to the managed list of annotations
|
|
CanModify(annotation)
Whether or not the current user can modify the annotation.
|
|
createAnnotationReply(annotation)
Creates an annotation that replies to the passed in annotation.
|
|
CreateButtonWidget(widget)
Creates the DOM element for a button widget
|
|
CreateChoiceWidget(widget)
Creates the DOM element for a choice widget
|
|
CreateTextWidget(widget)
Creates the DOM element for a text widget
|
|
DeleteAnnotation(annotation, imported)
Deletes the specified annotation in the managed list of annotations.
|
|
DeleteAnnotations(annotation, imported)
Deletes the specified annotations in the managed list of annotations.
|
|
deregisterAnnotationType(elementName, annotationClass)
Deregisters an annotation class.
|
|
Deselects all annotations.
|
|
DeselectAnnotation(annotation)
Deselects the specified annotation.
|
|
Disables the use of the default sticky notes so that a custom visualization can be used.
|
|
Disables the editing of free text annotations directly on the annotation.
|
|
DrawAnnotations(pageNumber, overrideCanvas)
Draws all annotations associated with the given page number.
|
|
DrawAnnotationsFromList(annotationList)
Draws all the pages associated with the annotations in the list as long the page is visible.
|
|
DrawWidgets(pageNumber)
Draws all widgets associated with the given page number.
|
|
ExportAnnotations(options)
Exports all annotations as an XFDF (XML) string
|
|
FilterAnnotations(filterStr)
Causes annotations to be filtered based on a filter string on author.
|
|
Gets an annotation object by the annotation's ID.
|
|
getAnnotationByMouseEvent(event)
Gets the annotation by a DOM mouse event.
|
|
GetAnnotationCopy(annotation)
Returns a deep copy of the annotation
|
|
GetAnnotationFromPopup(popup)
Gets the annotation associated with the popup object.
|
|
Gets the list of all annotations managed by the AnnotationManager.
|
|
Gets an XML string specifying the added, modified and deleted annotations.
|
|
Returns the user name of the current user
|
|
Returns whether the current user has admin privileges
|
|
Returns whether the viewer currently has annotations toggled off
|
|
Returns whether the viewer is currently in read-only mode
|
|
Gets a map of registered annotations.
|
|
getRootAnnotation(annotation)
Gets the root annotation that this annotation is replying to.
|
|
Returns the list of selected annotations.
|
|
Returns whether the viewer is using a filter on annotations to be displayed
|
|
HasAnnotation(annotation)
Determines if the specified annotation exists in the managed list of annotations
|
|
HasWidget(widget)
Determines if the specified widget exists in the managed list of widgets
|
|
ImportAnnotations(xfdfString)
Loads XFDF (XML) annotations into the viewer synchronously.
|
|
ImportAnnotationsAsync(xfdfString, callback)
Loads XFDF annotations into the viewer asynchronously.
|
|
ImportAnnotCommand(xfdfString)
Updates the viewer with the xfdf changes (add/modify/delete) in the xml string
|
|
IsAnnotationSelected(annotation)
Returns whether an annotation is currently selected
|
|
JumpToAnnotation(annotation)
Jumps to the page of the annotation and if it isn't visible then centers it in the window.
|
|
[deprecated] |
LoadAnnotations(xfdfString)
Loads XFDF (XML) annotations into the viewer.
|
Pastes the currently copied annotations.
|
|
RedrawAnnotation(annotation)
Causes the specified annotation to be redrawn as long as it hasn't been added to the AnnotationManager.
|
|
registerAnnotationType(elementName, annotationClass)
Registers an annotation class.
|
|
[deprecated] |
Exports all annotations as an XFDF (XML) string
|
SelectAnnotation(annotation)
Selects the specified annotation.
|
|
SelectAnnotations(annotation)
Selects the specified annotations.
|
|
SetCurrentUser(user)
sets the current user of the viewer
|
|
SetIsAdminUser(isAdminUser)
Sets whether the current user is an admin user
|
|
SetMarkupOff(markupOff)
Sets whether annotations are toggled off
|
|
SetNoteContents(annotation, text)
Sets the value of the note for the specified annotation.
|
|
SetPermissionCheckCallback(callback)
Sets the function that should be used to determine if the annotation can be modified or not.
|
|
SetReadOnly(readOnly)
Sets whether the viewer is currently in read-only mode
|
|
SetUseFilter(useFilter)
Sets whether annotations are to be filtered based on author
|
|
SetWidgetDivCssAttributes(widget, $div)
Sets the CSS attributes for the div element representing a widget annotation
|
|
Toggles annotations on/off.
|
|
UpdateAnnotation(annotation)
Redraws the annotations on the same page as the specified annotation.
|
|
Copies the currently selected annotations.
|
Event Attributes | Event Name and Description |
---|---|
addReply(evt, annotation, parent, root)
Triggered when a reply has been added to an annotation
|
|
annotationChanged(evt, annotations, action)
Triggered when an annotation or annotations have been changed (added, deleted, modified).
|
|
annotationDoubleClicked(evt, annotation)
Triggered after an annotation has been double clicked
|
|
annotationFiltered(evt, annotationList)
Triggered after the annotations have been filtered.
|
|
annotationPopupCreated(evt, annotation, popup, comment)
Triggered after an annotation's popup has been created.
|
|
annotationPopupDeleted(evt, annotation, popup, comment)
Triggered after an annotation's popup has been deleted.
|
|
annotationPopupStateChanged(evt, annotation, popup, isOpen)
Triggered after an annotation's popup has been opened or closed.
|
|
annotationSelected(evt, annotationList, action)
Triggered after annotation selection has been changed.
|
|
annotationToggled(evt, markupOff, annotationList, useFilter)
Triggered after annotations have been toggled on/off.
|
|
deleteReply(evt, annotation, root)
Triggered when a reply has been deleted from an annotation
|
|
notify(evt, type)
Triggered when there is a notification related to annotations.
|
|
setNoteText(evt, annotation, root)
Triggered when the text should be set on a note
|
Class Detail
CoreControls.AnnotationManager(docViewer)
Creates a new instance of AnnotationManager.
- Parameters:
- {CoreControls.DocumentViewer} docViewer
Field Detail
{number}
controlPointHitBoxScale
The scale of the hit box of the annotation control points. Increase to increase the selectable area.
{number}
controlPointSize
The size of annotation control points.
{Annotations.Color}
defaultFillColor
The default annotation fill color.
{Annotations.Color}
defaultStrokeColor
The default annotation stroke color.
{number}
defaultStrokeThickness
The default annotation stroke thickness.
Method Detail
AddAnnotation(annotation, imported)
Adds the specified annotation to the managed list of annotations
- Parameters:
- {Annotations.Annotation} annotation
- An instance of Annotation.
- {boolean} imported
- Whether the annotation was imported from another source or not
AddAnnotations(annotations, imported)
Adds the specified annotations to the managed list of annotations
- Parameters:
- {array} annotations
- An array of annotations.
- {boolean} imported
- Whether the annotations were imported from another source or not
CanModify(annotation)
Whether or not the current user can modify the annotation.
- Parameters:
- {object} annotation
- The annotation to check permissions on.
{Annotations.StickyAnnotation}
createAnnotationReply(annotation)
Creates an annotation that replies to the passed in annotation. Annotation replies are sticky note annotations.
- Parameters:
- {Annotations.Annotation} annotation
- The annotation to add a reply to
- Returns:
- {Annotations.StickyAnnotation} The created annotation reply
CreateButtonWidget(widget)
Creates the DOM element for a button widget
- Parameters:
- {Annotations.ButtonWidgetAnnotation} widget
- An instance of ButtonWidgetAnnotation.
CreateChoiceWidget(widget)
Creates the DOM element for a choice widget
- Parameters:
- {Annotations.ChoiceWidgetAnnotation} widget
- An instance of ChoiceWidgetAnnotation.
CreateTextWidget(widget)
Creates the DOM element for a text widget
- Parameters:
- {Annotations.TextWidgetAnnotation} widget
- An instance of TextWidgetAnnotation.
DeleteAnnotation(annotation, imported)
Deletes the specified annotation in the managed list of annotations.
If an annotation is successfully deleted, the annotationChanged event will be fired with a "delete" action.
- Parameters:
- {Annotations.Annotation} annotation
- An instance of Annotation.
- {boolean} imported
- Whether the annotation was imported from another source or not
DeleteAnnotations(annotation, imported)
Deletes the specified annotations in the managed list of annotations.
If an annotation is successfully deleted, the annotationChanged event will be fired with a "delete" action.
- Parameters:
- {array} annotation
- An array of annotations
- {boolean} imported
- Whether the annotation was imported from another source or not
{Boolean}
deregisterAnnotationType(elementName, annotationClass)
Deregisters an annotation class.
- Parameters:
- {string} elementName
- the string representing the xml element name of the annotation
- {Annotations.Annotation} annotationClass
- the class (constructor) of the annotation
- Returns:
- {Boolean} true if deregistration was successful
DeselectAllAnnotations()
Deselects all annotations.
If an annotation is successfully deselected then the annotationSelected event will be trigger with a "deselected" action and a null value as the array of annotations parameter.
Note: the annotationSelected event has two parameters: an array of annotations and a string value of either "selected" or "deselected"
DeselectAnnotation(annotation)
Deselects the specified annotation.
If an annotation is successfully selected then the annotationSelected event will be fired with a "selected" action.
Note: the annotationSelected event has two parameters: an array of annotations and a string value of either "selected" or "deselected"
- Parameters:
- {Annotations.Annotation} annotation
- An instance of Annotation.
DisableDefaultStickyNotes()
Disables the use of the default sticky notes so that a custom visualization can be used.
DisableFreeTextEditing()
Disables the editing of free text annotations directly on the annotation.
DrawAnnotations(pageNumber, overrideCanvas)
Draws all annotations associated with the given page number.
Note that the entire annotation canvas for the page will be redrawn.
- Parameters:
- {number} pageNumber
- The page number for the page to draw.
- {object} overrideCanvas Optional
- Optionally draw directly to this canvas
DrawAnnotationsFromList(annotationList)
Draws all the pages associated with the annotations in the list as long the page is visible.
- Parameters:
- {array} annotationList
- List of annotations
DrawWidgets(pageNumber)
Draws all widgets associated with the given page number.
- Parameters:
- {number} pageNumber
- The page number for the widgets to draw.
{string}
ExportAnnotations(options)
Exports all annotations as an XFDF (XML) string
- Parameters:
- {object} options
- Options for the export. Set options.widgets or options.links to false to disable exporting of them.
- Returns:
- {string} The XFDF (XML) annotations as a string
FilterAnnotations(filterStr)
Causes annotations to be filtered based on a filter string on author.
Only annotations by the specified author will get displayed on the document.
Note that filtered annotations are not deleted, they are just not visible.
- Parameters:
- {string} filterStr
- an author name
{Annotations.Annotation}
getAnnotationById(id)
Gets an annotation object by the annotation's ID.
- Parameters:
- {string} id
- The ID of the annotation.
- Returns:
- {Annotations.Annotation} An annotation object.
{Annotations.Annotation}
getAnnotationByMouseEvent(event)
Gets the annotation by a DOM mouse event. This method can be used to test if a mouse point will hit any annotations on page.
- Parameters:
- {type} event
- A DOM mouse event.
- Returns:
- {Annotations.Annotation} An annotation object.
{Annotations.Annotation}
GetAnnotationCopy(annotation)
Returns a deep copy of the annotation
- Parameters:
- {Annotations.Annotation} annotation
- An instance of Annotation to be copied.
- Returns:
- {Annotations.Annotation} a copy of the annotation, null if annotation cannot be copied
{Annotations.Annotation}
GetAnnotationFromPopup(popup)
Gets the annotation associated with the popup object.
- Parameters:
- {object} popup
- The popup object associated with an annotation
- Returns:
- {Annotations.Annotation} The annotation that the popup belongs to
{Annotations.Annotation[]}
GetAnnotationsList()
Gets the list of all annotations managed by the AnnotationManager.
- Returns:
- {Annotations.Annotation[]} An array of Annotations.
{string}
GetAnnotCommand()
Gets an XML string specifying the added, modified and deleted annotations.
Added and modified annotations will have their XFDF representation included
while deleted annotations will only include their id.
- Returns:
- {string} The command string
{string}
GetCurrentUser()
Returns the user name of the current user
- Returns:
- {string} the user name of the current user
{boolean}
GetIsAdminUser()
Returns whether the current user has admin privileges
- Returns:
- {boolean} true if the current user is an admin, false otherwise
{boolean}
GetMarkupOff()
Returns whether the viewer currently has annotations toggled off
- Returns:
- {boolean} true if annots are currently toggled off, false otherwise
{boolean}
GetReadOnly()
Returns whether the viewer is currently in read-only mode
- Returns:
- {boolean} true if the current viewer is in read-only mode, false otherwise
{object}
getRegisteredAnnotationTypes()
Gets a map of registered annotations. This can be modified directly, instead of using AnnotationManager#registerAnnotationType and AnnotationManager#deregisterAnnotationType.
- Returns:
- {object} a JavaScript object containing a key-value map, where the key is the annotation element name and the value is an array of Annotation classes.
{Annotations.Annotation}
getRootAnnotation(annotation)
Gets the root annotation that this annotation is replying to.
If this annotation is not replying to anything then the root is itself.
- Parameters:
- {Annotations.Annotation} annotation
- The annotation from which to find the root annotation in the reply chain
- Returns:
- {Annotations.Annotation} The root annotation
{Annotations.Annotation[]}
GetSelectedAnnotations()
Returns the list of selected annotations.
- Returns:
- {Annotations.Annotation[]} An array of selected annotations.
{boolean}
GetUseFilter()
Returns whether the viewer is using a filter on annotations to be displayed
- Returns:
- {boolean} true if annots are currently filtered, false otherwise
HasAnnotation(annotation)
Determines if the specified annotation exists in the managed list of annotations
- Parameters:
- {Annotations.Annotation} annotation
- An instance of Annotation.
HasWidget(widget)
Determines if the specified widget exists in the managed list of widgets
- Parameters:
- {Annotations.WidgetAnnotation} widget
- An instance of WidgetAnnotation.
ImportAnnotations(xfdfString)
Loads XFDF (XML) annotations into the viewer synchronously.
- Parameters:
- {string} xfdfString
- The XFDF (XML) annotations as a string
ImportAnnotationsAsync(xfdfString, callback)
Loads XFDF annotations into the viewer asynchronously.
- Parameters:
- {string} xfdfString
- The XFDF annotations as a string
- {function} callback
- The function that is called when the annotations have been imported. the list of annotations that were added is passed to the callback
{array}
ImportAnnotCommand(xfdfString)
Updates the viewer with the xfdf changes (add/modify/delete) in the xml string
- Parameters:
- {string} xfdfString
- The XML annotation updates as a string
- Returns:
- {array} The list of annotations that were updated
{boolean}
IsAnnotationSelected(annotation)
Returns whether an annotation is currently selected
- Parameters:
- {Annotations.Annotation} annotation
- An instance of Annotation.
- Returns:
- {boolean} true if annotation is selected, false otherwise
JumpToAnnotation(annotation)
Jumps to the page of the annotation and if it isn't visible then centers it in the window.
- Parameters:
- {Annotations.Annotation} annotation
- The annotation to be jumped to.
LoadAnnotations(xfdfString)
Loads XFDF (XML) annotations into the viewer.
- Parameters:
- {string} xfdfString
- The XFDF (XML) annotations as a string
- Deprecated:
- Use ImportAnnotations instead
PasteCopiedAnnotations()
Pastes the currently copied annotations.
RedrawAnnotation(annotation)
Causes the specified annotation to be redrawn as long as it hasn't been added to the AnnotationManager.
Note that the entire annotation canvas for the page will be redrawn.
- Parameters:
- {Annotations.Annotation} annotation
- The annotation to be redrawn.
{Boolean}
registerAnnotationType(elementName, annotationClass)
Registers an annotation class. Annotations that are registered will be serialized and deserialized by the AnnotationManager.
- Parameters:
- {string} elementName
- the string representing the xml element name of the annotation
- {Annotations.Annotation} annotationClass
- the class (constructor) of the annotation
- Returns:
- {Boolean} true if registration was successful
{string}
SaveAnnotations()
Exports all annotations as an XFDF (XML) string
- Deprecated:
- Use ExportAnnotations instead
- Returns:
- {string} The XFDF (XML) annotations as a string
SelectAnnotation(annotation)
Selects the specified annotation.
If an annotation is successfully selected then the annotationSelected event will be fired with a "selected" action.
Note: the annotationSelected event has two parameters: an array of annotations and a string value of either "selected" or "deselected"
- Parameters:
- {Annotations.Annotation} annotation
- An instance of Annotation.
SelectAnnotations(annotation)
Selects the specified annotations.
If an annotation is successfully selected then the annotationSelected event will be fired with a "selected" action.
Note: the annotationSelected event has two parameters: an array of annotations and a string value of either "selected" or "deselected"
- Parameters:
- {Annotations.Annotation[]} annotation
- An array of Annotations.
SetCurrentUser(user)
sets the current user of the viewer
- Parameters:
- {string} user
- the user name of the current user
SetIsAdminUser(isAdminUser)
Sets whether the current user is an admin user
- Parameters:
- {boolean} isAdminUser
- true if the current user is an admin, false otherwise
SetMarkupOff(markupOff)
Sets whether annotations are toggled off
- Parameters:
- {boolean} markupOff
- true if the annotations are toggled off, false otherwise
SetNoteContents(annotation, text)
Sets the value of the note for the specified annotation.
- Parameters:
- {Annotations.Annotation} annotation
- The annotation that will have its note updated
- {string} text
- The value to update the note text to
SetPermissionCheckCallback(callback)
Sets the function that should be used to determine if the annotation can be modified or not.
- Parameters:
- {function} callback
- The function that should be called. Should return true or false.
SetReadOnly(readOnly)
Sets whether the viewer is currently in read-only mode
- Parameters:
- {boolean} readOnly
- true if the viewer is in read-only mode, false otherwise
SetUseFilter(useFilter)
Sets whether annotations are to be filtered based on author
- Parameters:
- {boolean} useFilter
- true if the annotations are to be filtered, false otherwise
SetWidgetDivCssAttributes(widget, $div)
Sets the CSS attributes for the div element representing a widget annotation
- Parameters:
- {Annotations.WidgetAnnotation} widget
- An instance of WidgetAnnotation.
- $div
- The div element representing the widget.
ToggleAnnotations()
Toggles annotations on/off.
i.e. Show all annotations or hide all annotations.
UpdateAnnotation(annotation)
Redraws the annotations on the same page as the specified annotation.
- Parameters:
- {Annotations.Annotation} annotation
- An instance of Annotation.
UpdateCopiedAnnotations()
Copies the currently selected annotations.
Event Detail
addReply(evt, annotation, parent, root)
Triggered when a reply has been added to an annotation
- Parameters:
- {object} evt
- Event object
- {object} annotation
- The annotation that was added
- {object} parent
- The annotation that is the direct parent of the first annotation
- {object} root
- The annotation that is the root parent of the first annotation (may be the same as parent)
annotationChanged(evt, annotations, action)
Triggered when an annotation or annotations have been changed (added, deleted, modified).
Attach like annotManager.on('annotationChanged', callback)
- Parameters:
- {object} evt
- Event object
- {array} annotations
- The annotations that were changed
- {string} action
- The action that occurred (add, delete, modify)
annotationDoubleClicked(evt, annotation)
Triggered after an annotation has been double clicked
- Parameters:
- {object} evt
- Event object
- {object} annotation
- The annotation that has been double clicked
annotationFiltered(evt, annotationList)
Triggered after the annotations have been filtered.
- Parameters:
- {object} evt
- Event object
- {array} annotationList
- List of all annotations
annotationPopupCreated(evt, annotation, popup, comment)
Triggered after an annotation's popup has been created.
- Parameters:
- {object} evt
- Event object
- {object} annotation
- The annotation that the popup belongs to
- {object} popup
- The popup element
- {object} comment
- The comment textarea
annotationPopupDeleted(evt, annotation, popup, comment)
Triggered after an annotation's popup has been deleted.
- Parameters:
- {object} evt
- Event object
- {object} annotation
- The annotation that the popup belongs to
- {object} popup
- The popup element
- {object} comment
- The comment textarea
annotationPopupStateChanged(evt, annotation, popup, isOpen)
Triggered after an annotation's popup has been opened or closed.
- Parameters:
- {object} evt
- Event object
- {object} annotation
- The annotation that the popup belongs to
- {object} popup
- The popup element
- {boolean} isOpen
- Whether the popup is open or not
annotationSelected(evt, annotationList, action)
Triggered after annotation selection has been changed.
- Parameters:
- {object} evt
- Event object
- {array} annotationList
- List of annotations that have selected or deselected
- {string} action
- Either 'selected' or 'deselected'
annotationToggled(evt, markupOff, annotationList, useFilter)
Triggered after annotations have been toggled on/off.
- Parameters:
- {object} evt
- Event object
- {boolean} markupOff
- Whether the annotations are visible or not
- {array} annotationList
- List of all annotations
- {boolean} useFilter
- Whether a filter is being used or not
deleteReply(evt, annotation, root)
Triggered when a reply has been deleted from an annotation
- Parameters:
- {object} evt
- Event object
- {object} annotation
- The annotation that was deleted
- {object} root
- The annotation that is the root parent of the first annotation
notify(evt, type)
Triggered when there is a notification related to annotations.
- Parameters:
- {object} evt
- Event object
- {string} type
- The type of notification that has occurred
setNoteText(evt, annotation, root)
Triggered when the text should be set on a note
- Parameters:
- {object} evt
- Event object
- {object} annotation
- The annotation that needs to have its note text updated
- {object} root
- The annotation that is the root parent of the first annotation