Class GyroTransaction

java.lang.Object
com.iizix.gyro.GyroTransaction

public class GyroTransaction extends Object
The gyro transaction class is used to record all changes in a property container for commit/rollback operations.
Author:
Christopher Mindus
  • Constructor Details

    • GyroTransaction

      public GyroTransaction(PropCnr transactionContainer, IFocusEngine focusEngine)
      Creates the gyro transaction for a property container.
      Parameters:
      transactionContainer - The property container of the transaction, typically a VirtualSpace.
      focusEngine - The focus engine to use, VirtualSpace or Panel, null for none.
  • Method Details

    • getTransactionContainer

      public PropCnr getTransactionContainer()
      Returns the transaction property container for the GyroTransaction.
      Returns:
      The property container.
    • getFocusEngine

      public IFocusEngine getFocusEngine()
      Returns the focus engine associated with this Gyro transaction.
      Returns:
      The focus engine, or null for none.
    • getRollbackFocus

      public IFocusComp getRollbackFocus()
      Returns the focus that is to be set due to the rollback.
      Returns:
      The focus component, null for none.
    • finalize

      protected void finalize() throws Throwable
      Make sure we're always disposed of if garbage collected.
      Overrides:
      finalize in class Object
      Throws:
      Throwable - In case finalize doesn't perform too well.
    • dispose

      public void dispose()
      Disposes of the instance. This method should be called when the transaction is canceled.

      Note: Calling this method will cancel commit and rollback possibilities!

    • begin

      public void begin()
      Begins the transaction.
      Throws:
      IllegalStateException - If the state of the transaction is not "ready", i.e. the transaction has begun, been committed or rolled back. The exception is also thrown if the property container has been disposed of.
    • commit

      public void commit()
      Commits the work done in the property container.
      Throws:
      IllegalStateException - If the transaction state is not in "begin" state.
    • rollback

      public IFocusComp rollback() throws PropException
      Rolls back the work done in the transaction and returns the component who's focus must be restored to.
      Returns:
      The component who had its focus changed first during the transaction and needs to receive focus (perhaps when e.g. the session busy state is released), or null if no focus change occurred.
      Throws:
      IllegalStateException - If the transaction state is not in "begin" state.
      PropException - If the rollback operation failed.