|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ephox.editlive.java2.editor.DocumentModifier
public abstract class DocumentModifier
Methods that modify the document while maintaining compatibility with Track Changes
NOTE: Eventually this class will move into com.ephox.editlive.model
Constructor Summary | |
---|---|
DocumentModifier()
|
Method Summary | |
---|---|
abstract void |
adjustCharacterAttributes(int startOffset,
int endOffset,
AttributeSet add,
Collection<?> remove)
Changes the attributes of all content level elements within the specified range. |
abstract void |
adjustCharacterAttributesForElementSelection(Collection<Element> selectedElements,
AttributeSet add,
Collection<?> remove)
Changes the attributes of all content level elements that are children of the elements in selectedElements. |
abstract void |
changeListItemIndent(int startOffset,
int endOffset,
int depthFromContent,
int indentAmount,
HTML.Tag targetListTag)
Changes the indent level of list items in the specified range. |
abstract void |
endElementPropertiesTransaction()
End a properties transaction and add the operation to the manager. |
abstract String |
excludeRemovedWords(int offset,
String text)
A simple wrapper to OperationManager.excludeRemovedWords(int, String) |
abstract OperationManager |
getOperationManager()
Returns the operation manager that this modifier's operations are tracked in. |
abstract void |
insertHtml(int offset,
String html)
Inserts a HTML fragment into the document. |
abstract void |
insertHtml(int offset,
String html,
HTML.Tag firstTagToInsert,
Element insertIntoElement)
Insert a HTML fragment into the document. |
abstract void |
insertString(int offset,
AttributeSet attributes,
String insert)
Inserts a plain text string into the document with the specified formatting applied. |
abstract void |
pauseTracking()
Pause tracking operations. |
abstract void |
remove(Element element)
Remove the specified element and all its content from the document. |
abstract boolean |
remove(int startOffset,
int endOffset)
Remove the specified range from the document. |
abstract void |
resumeTracking()
Unpause tracking operations. |
abstract void |
setElementAttributes(Element element,
AttributeSet add,
Collection<?> remove)
Modify an elements attributes. |
abstract void |
setListType(int startOffset,
int endOffset,
int depthFromContent,
HTML.Tag targetListTag,
String targetListType,
String targetListStart)
Changes the list type in a given range. |
abstract void |
setOverrideContentEditable(boolean override)
Allows developers to override the content editable attribute and modify uneditable sections. |
abstract void |
startElementPropertiesTransaction()
Begin a new element properties transaction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DocumentModifier()
Method Detail |
---|
public abstract void insertHtml(int offset, String html) throws BadLocationException
offset
- the offset in the document to perform at.html
- the HTML to insert.
BadLocationException
- if offset is invalid.public abstract void insertHtml(int offset, String html, HTML.Tag firstTagToInsert, Element insertIntoElement) throws BadLocationException
offset
- the offset to insert at.html
- the HTML fragment to insert.firstTagToInsert
- the tag which indicates the start of the content to actually insert.insertIntoElement
- the element that the fragment should be inserted into.
BadLocationException
- if offset or insertIntoElement is invalid.public abstract void insertString(int offset, AttributeSet attributes, String insert) throws BadLocationException
offset
- the offset to insert the string at.attributes
- the attributes to apply to the content. This must include at a minimum a
HTML.Tag
instance specified as the value for AttributeSet.NameAttribute
.
For normal text content, use HTML.Tag.CONTENT
.insert
- the content to insert.
BadLocationException
- if the specified offset is invalid.public abstract boolean remove(int startOffset, int endOffset) throws BadLocationException
startOffset
- the start of the range to remove.endOffset
- the end of the range to remove.
true
if the changes were applied to the document, false
if they were deferred
until the
operation is accepted.
BadLocationException
- if the specified range is invalid.public abstract void remove(Element element) throws BadLocationException
element
- the element to remove.
BadLocationException
- if the element is not from this document or is no longer valid for this document.public abstract void startElementPropertiesTransaction()
public abstract void endElementPropertiesTransaction()
public abstract void setElementAttributes(Element element, AttributeSet add, Collection<?> remove)
element
- the element to change the attributes of.add
- the attributes to add.remove
- the attributes to remove.public abstract void adjustCharacterAttributes(int startOffset, int endOffset, AttributeSet add, Collection<?> remove) throws BadLocationException
setElementAttributes(Element, AttributeSet, Collection)
.
startOffset
- the start of the range to change character attributes within.endOffset
- the end of the range to change character attributes within.add
- the attributes to add.remove
- the attributes to remove.
BadLocationException
setElementAttributes(Element, AttributeSet, Collection)
public abstract void adjustCharacterAttributesForElementSelection(Collection<Element> selectedElements, AttributeSet add, Collection<?> remove) throws BadLocationException
setElementAttributes(Element, AttributeSet, Collection)
.
selectedElements
- a collection of Element
instances to change the character attributes within.add
- the attributes to add.remove
- the attributes to remove.
BadLocationException
setElementAttributes(Element, AttributeSet, Collection)
public abstract void setListType(int startOffset, int endOffset, int depthFromContent, HTML.Tag targetListTag, String targetListType, String targetListStart) throws BadLocationException
startOffset
- the start of the range to modify.endOffset
- the end of the range to modify.depthFromContent
- how many elements down from the content is the list tag to modify.
This allows nested lists to be handled correctly.targetListTag
- the list tag to change to. Either HTML.Tag.OL
or
HTML.Tag.UL
.targetListType
- the list type to change to.targetListStart
- the list number to start at.
BadLocationException
- if the offsets are invalid.public abstract void changeListItemIndent(int startOffset, int endOffset, int depthFromContent, int indentAmount, HTML.Tag targetListTag) throws BadLocationException
startOffset
- the start of the range to modify.endOffset
- the end of the range to modify.depthFromContent
- how many elements down from the content is the list tag to modify.
This allows nested lists to be handled correctly.indentAmount
- how much to increase the indent level by. Negative numbers reduce the indent level.targetListTag
- the list tag to apply to the modified list items. Either
HTML.Tag.OL
or HTML.Tag.UL
.
BadLocationException
- of the specified offsets are invalid.public abstract void pauseTracking()
public abstract void resumeTracking()
public abstract OperationManager getOperationManager()
public abstract void setOverrideContentEditable(boolean override)
override
- whether or not content editable attributes should be ignored.public abstract String excludeRemovedWords(int offset, String text)
OperationManager.excludeRemovedWords(int, String)
|
Copyright (c) 2005-2012 Ephox Pty Ltd. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |