javax.swing.text

Class DefaultStyledDocument.AttributeUndoableEdit

public static class DefaultStyledDocument.AttributeUndoableEdit extends AbstractUndoableEdit

An {@link UndoableEdit} that can undo attribute changes to an element.
Field Summary
protected AttributeSetcopy
A copy of the old attributes.
protected Elementelement
The element that has changed.
protected booleanisReplacing
If the new attributes replaced the old attributes or if they only were added to them.
protected AttributeSetnewAttributes
The new attributes.
Constructor Summary
AttributeUndoableEdit(Element el, AttributeSet newAtts, boolean replacing)
Creates a new AttributeUndoableEdit.
Method Summary
voidredo()
Redos an attribute change.
voidundo()
Undos the attribute change.

Field Detail

copy

protected AttributeSet copy
A copy of the old attributes.

element

protected Element element
The element that has changed.

isReplacing

protected boolean isReplacing
If the new attributes replaced the old attributes or if they only were added to them.

newAttributes

protected AttributeSet newAttributes
The new attributes.

Constructor Detail

AttributeUndoableEdit

public AttributeUndoableEdit(Element el, AttributeSet newAtts, boolean replacing)
Creates a new AttributeUndoableEdit.

Parameters: el the element that changes attributes newAtts the new attributes replacing if the new attributes replace the old or only append to them

Method Detail

redo

public void redo()
Redos an attribute change. This adds newAttributes to the element's attribute set, possibly clearing all attributes if isReplacing is true.

undo

public void undo()
Undos the attribute change. The copy field is set as attributes on element.