Oxygen XML Editor 14.2 Author API

ro.sync.ecss.extensions.api.node
Class AuthorDocumentFragment

java.lang.Object
  extended by ro.sync.ecss.extensions.api.node.AuthorDocumentFragment

@API(type=NOT_EXTENDABLE,
     src=PUBLIC)
public class AuthorDocumentFragment
extends java.lang.Object

Represents a fragment of an XML document. It holds a copy of the content of a document fragment. A change in the fragment does not change the edited document. For changing the edited document use insert methods of AuthorDocumentController.

For the following XML code fragment:
accounting<person><name>John W.</name><email>john@gmail.com</email></person><person><name>Mary B.</name><email>mary@msn.com</email></person>
the corresponding document fragment structure can be represented as:


The image represents the content of the fragment and the red markers represent special control characters which are used to point to the start and the end offsets of the fragment containing nodes.


Constructor Summary
AuthorDocumentFragment(Content content, java.util.List<AuthorNode> elements, int leftSplits, int righSplits)
          Constructor.
AuthorDocumentFragment(Content content, java.util.List<AuthorNode> elements, int leftSplits, int righSplits, java.util.List<AuthorPersistentHighlight> changeMarkers, java.util.List<AuthorPersistentHighlight> commentMarkers)
          Constructor.
 
Method Summary
 boolean containsSimpleText()
          Check if an author document fragment content contains simple text.
 int getAcceptedLength()
           
 java.util.List<AuthorPersistentHighlight> getChangeHighlights()
          Returns the list with the fragment change tracking highlights.
 java.util.List<AuthorPersistentHighlight> getCommentsAndCustomHighlights()
          Returns the list with the fragment comment highlights or custom highlights.
 Content getContent()
           
 java.util.List<AuthorNode> getContentNodes()
          Get the list of the first-level nodes contained in this Author document fragment.
 int getLeftSplits()
          This method is intended for internal use only.
 int getLength()
           
 int getRightSplits()
          This method is intended for internal use only.
 boolean isEmpty()
           
 void setChangeHighlights(java.util.List<AuthorPersistentHighlight> markers)
          This class is intended for internal use only.
Set the list with the change tracking highlights.
 void setCommentAndCustomHighlights(java.util.List<AuthorPersistentHighlight> highlights)
          This class is intended for internal use only.
Set the list with the fragment comment highlights or custom highlights.
 void setLeftSplits(int leftSplits)
          This method is intended for internal use only.
Set the number of the elements the fragment splits to the left.
 void setRighSplits(int righSplits)
          This method is intended for internal use only.
Set the number of the elements the fragment splits to the right.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AuthorDocumentFragment

public AuthorDocumentFragment(Content content,
                              java.util.List<AuthorNode> elements,
                              int leftSplits,
                              int righSplits)
Constructor.

Parameters:
content - The Content holding the fragment's content.
elements - Elements that make up this fragment.
leftSplits - Number of elements it splits to the left.
righSplits - Number of elements it splits to the right.

AuthorDocumentFragment

public AuthorDocumentFragment(Content content,
                              java.util.List<AuthorNode> elements,
                              int leftSplits,
                              int righSplits,
                              java.util.List<AuthorPersistentHighlight> changeMarkers,
                              java.util.List<AuthorPersistentHighlight> commentMarkers)
Constructor.

Parameters:
content - The Content holding the fragment's content.
elements - Elements that make up this fragment.
leftSplits - Number of elements it splits to the left.
righSplits - Number of elements it splits to the right.
changeMarkers - The list of change markers
commentMarkers - Comment markers
Method Detail

getContent

public Content getContent()
Returns:
the Content object holding this fragment's content.

getAcceptedLength

public int getAcceptedLength()
Returns:
The number of characters, including sentinels (element start and end markers), present in the fragment. If there are delete change markers, they are treated as accepted

getLength

public int getLength()
Returns:
The number of characters, including sentinels (element start and end markers), present in the fragment.

getContentNodes

public java.util.List<AuthorNode> getContentNodes()
Get the list of the first-level nodes contained in this Author document fragment. Each of this AuthorNode can contain another nodes (the Author nodes model is similar with the DOM model).

Returns:
The nodes that make up this fragment.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getLeftSplits

public int getLeftSplits()
This method is intended for internal use only.

Returns:
Number of nodes the fragment splits to the left.

getRightSplits

public int getRightSplits()
This method is intended for internal use only.

Returns:
Number of nodes the fragment splits to the right.

setLeftSplits

public void setLeftSplits(int leftSplits)
This method is intended for internal use only.
Set the number of the elements the fragment splits to the left.

Parameters:
leftSplits - The left splits count.

setRighSplits

public void setRighSplits(int righSplits)
This method is intended for internal use only.
Set the number of the elements the fragment splits to the right.

Parameters:
righSplits - The right splits count.

getChangeHighlights

public java.util.List<AuthorPersistentHighlight> getChangeHighlights()
Returns the list with the fragment change tracking highlights.

If the fragment is created when change tracking is turned OFF and the fragment contains Track Changes, then the returned list will contain the changes which intersected the fragment region, made relative to the fragment content.
If the fragment is created when change tracking in turned ON then the fragment will contain the selection with all changes accepted (so the list will be always NULL).

To get the list with all change tracking highlights from the document use the AuthorChangeTrackingController.getChangeHighlights() method.

Returns:
Returns list with the fragment change tracking highlights.
The start and end offset of the returned change tracking highlights are relative to the start offset of this document fragment.
The type of the highlights can be one of AuthorPersistentHighlight.PersistentHighlightType.CHANGE_INSERT or AuthorPersistentHighlight.PersistentHighlightType.CHANGE_DELETE
Since:
12

getCommentsAndCustomHighlights

public java.util.List<AuthorPersistentHighlight> getCommentsAndCustomHighlights()
Returns the list with the fragment comment highlights or custom highlights.

If the fragment contains comments or custom highlights then the returned list will contain the comments which intersected the fragment, made relative to the fragment content.

To get the list with all the comments or persistent highlights from the document see the AuthorReviewController.getCommentHighlights() and AuthorPersistentHighlighter.getHighlights() methods.

Returns:
Returns the fragment comment highlights or custom highlights list. The type for a returned AuthorPersistentHighlight can be AuthorPersistentHighlight.PersistentHighlightType.COMMENT or AuthorPersistentHighlight.PersistentHighlightType.CUSTOM_HIGHLIGHT. The custom highlights can be inserted and managed by using the AuthorPersistentHighlighter.
Since:
12

setCommentAndCustomHighlights

public void setCommentAndCustomHighlights(java.util.List<AuthorPersistentHighlight> highlights)
This class is intended for internal use only.
Set the list with the fragment comment highlights or custom highlights.

Parameters:
highlights - The comment highlights or custom highlights list.
Since:
12

setChangeHighlights

public void setChangeHighlights(java.util.List<AuthorPersistentHighlight> markers)
This class is intended for internal use only.
Set the list with the change tracking highlights.

Parameters:
markers - The change tracking highlights list.
Since:
12

isEmpty

public boolean isEmpty()
Returns:
true If the fragment is empty.

containsSimpleText

public boolean containsSimpleText()
Check if an author document fragment content contains simple text.

Returns:
True if the content of the given author document fragment contains simple text (the whitespaces are ignored).

Oxygen XML Editor 14.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2013. All rights reserved.