Action
    Preparing search index...

    Declares methods for executing transactions on the document.

    2.0

    interface ITransactions {
        Cast<T1, T2>(this: T2, type: TypeRef<T1>): T1;
        ExecuteInvisibleTransaction(action: Action): void;
        ExecuteStickyTransaction(guid: Guid, action: Action): void;
        ExecuteTransaction(action: Action): void;
        TryCast<T1, T2>(this: T2, type: TypeRef<T1>): null | T1;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Casts this object to the specified type. Throws error on failure.

      Type Parameters

      • T1

        The target type of the cast.

      • T2

        The type of the object to cast.

      Parameters

      Returns T1

    • Casts this object to the specified type. Returns null on failure.

      Type Parameters

      • T1

        The target type of the cast.

      • T2

        The type of the object to cast.

      Parameters

      Returns null | T1

    Default capability

    • Starts an invisible transaction on the document model by executing action.

      Parameters

      • action: Action

        The delegate to execute.

      Returns void

      This method starts an invisible transaction on the document model by executing action. If there is already an ongoing transaction then the transaction is included in the current transaction.

      All modifications of the document that are performed as a result of the operations performed by action will be recorded in the transaction so that the transaction can be unexecuted if the user requests an undo.

      The transaction is invisible in the sense that the user will not see the transaction as an entry on the undo stack. If the user makes an undo then the transaction will be silently unexecuted together with the enclosing visible transaction.

      This API expects that the script is declared with 'wrapInTransaction' set to 'false' to work as documented.

      2.0

    • Starts a sticky transaction on the document model by executing action.

      Parameters

      • guid: Guid

        The id which identifies the transactions which should stick together.

      • action: Action

        The delegate to execute.

      Returns void

      This method starts a sticky transaction on the document model by executing action. If there is already an ongoing transaction then the transaction is included in the current transaction.

      All modifications of the document that are performed as a result of the operations performed by action will be recorded in the transaction so that the transaction can be unexecuted if the user requests an undo.

      Sticky transactions should be used to implement undo of for example sliders. When you move a slider such as the range slider in the filter panel it makes a modification of the document and this modification should immediately be reflected in the user interface. However there should only be one entry on the undo stack so that the entire drag of the slider can be undone by pressing undo once.

      To implement this behaviour the slider should generate a System.Guid and use it as a parameter to one sticky transactions for each modification.

      The transactions are sticky in the sense that consecutive sticky transactions with the same System.Guid will yield a common entry on the undo stack. If any other transaction is executed it will create an independent entry which will break up the sequence of sticky transactions.

      A sequence of sticky transactions is similar to an aggregated transaction in the sense that both will yield only one entry on the undo stack. However it is more robust to use sticky transactions if it is difficult to decide when an aggregated transaction should be committed.

      This API expects that the script is declared with 'wrapInTransaction' set to 'false' to work as documented.

      2.0

    • Starts a transaction on the document model by executing action.

      Parameters

      • action: Action

        The delegate to execute.

      Returns void

      This method starts a transaction on the document model by executing action. If there is already an ongoing transaction then the transaction is included in the current transaction.

      All modifications of the document that are performed as a result of the operations performed by action will be recorded in the transaction so that the transaction can be unexecuted if the user requests an undo.

      This API expects that the script is declared with 'wrapInTransaction' set to 'false' to work as documented.

      2.0