public class

UndoableEditSupport

extends Object
java.lang.Object
   ↳ javax.swing.undo.UndoableEditSupport

Class Overview

A support class used for managing UndoableEdit listeners.

Summary

Fields
protected CompoundEdit compoundEdit
protected Vector<UndoableEditListener> listeners
protected Object realSource
protected int updateLevel
Public Constructors
UndoableEditSupport()
Constructs an UndoableEditSupport object.
UndoableEditSupport(Object r)
Constructs an UndoableEditSupport object.
Public Methods
synchronized void addUndoableEditListener(UndoableEditListener l)
Registers an UndoableEditListener.
synchronized void beginUpdate()
synchronized void endUpdate()
DEADLOCK WARNING: Calling this method may call undoableEditHappened in all listeners.
synchronized UndoableEditListener[] getUndoableEditListeners()
Returns an array of all the UndoableEditListeners added to this UndoableEditSupport with addUndoableEditListener().
int getUpdateLevel()
Returns the update level value.
synchronized void postEdit(UndoableEdit e)
DEADLOCK WARNING: Calling this method may call undoableEditHappened in all listeners.
synchronized void removeUndoableEditListener(UndoableEditListener l)
Removes an UndoableEditListener.
String toString()
Returns a string that displays and identifies this object's properties.
Protected Methods
void _postEdit(UndoableEdit e)
Called only from postEdit and endUpdate.
CompoundEdit createCompoundEdit()
Called only from beginUpdate.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected CompoundEdit compoundEdit

protected Vector<UndoableEditListener> listeners

protected Object realSource

protected int updateLevel

Public Constructors

public UndoableEditSupport ()

Constructs an UndoableEditSupport object.

public UndoableEditSupport (Object r)

Constructs an UndoableEditSupport object.

Parameters
r an Object

Public Methods

public synchronized void addUndoableEditListener (UndoableEditListener l)

Registers an UndoableEditListener. The listener is notified whenever an edit occurs which can be undone.

Parameters
l an UndoableEditListener object

public synchronized void beginUpdate ()

public synchronized void endUpdate ()

DEADLOCK WARNING: Calling this method may call undoableEditHappened in all listeners. It is unwise to call this method from one of its listeners.

public synchronized UndoableEditListener[] getUndoableEditListeners ()

Returns an array of all the UndoableEditListeners added to this UndoableEditSupport with addUndoableEditListener().

Returns
  • all of the UndoableEditListeners added or an empty array if no listeners have been added

public int getUpdateLevel ()

Returns the update level value.

Returns
  • an integer representing the update level

public synchronized void postEdit (UndoableEdit e)

DEADLOCK WARNING: Calling this method may call undoableEditHappened in all listeners. It is unwise to call this method from one of its listeners.

public synchronized void removeUndoableEditListener (UndoableEditListener l)

Removes an UndoableEditListener.

Parameters
l the UndoableEditListener object to be removed

public String toString ()

Returns a string that displays and identifies this object's properties.

Returns
  • a String representation of this object

Protected Methods

protected void _postEdit (UndoableEdit e)

Called only from postEdit and endUpdate. Calls undoableEditHappened in all listeners. No synchronization is performed here, since the two calling methods are synchronized.

protected CompoundEdit createCompoundEdit ()

Called only from beginUpdate. Exposed here for subclasses' use.