@API(type=EXTENDABLE,
src=PUBLIC)
public class AuthorDocumentFilter
extends java.lang.Object
AuthorDocumentFilter
, is a filter for the methods which modify the
AuthorDocument
. When the AuthorDocument
is modified through the methods from the AuthorDocumentController
,
the appropriate method invocation is forwarded to the AuthorDocumentFilter
.
The default implementation allows the modification to
occur. Subclasses can filter the modifications by conditionally invoking
methods on the superclass, or invoking the necessary methods on
the passed in AuthorDocumentFilterBypass
.
Warning: Subclasses should NOT call back
into the AuthorDocumentController for modifications in the document
instead call into the superclass or the AuthorDocumentFilterBypass
!
When methods are invoked on the AuthorDocumentFilter
, the
AuthorDocumentFilter
may callback into the
AuthorDocumentFilterBypass
multiple times, or for different regions, but
it should not callback into the AuthorDocumentFilterBypass
after returning
from the initially called method.
Constructor and Description |
---|
AuthorDocumentFilter() |
Modifier and Type | Method and Description |
---|---|
boolean |
delete(AuthorDocumentFilterBypass filterBypass,
int startOffset,
int endOffset,
boolean withBackspace)
Invoked before deleting the fragment between the specified offsets from the document.
|
boolean |
deleteNode(AuthorDocumentFilterBypass filterBypass,
AuthorNode node)
Invoked before deleting the specified node from the document.
|
void |
insertFragment(AuthorDocumentFilterBypass filterBypass,
int offset,
AuthorDocumentFragment frag)
Invoked before inserting an
AuthorDocumentFragment at the specified offset. |
void |
insertMultipleElements(AuthorDocumentFilterBypass filterBypass,
AuthorElement parentElement,
java.lang.String[] elementNames,
int[] offsets,
java.lang.String namespace)
Invoked before inserting multiple elements at the given offsets.
|
boolean |
insertMultipleFragments(AuthorDocumentFilterBypass filterBypass,
AuthorElement parentElement,
AuthorDocumentFragment[] fragments,
int[] offsets)
Invoked before inserting multiple fragments at the given offsets.
|
boolean |
insertNode(AuthorDocumentFilterBypass filterBypass,
int offset,
AuthorNode node)
Invoked before inserting a simple node into the document.
|
void |
insertText(AuthorDocumentFilterBypass filterBypass,
int offset,
java.lang.String toInsert)
Invoked before inserting the specified text at the given offset.
|
void |
multipleDelete(AuthorDocumentFilterBypass filterBypass,
AuthorElement parentElement,
int[] startOffsets,
int[] endOffsets)
Invoked before deleting the given intervals from the document.
|
void |
removeAttribute(AuthorDocumentFilterBypass filterBypass,
java.lang.String attributeName,
AuthorElement element)
Invoked before removing an attribute from the specified element.
|
void |
renameElement(AuthorDocumentFilterBypass filterBypass,
AuthorElement element,
java.lang.String newName,
java.lang.Object infoProvider)
Invoked before renaming the given element.
|
void |
setAttribute(AuthorDocumentFilterBypass filterBypass,
java.lang.String attributeName,
AttrValue value,
AuthorElement element)
Invoked before setting the value of an attribute in the specified element.
|
void |
setDoctype(AuthorDocumentFilterBypass filterBypass,
AuthorDocumentType docType)
Invoked before setting a new internal document type to the Author content.
|
boolean |
split(AuthorDocumentFilterBypass filterBypass,
AuthorNode toSplit,
int splitOffset)
Invoked before splitting the specified node into two similar nodes.
|
void |
surroundInFragment(AuthorDocumentFilterBypass filterBypass,
AuthorDocumentFragment xmlFragment,
int startOffset,
int endOffset)
Invoked before surrounding the content between the given offsets with the
xmlFragment . |
void |
surroundInFragment(AuthorDocumentFilterBypass filterBypass,
java.lang.String xmlFragment,
int startOffset,
int endOffset)
Invoked before surrounding the content between the given offsets with the
xmlFragment . |
void |
surroundInText(AuthorDocumentFilterBypass filterBypass,
java.lang.String header,
java.lang.String footer,
int startOffset,
int endOffset)
Invoked before surrounding the content between the given offsets with plain text fragments(without XML parsing).
|
void |
surroundWithNode(AuthorDocumentFilterBypass filterBypass,
AuthorNode node,
int startOffset,
int endOffset,
boolean leftToRight)
Invoked before surrounding the fragment between the specified offset with the specified node.
|
public void insertText(AuthorDocumentFilterBypass filterBypass, int offset, java.lang.String toInsert)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.offset
- The offset where the text will be inserted. 0 based.toInsert
- The text to be inserted.public void insertFragment(AuthorDocumentFilterBypass filterBypass, int offset, AuthorDocumentFragment frag)
AuthorDocumentFragment
at the specified offset.
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.offset
- The offset where the fragment will be inserted. 0 based.frag
- The AuthorDocumentFragment
to be inserted.public boolean insertNode(AuthorDocumentFilterBypass filterBypass, int offset, AuthorNode node)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.offset
- The offset where the node should be inserted. 0 based.node
- The AuthorNode
to be inserted.true
if the insert node operation succeeded.public void insertMultipleElements(AuthorDocumentFilterBypass filterBypass, AuthorElement parentElement, java.lang.String[] elementNames, int[] offsets, java.lang.String namespace)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.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.public boolean insertMultipleFragments(AuthorDocumentFilterBypass filterBypass, AuthorElement parentElement, AuthorDocumentFragment[] fragments, int[] offsets)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.parentElement
- The parent element that contains all the new inserted
elements.fragments
- The fragments to be inserted.offsets
- The absolute offsets where the fragments will be inserted. 0 based.true
if the insert operation succeed.public boolean delete(AuthorDocumentFilterBypass filterBypass, int startOffset, int endOffset, boolean withBackspace)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.startOffset
- Start offset of the fragment, 0 based and inclusive.endOffset
- End offset of the fragment, 0 based and inclusive.withBackspace
- true
if BACKSPACE
key was used for deleting the fragment.public boolean deleteNode(AuthorDocumentFilterBypass filterBypass, AuthorNode node)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.node
- The AuthorNode
to delete.true
if the delete node operation was successful.public void multipleDelete(AuthorDocumentFilterBypass filterBypass, AuthorElement parentElement, int[] startOffsets, int[] endOffsets)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.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.public void renameElement(AuthorDocumentFilterBypass filterBypass, AuthorElement element, java.lang.String newName, java.lang.Object infoProvider)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.element
- The AuthorElement
that is renamed.newName
- The new name for the element.infoProvider
- Information provider used for internal processing. It must NOT be altered inside this
AuthorDocumentFilter
method.public void setAttribute(AuthorDocumentFilterBypass filterBypass, java.lang.String attributeName, AttrValue value, AuthorElement element)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.attributeName
- Name of the attribute being changed.value
- New AttrValue
for the attribute. If null
, the attribute is
removed from the element.element
- The AuthorElement
whose attribute we are editing.public void removeAttribute(AuthorDocumentFilterBypass filterBypass, java.lang.String attributeName, AuthorElement element)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.attributeName
- Name of the attribute to remove.element
- The AuthorElement
whose attribute will be removed.public boolean split(AuthorDocumentFilterBypass filterBypass, AuthorNode toSplit, int splitOffset)
splitOffset
.
The attributes of the splitted node will also be copied excepting the
unique ones. The unique attributes are identified by the UniqueAttributesRecognizer
.
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.toSplit
- The AuthorNode
to split.splitOffset
- The split offset. The given offset is greater or equal
to 1 and less than the current document length.true
if the node was split.public void surroundWithNode(AuthorDocumentFilterBypass filterBypass, AuthorNode node, int startOffset, int endOffset, boolean leftToRight)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.node
- The AuthorNode
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.public void surroundInFragment(AuthorDocumentFilterBypass filterBypass, java.lang.String xmlFragment, int startOffset, int endOffset) throws AuthorOperationException
xmlFragment
.
If endOffset < startOffset
the xmlFragment
will be inserted at startOffset
.
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.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.AuthorOperationException
- If the content between start and end offset could not be surrounded.public void surroundInFragment(AuthorDocumentFilterBypass filterBypass, AuthorDocumentFragment xmlFragment, int startOffset, int endOffset) throws AuthorOperationException
xmlFragment
.
If endOffset < startOffset
the xmlFragment
will be inserted at startOffset
.
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.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.AuthorOperationException
public void surroundInText(AuthorDocumentFilterBypass filterBypass, java.lang.String header, java.lang.String footer, int startOffset, int endOffset) throws AuthorOperationException
header
at startOffset
and
the footer
at endOffset
.
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.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.AuthorOperationException
- If the operation failed.public void setDoctype(AuthorDocumentFilterBypass filterBypass, AuthorDocumentType docType)
Subclasses that want to conditionally modify the default processing
should override this and only call super implementation as
necessary, or call directly into the AuthorDocumentFilterBypass
as
necessary.
filterBypass
- The document filter bypass used for executing operations directly,
without additional filtering.docType
- The document type information to set.© Copyright SyncRO Soft SRL 2002 - 2014. All rights reserved.