Package com.iizix.gyro
Class GyroTransaction
java.lang.Object
com.iizix.gyro.GyroTransaction
The gyro transaction class is used to record all changes in a property container for commit/rollback operations.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorDescriptionGyroTransaction
(PropCnr transactionContainer, IFocusEngine focusEngine) Creates the gyro transaction for a property container.Method Summary
Modifier and TypeMethodDescriptionvoid
begin()
Begins the transaction.void
commit()
Commits the work done in the property container.void
dispose()
Disposes of the instance.protected void
finalize()
Make sure we're always disposed of if garbage collected.Returns the focus engine associated with this Gyro transaction.Returns the focus that is to be set due to the rollback.Returns the transaction property container for the GyroTransaction.rollback()
Rolls back the work done in the transaction and returns the component who's focus must be restored to.
Constructor Details
GyroTransaction
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
Returns the transaction property container for the GyroTransaction.- Returns:
- The property container.
getFocusEngine
Returns the focus engine associated with this Gyro transaction.- Returns:
- The focus engine, or null for none.
getRollbackFocus
Returns the focus that is to be set due to the rollback.- Returns:
- The focus component, null for none.
finalize
Make sure we're always disposed of if garbage collected.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
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.