You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Date last modified: Tue Jun 01 16:03:33 PST 1999


Transaction Listener Interface Class:

class nsITransactionListener : public nsISupports {
public:

  virtual nsresult WillDo(nsITransactionManager *aManager, nsITransaction *aTransaction) = 0;
  virtual nsresult DidDo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aDoResult) = 0;
  virtual nsresult WillUndo(nsITransactionManager *aManager, nsITransaction *aTransaction) = 0;
  virtual nsresult DidUndo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aUndoResult) = 0;
  virtual nsresult WillRedo(nsITransactionManager *aManager, nsITransaction *aTransaction) = 0;
  virtual nsresult DidRedo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aRedoResult) = 0;
  virtual nsresult WillBeginBatch(nsITransactionManager *aManager) = 0; 
  virtual nsresult DidBeginBatch(nsITransactionManager *aManager, nsresult aResult) = 0; 
  virtual nsresult WillEndBatch(nsITransactionManager *aManager) = 0;
  virtual nsresult DidEndBatch(nsITransactionManager *aManager, nsresult aResult) = 0;
  virtual nsresult WillMerge(nsITransactionManager *aManager, nsITransaction *aTopTransaction, nsITransaction *aTransactionToMerge) = 0;
  virtual nsresult DidMerge(nsITransactionManager *aManager, nsITransaction *aTopTransaction, nsITransaction *aTransactionToMerge, PRBool aDidMerge, nsresult aMergeResult) = 0;
};


Transaction Listener Interface Methods:

nsresult WillDo(nsITransactionManager *aManager, nsITransaction *aTransaction)

Called before a transaction manager calls a transaction's Do() method.

Parameters

aManager - The transaction manager doing the transaction.

aTransaction - The transaction being done.

Return Values

NS_OK should be used to indicate no error, proceed with normal control flow. NS_COMFALSE can be returned by the listener to indicate no error, interrupt normal control flow.

nsresult DidDo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aDoResult)

Called after a transaction manager calls the Do() method of a transaction.

Parameters

aManager the - Transaction manager that did the transaction.

aTransaction - The transaction that was done.

aDoResult - The nsresult returned after doing the transaction.

Return Values

Error status returned by the listener.

nsresult WillUndo(nsITransactionManager *aManager, nsITransaction *aTransaction)

Called before a transaction manager calls the Undo() method of a transaction.

Parameters

aManager - The transaction manager undoing the transaction.

aTransaction - The transaction being undone.

Return Values

Error status returned by the listener. NS_OK should be used to indicate no error, proceed with normal control flow. NS_COMFALSE can be returned by the listener to indicate no error, interrupt normal control flow.

nsresult DidUndo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aUndoResult)

Called after a transaction manager calls the Undo() method of a transaction.

Parameters

aManager - The transaction manager undoing the transaction.

aTransaction - The transaction being undone.

aUndoResult - The nsresult returned after undoing the transaction.

Return Values

Error status returned by the listener.

nsresult WillRedo(nsITransactionManager *aManager, nsITransaction *aTransaction)

Called before a transaction manager calls the Redo() method of a transaction.

Parameters

aManager the transaction manager redoing the transaction.

@param aTransaction the transaction being redone.

Return Values

Error status returned by the listener. NS_OK should be used to indicate no error, proceed with normal control flow. NS_COMFALSE can be returned by the listener to indicate no error, interrupt normal control flow.

nsresult DidRedo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aRedoResult)

Called after a transaction manager calls the Redo() method of a transaction.

Parameters

aManager - The transaction manager redoing the transaction.

aTransaction - The transaction being redone.

aRedoResult - The nsresult returned after redoing the transaction.

Return Values

Error status returned by the listener.

nsresult WillBeginBatch(nsITransactionManager *aManager)

Called before a transaction manager begins a batch.

Parameters

aManager - The transaction manager beginning a batch.

Return Values Error status returned by the listener. NS_OK should be used to indicate no error, proceed with normal control flow. NS_COMFALSE can be returned by the listener to indicate no error, interrupt normal control flow.

nsresult DidBeginBatch(nsITransactionManager *aManager, nsresult aResult)

Called after a transaction manager begins a batch.

Parameters

aManager - The transaction manager that began a batch.

aResult - The nsresult returned after beginning a batch.

Return Values

Error status returned by the listener.

nsresult WillEndBatch(nsITransactionManager *aManager)

Called before a transaction manager ends a batch.

Parameters

aManager - The transaction manager ending a batch.

Return Values

Error status returned by the listener. NS_OK should be used to indicate no error, proceed with normal control flow. NS_COMFALSE can be returned by the listener to indicate no error, interrupt normal control flow.

nsresult DidEndBatch(nsITransactionManager *aManager, nsresult aResult)

Called after a transaction manager ends a batch.

Parameters

aManager - The transaction manager ending a batch.

aResult - The nsresult returned after ending a batch.

Return Values

Error status returned by the listener.

nsresult WillMerge(nsITransactionManager *aManager, nsITransaction *aTopTransaction, nsITransaction *aTransactionToMerge)

Called before a transaction manager tries to merge a transaction, that was just executed, with the transaction at the top of the undo stack.

Parameters

aManager - The transaction manager ending a batch.

aTopTransaction - The transaction at the top of the undo stack.

aTransactionToMerge - The transaction to merge.

Return Values

Error status returned by the listener. NS_OK should be used to indicate no error, proceed with normal control flow. NS_COMFALSE can be returned by the listener to indicate no error, interrupt normal control flow.

nsresult DidMerge(nsITransactionManager *aManager, nsITransaction *aTopTransaction, nsITransaction *aTransactionToMerge, PRBool aDidMerge, nsresult aMergeResult)

Called after a transaction manager tries to merge a transaction, that was just executed, with the transaction at the top of the undo stack.

Parameters

aManager - The transaction manager ending a batch.

aTopTransaction - The transaction at the top of the undo stack.

aTransactionToMerge - The transaction to merge.

aDidMerge - True if transaction was merged, else false.

aMergeResult - The nsresult returned after the merge attempt.

Return Values

Error status returned by the listener. NS_OK should be used to indicate no error, proceed with normal control flow. NS_COMFALSE can be returned by the listener to indicate no error, interrupt normal control flow.