javax.swing.text
Class DefaultStyledDocument.AttributeUndoableEdit

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit
All Implemented Interfaces:
Serializable, UndoableEdit
Enclosing class:
DefaultStyledDocument

public static class DefaultStyledDocument.AttributeUndoableEdit
extends AbstractUndoableEdit

An UndoableEdit that can undo attribute changes to an element.

See Also:
Serialized Form

Field Summary
protected  AttributeSet copy
          A copy of the old attributes.
protected  Element element
          The element that has changed.
protected  boolean isReplacing
          If the new attributes replaced the old attributes or if they only were added to them.
protected  AttributeSet newAttributes
          The new attributes.
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
DefaultStyledDocument.AttributeUndoableEdit(Element el, AttributeSet newAtts, boolean replacing)
          Creates a new AttributeUndoableEdit.
 
Method Summary
 void redo()
          Redos an attribute change.
 void undo()
          Undos the attribute change.
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
addEdit, canRedo, canUndo, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

copy

protected AttributeSet copy
A copy of the old attributes.


newAttributes

protected AttributeSet newAttributes
The new attributes.


isReplacing

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


element

protected Element element
The element that has changed.

Constructor Detail

DefaultStyledDocument.AttributeUndoableEdit

public DefaultStyledDocument.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

undo

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

Specified by:
undo in interface UndoableEdit
Overrides:
undo in class AbstractUndoableEdit
See Also:
AbstractUndoableEdit.canUndo(), AbstractUndoableEdit.redo()

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.

Specified by:
redo in interface UndoableEdit
Overrides:
redo in class AbstractUndoableEdit
See Also:
AbstractUndoableEdit.canRedo(), AbstractUndoableEdit.undo()