nsITransactionManager 编辑

editor/txmgr/idl/nsITransactionManager.idlScriptable This interface is implemented by an object that wants to manage/track transactions. Inherits from: nsISupports Last changed in Gecko 1.7

Method overview

void AddListener(in nsITransactionListener aListener);
void beginBatch();
void clear();
void doTransaction(in nsITransaction aTransaction);
void endBatch();
nsITransactionList getRedoList();
nsITransactionList getUndoList();
nsITransaction peekRedoStack();
nsITransaction peekUndoStack();
void redoTransaction();
void RemoveListener(in nsITransactionListener aListener);
void undoTransaction();

Attributes

AttributeTypeDescription
maxTransactionCountlong

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.

A value of -1 means no limit. A value of zero means the transaction manager will execute each transaction, then immediately release all references it has to the transaction without pushing it on the undo stack. A value greater than zero indicates the max number of transactions that can exist at any time on both the undo and redo stacks. This method will prune the necessary number of transactions on the undo and redo stacks if the value specified is less than the number of items that exist on both the undo and redo stacks.
numberOfRedoItemslongThe number of items on the redo stack. Read only.
numberOfUndoItemslongThe number of items on the undo stack. Read only.

Methods

AddListener()

Adds a listener to the transaction manager's notification list. Listeners are notified whenever a transaction is done, undone, or redone. The listener's nsITransactionListener.AddRef() method is called.

void AddListener(
  in nsITransactionListener aListener
);
Parameters
aListener
The nsITransactionListener to add.

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 beginBatch();
Parameters

None.

clear()

Clears the undo and redo stacks.

void clear();
Parameters

None.

doTransaction()

Calls a transaction's nsITransaction.doTransaction() method, then pushes it on the undo stack. This method calls the transaction's nsITransaction.AddRef() method. The transaction's nsITransaction.Release() method will be called when the undo or redo stack is pruned or when the transaction manager is destroyed.

void doTransaction(
  in nsITransaction aTransaction
);
Parameters
aTransaction
The nsITransaction to do.

endBatch()

Turns off the transaction manager's batch mode.

void endBatch();
Parameters

None.

getRedoList()

Returns the list of nsITransaction 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 getRedoList();
Parameters

None.

Return value

A list of nsITransaction on the redo stack.

getUndoList()

Returns the list of nsITransaction 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.

nsITransactionList getUndoList();
Parameters

None.

Return value

A list of nsITransaction on the undo stack.

peekRedoStack()

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

nsITransaction peekRedoStack();
Parameters

None.

Return value

An AddRef'd pointer to the nsITransaction at the top of the redo stack.

peekUndoStack()

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

nsITransaction peekUndoStack();
Parameters

None.

Return value

An AddRef'd pointer to the nsITransaction at the top of the undo stack.

redoTransaction()

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

void redoTransaction();
Parameters

None.

RemoveListener()

Removes a listener from the transaction manager's notification list. The listener's nsITransactionListener.Release() method is called.

void RemoveListener(
  in nsITransactionListener aListener
);
Parameters
aListener
The nsITransactionListener to remove.

undoTransaction()

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

void undoTransaction();
Parameters

None.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:120 次

字数:12006

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文