public interface OperationManager
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TRACK_CHANGES_ELEMENT_NAME |
static java.lang.String |
TRACK_CHANGES_NAMESPACE
The namespace used for elements in the serialized XML.
|
static java.lang.String |
XML_VERSION_ATTRIBUTE |
static java.lang.String |
XML_VERSION_ATTRIBUTE_VALUE |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Operation operation,
javax.swing.text.html.HTMLDocument document)
Accept an operation.
|
void |
addOperationChangeListener(OperationListener listener)
Add an operation change listener to the manager, listening for when the state of operations changes.
|
java.lang.String |
excludeRemovedWords(int offset,
java.lang.String text)
Retrieves text with track changes hidden regardless of the current state
|
java.awt.Color |
getColorForUser(Operation operation)
Get the color to use to render changes by an operation.
|
java.awt.Color |
getColorForUser(java.lang.String author)
Get the color to use to render changes by author.
|
int |
getOperationCount()
Get the number of operations that are currently being tracked.
|
java.util.Collection<Operation> |
getOperations()
Get the operations currently being tracked by this operation manager.
|
java.util.Collection<Operation> |
getOperationsInRange(int start,
int end)
Get the list of operations that affect the specified range.
|
java.util.Collection<Operation> |
getOperationsToRenderInRange(int start,
int end)
Get the list of operations that affect the rendering in the specified range.
|
java.lang.String |
getUsername()
Returns the current user name.
|
boolean |
isRemoved(int startOffset,
int endOffset)
Determine if all content in the specified range is marked as removed.
|
boolean |
isTrackChangesEnabled()
Returns whether or not changes are currently being tracked.
|
Operation |
nextOperation(int afterOffset)
Get the operation whose affected range starts closest to, but after afterOffset.
|
Operation |
nextOperation(Operation currentOperation)
Get the next operation after currentOperation, ordered by the start of the affected range.
|
Operation |
previousOperation(int beforeOffset)
Get the operation whose affected range starts closest to, but before or equal to beforeOffset.
|
Operation |
previousOperation(Operation currentOperation)
Get the operation before currentOperation, ordered by the start of the affected range.
|
void |
reject(Operation operation,
javax.swing.text.html.HTMLDocument document)
Reject an operation.
|
void |
removeOperation(Operation operation)
Remove an operation from the manager without doing anything else.
|
void |
removeOperationChangeListener(OperationListener listener)
Remove an operation change listener from the manager.
|
static final java.lang.String TRACK_CHANGES_NAMESPACE
static final java.lang.String TRACK_CHANGES_ELEMENT_NAME
static final java.lang.String XML_VERSION_ATTRIBUTE_VALUE
static final java.lang.String XML_VERSION_ATTRIBUTE
boolean isTrackChangesEnabled()
true if track changes is enabled, otherwise false.int getOperationCount()
java.util.Collection<Operation> getOperations()
The operations are ordered by the start of the range in the document they affect.
java.util.Collection<Operation> getOperationsToRenderInRange(int start, int end)
Note that if track changes rendering is off, this method will always return an empty collection.
The operations are ordered by the start of the range in the document they affect.
start - the start of the range to check for operations in.end - the end of the range to check for operations in.java.util.Collection<Operation> getOperationsInRange(int start, int end)
The operations are ordered by the start of the range in the document they affect.
start - the start of the range to check for operations in.end - the end of the range to check for operations in.void accept(Operation operation, javax.swing.text.html.HTMLDocument document) throws javax.swing.text.BadLocationException
Accept an operation. Once accepted, operations are no longer tracked by the manager and their effects are fully applied to the document.
operation - the operation to accept. Must have been retrieved from this operation manager.document - the document being edited. This must be the document retrieved from the HTML editing pane.javax.swing.text.BadLocationException - if the operation attempts to access or modify an invalid location in the document.void reject(Operation operation, javax.swing.text.html.HTMLDocument document) throws javax.swing.text.BadLocationException
operation - the operation to reject. Must have been retrieved from this operation manager.document - the document to reverse changes in. This must be the document retrieved from the HTML editing
pane.javax.swing.text.BadLocationException - if the operation attempts to access or modify an invalid location in the document.Operation nextOperation(Operation currentOperation)
currentOperation - the operation to get the next operation after, or null to get the first
operation in the document.Operation after currentOperation.Operation previousOperation(Operation currentOperation)
currentOperation - the operation to get the operation before, or null to get the last
operation in the document.Operation before currentOperation.Operation nextOperation(int afterOffset)
afterOffset - the offset to find the closest operation after.Operation previousOperation(int beforeOffset)
beforeOffset - the offset to find the closest operation before.java.awt.Color getColorForUser(java.lang.String author)
author - the author to get the color for.java.awt.Color getColorForUser(Operation operation)
operation - the operation to get the color for.java.lang.String getUsername()
void addOperationChangeListener(OperationListener listener)
listener - the OperationListener to receive eventsvoid removeOperationChangeListener(OperationListener listener)
listener - the OperationListener to remove.void removeOperation(Operation operation)
operation - operation to removeboolean isRemoved(int startOffset,
int endOffset)
startOffset - the start of the range.endOffset - the end of the range.true if all text in the range is marked as removed, otherwise false.java.lang.String excludeRemovedWords(int offset,
java.lang.String text)
offset - The offset of the text in the documenttext - A piece of text from the document