Package com.iizix.gyro
Interface ILockState
public interface ILockState
Interface used to handle locking and unlocking of the application session, with potential message and progress indicator.
In case this instance's method release()
This lock can be obtained from the IAppSessionGyro as well as the IClientSessionGyro. If obtained from a client session, a dispose listener is used to unlock the application session in case the client session is disposed of and the lock never released.
This class implementor of this interface is written in such a way that the lock state will be released upon garbage collection if you have forgotten to release it.
- Author:
- Christopher Mindus
- Method SummaryModifier and TypeMethodDescriptionCreates a new lock state instance from this one, incrementing the lock, i.e.Gets the application session gyro.Gets the client session gyro.- booleanChecks if this lock state is released or not.- boolean- release()Releases the lock state.- boolean- setMessage- (KString msg) Sets the message to display for the lock state, above the indicator.- boolean- setMessage- (KString msg, int progress) Sets the message to display for the lock state, above the indicator, along with a progress value.- boolean- setMessage- (KString msg, int delay, int progress) Sets the message to display for the lock state, above the indicator, along with a progress value.- default boolean- setMessage- (String msg) Sets the message to display for the lock state, above the indicator.- default boolean- setMessage- (String msg, int progress) Sets the message to display for the lock state, above the indicator, along with a progress value.- default boolean- setMessage- (String msg, int delay, int progress) Sets the message to display for the lock state, above the indicator, along with a progress value.- boolean- setProgress- (int progress) Sets the current progress bar value.
- Method Details- createNewLockILockState createNewLock()Creates a new lock state instance from this one, incrementing the lock, i.e. the caller must issue- release()on the new instance also in order to release the lock.- Returns:
- The new lock state, null if this lock state is already released, or the app or client session is disposed of.
 
- getAppSessionGyroIAppSessionGyro getAppSessionGyro()Gets the application session gyro.- Returns:
- The gyro instance.
 
- getClientSessionGyroIClientSessionGyro getClientSessionGyro()Gets the client session gyro.- Returns:
- The client gyro instance, or null if not retrieved from a client session but from an application session gyro.
 
- setMessageSets the message to display for the lock state, above the indicator.- Parameters:
- msg- The message to display, or null to remove it.
- Returns:
- true for changed, or false if busy state is not present or no change of message.
 
- setMessageSets the message to display for the lock state, above the indicator, along with a progress value.- Parameters:
- msg- The message to display, or null to remove it.
- progress- The progress value between 0 and 100, or -1 to remove it.
- Returns:
- true for changed, or false if busy state is not present or no change of values.
- Throws:
- IllegalArgumentException- If the progress value is not -1 or 0 to 100.
 
- setMessageSets the message to display for the lock state, above the indicator, along with a progress value.- Parameters:
- msg- The message to display, or null to remove it.
- delay- Delay of lock spinner: -2 for default (1.5 second), -1 disabled, 0=no delay, >0 wait time in milliseconds (1-20000, i.e. 20 seconds).
- progress- The progress value between 0 and 100, or -1 to remove it.
- Returns:
- true for changed, or false if busy state is not present or no change of values.
- Throws:
- IllegalArgumentException- If progress value is not -1 or 0 to 100, or delay is smaller than -2 or larger than 20_000.
 
- setMessageSets the message to display for the lock state, above the indicator.- Parameters:
- msg- The message to display, or null to remove it.
- Returns:
- true for changed, or false if busy state is not present or no change of message.
 
- setMessageSets the message to display for the lock state, above the indicator, along with a progress value.- Parameters:
- msg- The message to display, or null to remove it.
- progress- The progress value between 0 and 100, or -1 to remove it.
- Returns:
- true for changed, or false if busy state is not present or no change of values.
- Throws:
- IllegalArgumentException- If the progress value is not -1 or 0 to 100.
 
- setMessageSets the message to display for the lock state, above the indicator, along with a progress value.- Parameters:
- msg- The message to display, or null to remove it.
- delay- Delay of lock spinner: -2 for default (1.5 second), -1 disabled, 0=no delay, >0 wait time in milliseconds (1-20000, i.e. 20 seconds).
- progress- The progress value between 0 and 100, or -1 to remove it.
- Returns:
- true for changed, or false if busy state is not present or no change of values.
- Throws:
- IllegalArgumentException- If progress value is not -1 or 0 to 100, or delay is smaller than -2 or larger than 20_000.
 
- setProgressboolean setProgress- (int progress) Sets the current progress bar value.- Parameters:
- progress- The progress value between 0 and 100, or -1 to remove it.
- Returns:
- true for changes, false for no change or no lock state.
- Throws:
- IllegalArgumentException- If the progress value is not -1 or 0 to 100.
 
- isReleasedboolean isReleased()Checks if this lock state is released or not.
- releaseboolean release()Releases the lock state.- Returns:
- true for success, false if already released.