- java.lang.Object
-
- javax.swing.undo.AbstractUndoableEdit
-
- javax.swing.text.AbstractDocument.ElementEdit
-
- All Implemented Interfaces:
Serializable,DocumentEvent.ElementChange,UndoableEdit
- Enclosing class:
- AbstractDocument
public static class AbstractDocument.ElementEdit extends AbstractUndoableEdit implements DocumentEvent.ElementChange
An implementation of ElementChange that can be added to the document event.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields declared in class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
-
-
Constructor Summary
Constructors Constructor Description ElementEdit(Element e, int index, Element[] removed, Element[] added)Constructs an edit record.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Element[]getChildrenAdded()Gets a list of children that were added.Element[]getChildrenRemoved()Gets a list of children that were removed.ElementgetElement()Returns the underlying element.intgetIndex()Returns the index into the list of elements.voidredo()Redoes a change.voidundo()Undoes a change.-
Methods declared in class javax.swing.undo.AbstractUndoableEdit
addEdit, canRedo, canUndo, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toString
-
-
-
-
Constructor Detail
-
ElementEdit
public ElementEdit(Element e, int index, Element[] removed, Element[] added)
Constructs an edit record. This does not modify the element so it can safely be used to catch up a view to the current model state for views that just attached to a model.- Parameters:
e- the elementindex- the index into the model >= 0removed- a set of elements that were removedadded- a set of elements that were added
-
-
Method Detail
-
getElement
public Element getElement()
Returns the underlying element.- Specified by:
getElementin interfaceDocumentEvent.ElementChange- Returns:
- the element
-
getIndex
public int getIndex()
Returns the index into the list of elements.- Specified by:
getIndexin interfaceDocumentEvent.ElementChange- Returns:
- the index >= 0
-
getChildrenRemoved
public Element[] getChildrenRemoved()
Gets a list of children that were removed.- Specified by:
getChildrenRemovedin interfaceDocumentEvent.ElementChange- Returns:
- the list
-
getChildrenAdded
public Element[] getChildrenAdded()
Gets a list of children that were added.- Specified by:
getChildrenAddedin interfaceDocumentEvent.ElementChange- Returns:
- the list
-
redo
public void redo() throws CannotRedoExceptionRedoes a change.- Specified by:
redoin interfaceUndoableEdit- Overrides:
redoin classAbstractUndoableEdit- Throws:
CannotRedoException- if the change cannot be redone- See Also:
AbstractUndoableEdit.canRedo()
-
undo
public void undo() throws CannotUndoExceptionUndoes a change.- Specified by:
undoin interfaceUndoableEdit- Overrides:
undoin classAbstractUndoableEdit- Throws:
CannotUndoException- if the change cannot be undone- See Also:
AbstractUndoableEdit.canUndo()
-
-