APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.undo

public Class UndoableEditSupport

extends Object
Class Inheritance
Imports
javax.swing.event.*, java.util.*

A support class used for managing UndoableEdit listeners.
Author
Ray Ryan

Field Summary

Modifier and TypeField and Description
protected CompoundEdit
compoundEdit

The compound edit.

protected Vector<UndoableEditListener>
listeners

The list of listeners.

protected Object
realSource

The real source.

protected int
updateLevel

The update level.

Constructor Summary

AccessConstructor and Description
public
UndoableEditSupport()

Constructs an UndoableEditSupport object.

public
UndoableEditSupport(Object
an Object
r
)

Constructs an UndoableEditSupport object.

Method Summary

Modifier and TypeMethod and Description
protected void
_postEdit(UndoableEdit
edit to be verified
e
)

Called only from postEdit and endUpdate.

public synchronized void
addUndoableEditListener(UndoableEditListener
an UndoableEditListener object
l
)

Registers an UndoableEditListener.

public synchronized void
beginUpdate()

Starts a compound edit update.

protected CompoundEdit

Returns:

new created CompoundEdit object
createCompoundEdit
()

Called only from beginUpdate.

public synchronized void
endUpdate()

DEADLOCK WARNING: Calling this method may call undoableEditHappened in all listeners.

public synchronized UndoableEditListener[]

Returns:

all of the UndoableEditListeners added or an empty array if no listeners have been added
getUndoableEditListeners
()

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

public int

Returns:

an integer representing the update level
getUpdateLevel
()

Returns the update level value.

public synchronized void
postEdit(UndoableEdit
edit to be posted
e
)

DEADLOCK WARNING: Calling this method may call undoableEditHappened in all listeners.

public synchronized void
removeUndoableEditListener(UndoableEditListener
the UndoableEditListener object to be removed
l
)

Removes an UndoableEditListener.

public String

Returns:

a String representation of this object
toString
()

Overrides java.lang.Object.toString.

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

compoundEditback to summary
protected CompoundEdit compoundEdit

The compound edit.

listenersback to summary
protected Vector<UndoableEditListener> listeners

The list of listeners.

realSourceback to summary
protected Object realSource

The real source.

updateLevelback to summary
protected int updateLevel

The update level.

Constructor Detail

UndoableEditSupportback to summary
public UndoableEditSupport()

Constructs an UndoableEditSupport object.

UndoableEditSupportback to summary
public UndoableEditSupport(Object r)

Constructs an UndoableEditSupport object.

Parameters
r:Object

an Object

Method Detail

_postEditback to summary
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.

Parameters
e:UndoableEdit

edit to be verified

addUndoableEditListenerback to summary
public synchronized void addUndoableEditListener(UndoableEditListener l)

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

Parameters
l:UndoableEditListener

an UndoableEditListener object

See Also
removeUndoableEditListener
beginUpdateback to summary
public synchronized void beginUpdate()

Starts a compound edit update.

createCompoundEditback to summary
protected CompoundEdit createCompoundEdit()

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

Returns:CompoundEdit

new created CompoundEdit object

endUpdateback to summary
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.

getUndoableEditListenersback to summary
public synchronized UndoableEditListener[] getUndoableEditListeners()

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

Returns:UndoableEditListener[]

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

Since
1.4
getUpdateLevelback to summary
public int getUpdateLevel()

Returns the update level value.

Returns:int

an integer representing the update level

postEditback to summary
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.

Parameters
e:UndoableEdit

edit to be posted

removeUndoableEditListenerback to summary
public synchronized void removeUndoableEditListener(UndoableEditListener l)

Removes an UndoableEditListener.

Parameters
l:UndoableEditListener

the UndoableEditListener object to be removed

See Also
addUndoableEditListener
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

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

Returns:String

a String representation of this object