ca.odell.glazedlists.swing

Class UndoSupport<E>


public final class UndoSupport<E>
extends java.lang.Object

This class adapts the generic UndoRedoSupport provided by Glazed Lists for specific use with Swing's native UndoManager. Each UndoRedoSupport.Edit produced by Glazed List's UndoRedoSupport is adapted to Swing's UndoableEdit interface and then added into the given UndoManager.

Fine grain control of the UndoableEdit that is ultimately added to the UndoableEdit can be achieved by using this install method and specifying a custom Function.

Author:
James Lemieux

Method Summary

static
UndoSupport install(UndoManager undoManager, EventList source)
Installs support for undoing/redoing edits on the given source.
static
UndoSupport install(UndoManager undoManager, EventList source, ca.odell.glazedlists.FunctionList.Function editAdapter)
Installs support for undoing/redoing edits on the given source.
void
uninstall()
This method removes undo/redo support from the EventList it was installed on.

Method Details

UndoSupport install

public static  UndoSupport install(UndoManager undoManager,
                                      EventList source)
Installs support for undoing/redoing edits on the given source. Specifically, UndoableEdits are added to the undoManager each time the source changes. Undoing and redoing these edits will unapply/reapply the corresponding changes to the source.

This method uses a default strategy for mapping the GL-style edits to UndoableEdits.

Parameters:
undoManager - the manager of all undoable edits for the entire Swing application
source - the EventList to watch for undoable edits
Returns:
an instance of the support class providing undo/redo edit features

UndoSupport install

public static  UndoSupport install(UndoManager undoManager,
                                      EventList source,
                                      ca.odell.glazedlists.FunctionList.Function editAdapter)
Installs support for undoing/redoing edits on the given source. Specifically, UndoableEdits are added to the undoManager each time the source changes. Undoing and redoing these edits will unapply/reapply the corresponding changes to the source.

This method uses the given editAdapter for mapping the GL-style edits to UndoableEdits.

Parameters:
undoManager - the manager of all undoable edits for the entire Swing application
source - the EventList to watch for undoable edits
editAdapter - the function that converts GL-style edits into Swing-style edits
Returns:
an instance of the support class providing undo/redo edit features

uninstall

public void uninstall()
This method removes undo/redo support from the EventList it was installed on. This method is useful when the EventList must outlive the undo/redo support itself. Calling this method will make this support object available for garbage collection independently of the EventList of items.

Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by pbuilder at 2009-07-14 22:05