Interface AuthorHighlighter
@API(type=NOT_EXTENDABLE,
src=PUBLIC)
public interface AuthorHighlighter
The highlighter which will be available to users to add, remove and check highlights.
To have access to this highlighter use the following method:
WSAuthorEditorPageBase.getHighlighter()-
Method Summary
Modifier and TypeMethodDescriptionaddHighlight(int startOffset, int endOffset, HighlightPainter painter, Object additionalData) Adds a highlight to the view.voidaddListener(AuthorHighlighterListener listener) Adds a listener to be notified about changes regarding highlights.findNonPersistentHighlights(int startOffset, int endOffset) Find all non-persistent highlights that intersect a range of content.Fetches the current list of highlights.voidRemoves all highlights this highlighter is responsible for.voidremoveHighlight(Highlight highlight) Removes a highlight from the view.voidremoveHighlights(Highlight[] highlights) Removes multiple highlights from the view.
-
Method Details
-
addHighlight
Highlight addHighlight(int startOffset, int endOffset, HighlightPainter painter, Object additionalData) throws BadLocationException Adds a highlight to the view. Returns a tag that can be used to refer to the highlight.- Parameters:
startOffset- the beginning of the range >= 0endOffset- the inclusive end of the range >= startOffsetpainter- the painter to use for the actual highlightingadditionalData- The additional data which can be stored in the highlight. May be null. In Web Author, if the provided additional data is a map, all the keys/value pairs of String/String type are inserted as attributes in the generated HTML span element (excepting the "class" key, all keys are inserted as attributes names with a "data-" prefix).- Returns:
- an object that refers to the highlight
- Throws:
BadLocationException- for an invalid range specification
-
removeHighlight
Removes a highlight from the view.- Parameters:
highlight- which highlight to remove
-
removeHighlights
Removes multiple highlights from the view.- Parameters:
highlights- which highlights to be removed- Since:
- 23.1
-
removeAllHighlights
void removeAllHighlights()Removes all highlights this highlighter is responsible for. -
getHighlights
Highlight[] getHighlights()Fetches the current list of highlights.- Returns:
- the highlight list
-
findNonPersistentHighlights
Find all non-persistent highlights that intersect a range of content.- Parameters:
startOffset- The start offset of the range.endOffset- The end offset of the range.- Returns:
- The list of non-persistent highlights
-
addListener
Adds a listener to be notified about changes regarding highlights.- Parameters:
listener- The listener- Since:
- 21.1
-