Package ro.sync.ecss.extensions.api
Interface AuthorDocumentFilterBypass
-
@API(type=NOT_EXTENDABLE, src=PUBLIC) public interface AuthorDocumentFilterBypass
Used as a way to circumvent calling back into theAuthorDocumentController
to change theAuthorDocument
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AuthorPersistentHighlight
addCommentMarker(int startOffset, int endOffset, java.lang.String comment, java.lang.String parentID)
Add a comment marker for the given interval.AuthorPersistentHighlight
addPersistentMarker(AuthorPersistentHighlight.PersistentHighlightType type, int startOffset, int endOffset, java.util.Map<java.lang.String,java.lang.String> properties)
Add a comment marker for the given interval.boolean
delete(int startOffset, int endOffset, boolean withBackspace)
Deletes a document fragment between the start and end offset.boolean
deleteNode(AuthorNode node)
Deletes the specified node from the document.void
insertFragment(int offset, AuthorDocumentFragment frag)
Insert anAuthorDocumentFragment
at the given offset.void
insertMultipleElements(AuthorElement parentElement, java.lang.String[] elementNames, int[] offsets, java.lang.String namespace)
Insert multiple elements at the given offsets.boolean
insertMultipleFragments(AuthorElement parentElement, AuthorDocumentFragment[] fragments, int[] offsets)
Insert multiple fragments at the given offsets.boolean
insertNode(int offset, AuthorNode node)
Insert the specified node at the given offset.void
insertText(int offset, java.lang.String text)
Inserts a text at the given offset.void
multipleDelete(AuthorElement parentElement, int[] startOffsets, int[] endOffsets)
Deletes the given intervals.void
removeAttribute(java.lang.String attributeName, AuthorElement element)
Removes an attribute from the given element.boolean
removeMarker(AuthorPersistentHighlight marker)
Remove a persistent markervoid
renameElement(AuthorElement element, java.lang.String newName, java.lang.Object infoProvider)
Rename the given element.void
setAttribute(java.lang.String attributeName, AttrValue value, AuthorElement element)
Sets the value of an attribute in the specified element.void
setDoctype(AuthorDocumentType docType)
Set a new internal document type to the Author content.void
setMultipleAttributes(int parentElementStartOffset, int[] elementOffsets, java.util.Map<java.lang.String,AttrValue> attributes)
Sets the value of the given attribute in the specified elements.void
setMultipleDistinctAttributes(int parentElementStartOffset, int[] elementOffsets, java.util.List<java.util.Map<java.lang.String,AttrValue>> attributes)
Sets the value of the given attribute in the specified elements.boolean
split(AuthorNode toSplit, int splitOffset)
Splits the specified node at the given offset.void
surroundInFragment(java.lang.String xmlFragment, int startOffset, int endOffset)
Surround the content between the given offsets with thexmlFragment
.void
surroundInFragment(AuthorDocumentFragment xmlFragment, int startOffset, int endOffset)
Surround the content between the given offsets with thexmlFragment
.void
surroundInText(java.lang.String header, java.lang.String footer, int startOffset, int endOffset)
Surround the content between the given offsets with plain text fragments(without XML parsing).void
surroundWithNode(AuthorNode node, int startOffset, int endOffset, boolean leftToRight)
Surrounds the fragment between the specified offset with the specified node.
-
-
-
Method Detail
-
insertText
void insertText(int offset, java.lang.String text)
Inserts a text at the given offset. After the operation the caret will be positioned at the end of the inserted text.- Parameters:
offset
- The insert position, 0 based.text
- The text to be inserted.
-
insertFragment
void insertFragment(int offset, AuthorDocumentFragment frag)
Insert anAuthorDocumentFragment
at the given offset.- Parameters:
offset
- The offset where the fragment will be inserted, 0 based.frag
- TheAuthorDocumentFragment
to be inserted.
-
insertNode
boolean insertNode(int offset, AuthorNode node)
Insert the specified node at the given offset.- Parameters:
offset
- The offset where the node will be inserted. 0 based.node
- TheAuthorNode
to insert.- Returns:
true
if the operation was successful.
-
insertMultipleElements
void insertMultipleElements(AuthorElement parentElement, java.lang.String[] elementNames, int[] offsets, java.lang.String namespace)
Insert multiple elements at the given offsets.
Note: The offsets and elements must be in document order.- Parameters:
parentElement
- The parent element that contains all the new inserted elements.elementNames
- The element names to be inserted.offsets
- The absolute offsets where the elements will be inserted. 0 based.namespace
- The namespace of the new inserted elements.
-
insertMultipleFragments
boolean insertMultipleFragments(AuthorElement parentElement, AuthorDocumentFragment[] fragments, int[] offsets)
Insert multiple fragments at the given offsets.
Note: The offsets and fragments must be in document order.- Parameters:
parentElement
- The parent element that contains all the new inserted elements.fragments
- The fragments to be inserted.offsets
- The absolute offsets where the elements will be inserted. 0 based.- Returns:
true
if the operation succeed.- Since:
- 14
-
delete
boolean delete(int startOffset, int endOffset, boolean withBackspace)
Deletes a document fragment between the start and end offset.- Parameters:
startOffset
- Start offset, 0 based and inclusive.endOffset
- End offset, 0 based and inclusive.withBackspace
-true
ifBACKSPACE
key was used when deleting the fragment.- Returns:
true
if the delete operation was successful.
-
deleteNode
boolean deleteNode(AuthorNode node)
Deletes the specified node from the document.- Parameters:
node
- TheAuthorNode
to delete.- Returns:
true
if the delete node operation was successful.
-
multipleDelete
void multipleDelete(AuthorElement parentElement, int[] startOffsets, int[] endOffsets)
Deletes the given intervals.
Note: The offsets must be in document order and the intervals must not intersect with each other.- Parameters:
parentElement
- The element that contains all the deleted intervals.startOffsets
- The start offset for each interval. Must be in document order. 0 based and inclusive.endOffsets
- The end offset for each interval. Must be in document order. 0 based and inclusive.
-
renameElement
void renameElement(AuthorElement element, java.lang.String newName, java.lang.Object infoProvider)
Rename the given element. Any compound must be handled externally.- Parameters:
element
- TheAuthorElement
that is renamed.newName
- The new name for the element.infoProvider
- Information provider used for internal processing.
-
setAttribute
void setAttribute(java.lang.String attributeName, AttrValue value, AuthorElement element)
Sets the value of an attribute in the specified element. Attributes set in this manner (as opposed to callingAuthorElement.setAttribute(String, AttrValue)
directly) will be subject to undo/redo.- Parameters:
attributeName
- Name of the attribute being changed.value
- NewAttrValue
for the attribute. Ifnull
, the attribute is removed from the element.element
- TheAuthorElement
whose attribute is changing.
-
removeAttribute
void removeAttribute(java.lang.String attributeName, AuthorElement element)
Removes an attribute from the given element. Attributes removed in this manner (as opposed to callingAuthorElement.setAttribute(String, AttrValue)
directly) will be subject to undo/redo.- Parameters:
attributeName
- Name of the attribute to remove.element
- TheAuthorElement
whose attribute will be removed.
-
split
boolean split(AuthorNode toSplit, int splitOffset)
Splits the specified node at the given offset. The attributes of the splitted node will also be copied excepting the unique ones. The unique attributes are identified by theUniqueAttributesRecognizer
.- Parameters:
toSplit
- TheAuthorNode
to split.splitOffset
- The split offset. The offset must be greater or equal to 1 and less than the current document length.- Returns:
true
if the node was split.
-
surroundWithNode
void surroundWithNode(AuthorNode node, int startOffset, int endOffset, boolean leftToRight)
Surrounds the fragment between the specified offset with the specified node. The fragment between the start and end offsets will become the node actual content.- Parameters:
node
- TheAuthorNode
that will surround the fragment.startOffset
- Start offset of the surrounded fragment. 0 based and inclusive.endOffset
- End offset of the surrounded fragment. 0 based and inclusive.leftToRight
-true
if after the operation the selection in the author page is done from the left to the right.
-
surroundInFragment
void surroundInFragment(java.lang.String xmlFragment, int startOffset, int endOffset) throws AuthorOperationException
Surround the content between the given offsets with thexmlFragment
. IfendOffset < startOffset
thexmlFragment
will be inserted atstartOffset
.- Parameters:
xmlFragment
- The XML fragment which will surround the given interval. The first leaf node of the XML fragment will be the parent of the surrounded content.startOffset
- The start offset of the content to be surrounded, 0 based and inclusive.endOffset
- The end offset of the content to be surrounded, 0 based and inclusive.- Throws:
AuthorOperationException
- If the content between start and end offset could not be surrounded.
-
surroundInText
void surroundInText(java.lang.String header, java.lang.String footer, int startOffset, int endOffset) throws AuthorOperationException
Surround the content between the given offsets with plain text fragments(without XML parsing). The method inserts theheader
atstartOffset
and thefooter
atendOffset
.- Parameters:
header
- The header to be inserted before the surrounded text.footer
- The footer to be inserted after the surrounded text.startOffset
- The start offset of the text to be surrounded, 0 based and inclusive.endOffset
- The end offset of the text to be surrounded, 0 based and inclusive.- Throws:
AuthorOperationException
- If the operation failed.
-
setDoctype
void setDoctype(AuthorDocumentType docType)
Set a new internal document type to the Author content. This is a good method to add new entities (regular or unparsed) to the internal document type of the document. WARNING: if these modifications affect regular entities already inserted and expanded, they will not be re-parsed and their old content will remain rendered as such.- Parameters:
docType
- The document type information.
-
surroundInFragment
void surroundInFragment(AuthorDocumentFragment xmlFragment, int startOffset, int endOffset) throws AuthorOperationException
Surround the content between the given offsets with thexmlFragment
. IfendOffset < startOffset
thexmlFragment
will be inserted atstartOffset
.- Parameters:
xmlFragment
- The XML fragment which will surround the given interval. The first leaf node of the XML fragment will be the parent of the surrounded content.startOffset
- The start offset of the content to be surrounded, 0 based and inclusive.endOffset
- The end offset of the content to be surrounded, 0 based and inclusive.- Throws:
AuthorOperationException
- Since:
- 12.1
-
setMultipleDistinctAttributes
void setMultipleDistinctAttributes(int parentElementStartOffset, int[] elementOffsets, java.util.List<java.util.Map<java.lang.String,AttrValue>> attributes)
Sets the value of the given attribute in the specified elements. Attributes set in this manner will be subject to undo/redo.- Parameters:
parentElementStartOffset
- The start offset of the parent element.elementOffsets
- The start offset for each element.attributes
- The list with attributes. Every attribute name is mapped to anAttrValue
object. If the value isnull
, the attribute will be removed.
-
setMultipleAttributes
void setMultipleAttributes(int parentElementStartOffset, int[] elementOffsets, java.util.Map<java.lang.String,AttrValue> attributes)
Sets the value of the given attribute in the specified elements. Attributes set in this manner will be subject to undo/redo.- Parameters:
parentElementStartOffset
- The start offset of the parent element.elementOffsets
- The start offset for each element.attributes
- The list with attributes. Every attribute name is mapped to anAttrValue
object. If the value isnull
, the attribute will be removed.
-
addCommentMarker
AuthorPersistentHighlight addCommentMarker(int startOffset, int endOffset, java.lang.String comment, java.lang.String parentID)
Add a comment marker for the given interval.- Parameters:
startOffset
- Start offset of markerendOffset
- End offset of markercomment
- The comment to be added.parentID
- The comment parent id (notnull
for replies).- Returns:
- The added comment highlight if the comment was added or
null
. - Since:
- 22
-
addPersistentMarker
AuthorPersistentHighlight addPersistentMarker(AuthorPersistentHighlight.PersistentHighlightType type, int startOffset, int endOffset, java.util.Map<java.lang.String,java.lang.String> properties)
Add a comment marker for the given interval.- Parameters:
type
- The persistent marker type (comment or custom)startOffset
- Start offset of markerendOffset
- End offset of markerproperties
- notnull
comment properties.- Returns:
- The added comment highlight if the comment was added or
null
. - Since:
- 23
-
removeMarker
boolean removeMarker(AuthorPersistentHighlight marker)
Remove a persistent marker- Parameters:
marker
- The marker- Returns:
- True if the marker was removed
- Since:
- 22
-
-