UndoManager$Typings extension

on

Properties

currentTransaction Transaction?
This read-only property returns the current Transaction for recording additional model change events. This is initialized and augmented by #handleChanged before it is added to #history by a top-level call to #commitTransaction. The value will be null between transactions.
getter/setter pair
history List<Transaction>
This read-only property returns the whole history, a list of all of the Transactions, each representing a transaction with some number of ChangedEvents.
getter/setter pair
historyIndex num
This read-only property returns the index into #history for the current undoable Transaction. The value is -1 if there is no undoable Transaction to be undone.
getter/setter pair
isEnabled bool
Gets or sets whether this UndoManager records any changes. The default value is false -- you need to set this to true if you want the user to be able to undo or redo.
getter/setter pair
isInTransaction bool
This read-only property is true after the first call to #startTransaction and before a corresponding call to #commitTransaction or #rollbackTransaction.
getter/setter pair
isUndoingRedoing bool
This read-only property is true during a call to #undo or #redo.
getter/setter pair
maxHistoryLength num
Gets or sets the maximum number of transactions that this undo manager will remember. When a transaction is committed and the number exceeds this value, the UndoManager will discard the oldest transaction(s) in order to meet this limit. The initial value is 999. Any new value must be an integer. A negative value is treated as if there were no limit. A zero value will not remember any Transactions in the #history, but will allow commits and rollbacks to occur normally, including raising "Transaction" type ChangedEvents.
getter/setter pair
models Iterator<Model>
This read-only property returns an iterator for all of the Models that this UndoManager is handling.
getter/setter pair
nestedTransactionNames List<String>
This read-only property returns a stack of ongoing transaction names. The outermost transaction name will be the first item in the list. The last one will be the name of the most recent (nested) call to #startTransaction.
getter/setter pair
transactionLevel num
This read-only property returns the current transaction level. The value is zero when there is no ongoing transaction. The initial value is zero. #startTransaction will increment this value; #commitTransaction or #rollbackTransaction will decrement it. When this value is greater than zero, #canUndo and #canRedo will be false, because additional logically related model change events may occur.
getter/setter pair
transactionToRedo Transaction?
This read-only property returns the Transaction in the #history to be redone next. The value may be null if the UndoManager is not ready to perform a redo.
getter/setter pair
transactionToUndo Transaction?
This read-only property returns the Transaction in the #history to be undone next. The value may be null if the UndoManager is not ready to perform an undo.
getter/setter pair

Methods

addModel(Model model) → void
Make sure this UndoManager knows about a Model for which it may receive ChangedEvents when the given Model is changed. The model will also receive notifications about transactions and undo or redo operations.
canRedo() bool
This predicate returns true if you can call #redo. This will return false if #isEnabled is false (as it is by default), if any transaction is ongoing, or if there is no #transactionToRedo that can be redone. @return {boolean} true if ready for #redo to be called.
canUndo() bool
This predicate returns true if you can call #undo. This will return false if #isEnabled is false (as it is by default), if any transaction is ongoing, or if there is no #transactionToUndo that can be undone. @return {boolean} true if ready for #undo to be called.
clear() → void
Clear all of the Transactions and clear all other state, including any ongoing transaction without rolling back. However, this maintains its references to its Models.
commitTransaction([String? tname]) bool
Commit the current transaction started by a call to #startTransaction.
copyProperties(UndoManager old) → void
(undocumented) Copy persistent properties from an old UndoManager to this new one. This is called by the Diagram#model property setter. @expose @param old
discardHistoryAfterIndex() → void
After an undo, call this to discard all of the transactions after this point in the history, as indicated by the #historyIndex. This method is called when a transaction occurs after some number of undo's without the same number of redo's, in order to remove all of the transactions that happened after the current history point, and then adding the new transaction.
handleChanged(ChangedEvent e) → void
Maybe record a ChangedEvent in the #currentTransaction. This calls #skipsEvent to see if this should ignore the change. If #skipsEvent returns false, this creates a copy of the ChangedEvent and adds it to the #currentTransaction. If there is no #currentTransaction, this first creates and remembers it.
redo() → void
After an #undo, re-perform the changes in #transactionToRedo. #canRedo must be true for this method to have any effect.
removeModel(Model model) → void
Inform this UndoManager that it will no longer be receiving ChangedEvents when the given Model is changed. The model will no longer receive notifications about transactions and undo or redo operations.
rollbackTransaction() bool
Rollback the current transaction started by a call to #startTransaction, undoing any changes.
skipsEvent(ChangedEvent e) bool
This predicate is called by #handleChanged to decide if a ChangedEvent is not interesting enough to be remembered.
startTransaction([String? tname]) bool
Begin a transaction, where the changes are held by a Transaction object as the value of #currentTransaction. You must call either #commitTransaction or #rollbackTransaction afterwards.
undo() → void
Reverse the effects of the #transactionToUndo. #canUndo must be true for this method to have any effect.