lapisx.swing
Class CoalescingUndo

java.lang.Object
  extended bylapisx.swing.CoalescingUndo

public abstract class CoalescingUndo
extends Object

This class coalesces multiple typed keystrokes into a single undoable event. To use it, just replace your undo event listener attachment call document.addUndoableEditListener (undoManager) with a call to CoalescingUndo.addUndoableEditListener (document, undoManager).


Nested Class Summary
protected static class CoalescingUndo.KeyTypedAction
           
protected static class CoalescingUndo.KeyTypedEdit
           
 
Field Summary
protected static boolean installed
           
protected static String UNDO_LISTENER
           
 
Constructor Summary
CoalescingUndo()
           
 
Method Summary
static UndoableEditListener getUndoableEditListener(Document doc)
           
protected static void install()
           
static void setUndoableEditListener(Document doc, UndoableEditListener undo)
          Attaches an undo listener to a document in such a way that multiple typed keystrokes are coalesced into a single undoable edit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

installed

protected static boolean installed

UNDO_LISTENER

protected static final String UNDO_LISTENER
See Also:
Constant Field Values
Constructor Detail

CoalescingUndo

public CoalescingUndo()
Method Detail

setUndoableEditListener

public static void setUndoableEditListener(Document doc,
                                           UndoableEditListener undo)
Attaches an undo listener to a document in such a way that multiple typed keystrokes are coalesced into a single undoable edit. Only one undo listener may be attached to a document with this call.

Parameters:
doc - Document generating the edit events
undo - Listener receiving the edit events, usually an instance of UndoManager

getUndoableEditListener

public static UndoableEditListener getUndoableEditListener(Document doc)

install

protected static void install()