nsITransactionManager

IID:58e330c2-7b48-11d2-98b9-00805f297d89
Inherits From:nsISupports

This interface is intended to be used as a service. To create an object implementing this interface:

var obj = Components.classes["@mozilla.org/transactionmanager;1"].
            getService(Components.interfaces.nsITransactionManager);

This interface is implemented by the following components:


Properties

PRInt32 maxTransactionCount

Sets the maximum number of transaction items the transaction manager will maintain at any time. This is commonly referred to as the number of levels of undo.

readonly PRInt32 numberOfRedoItems

The number of items on the redo stack.

readonly PRInt32 numberOfUndoItems

The number of items on the undo stack.


Methods

void AddListener ( nsITransactionListener listener ) void beginBatch ( ) void clear ( ) void doTransaction ( nsITransaction transaction ) void endBatch ( ) nsITransactionList getRedoList ( ) nsITransactionList getUndoList ( ) nsITransaction peekRedoStack ( ) nsITransaction peekUndoStack ( ) void redoTransaction ( ) void RemoveListener ( nsITransactionListener listener ) void undoTransaction ( )

void AddListener ( nsITransactionListener listener )

Adds a listener to the transaction manager's notification list. Listeners are notified whenever a transaction is done, undone, or redone.

The listener's AddRef() method is called.

Arguments:
listener: the lister to add.

void beginBatch ( )

Turns on the transaction manager's batch mode, forcing all transactions executed by the transaction manager's doTransaction() method to be aggregated together until EndBatch() is called. This mode allows an application to execute and group together several independent transactions so they can be undone with a single call to undoTransaction().


void clear ( )

Clears the undo and redo stacks.


void doTransaction ( nsITransaction transaction )

Calls a transaction's doTransaction() method, then pushes it on the undo stack.

This method calls the transaction's AddRef() method. The transaction's Release() method will be called when the undo or redo stack is pruned or when the transaction manager is destroyed.

Arguments:
transaction: the transaction to do.

void endBatch ( )

Turns off the transaction manager's batch mode.


nsITransactionList getRedoList ( )

Returns the list of transactions on the redo stack. Note that the transaction at the top of the redo stack will actually be at the index 'n-1' in the list, where 'n' is the number of items in the list.


nsITransactionList getUndoList ( )

Returns the list of transactions on the undo stack. Note that the transaction at the top of the undo stack will actually be at the index 'n-1' in the list, where 'n' is the number of items in the list.


nsITransaction peekRedoStack ( )

Returns an AddRef'd pointer to the transaction at the top of the redo stack. Callers should be aware that this method could return return a null in some implementations if there is a batch at the top of the redo stack.


nsITransaction peekUndoStack ( )

Returns an AddRef'd pointer to the transaction at the top of the undo stack. Callers should be aware that this method could return return a null in some implementations if there is a batch at the top of the undo stack.


void redoTransaction ( )

Pops the topmost transaction on the redo stack, calls it's redoTransaction() method, then pushes it on the undo stack.


void RemoveListener ( nsITransactionListener listener )

Removes a listener from the transaction manager's notification list.

The listener's Release() method is called.

Arguments:
listener: the lister to remove.

void undoTransaction ( )

Pops the topmost transaction on the undo stack, calls it's undoTransaction() method, then pushes it on the redo stack.


References

This interface is the type of the following properties:

nsIBookmarksService.transactionManager, nsIEditor.transactionManager, nsIMessenger.transactionManager, nsIMsgWindow.transactionManager

This interface is passed as an argument to the following methods:

nsITransactionListener.didBeginBatch, nsITransactionListener.didDo, nsITransactionListener.didEndBatch, nsITransactionListener.didMerge, nsITransactionListener.didRedo, nsITransactionListener.didUndo, nsITransactionListener.willBeginBatch, nsITransactionListener.willDo, nsITransactionListener.willEndBatch, nsITransactionListener.willMerge, nsITransactionListener.willRedo, nsITransactionListener.willUndo

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com