Class AppSessionGyro
- All Implemented Interfaces:
IPrivateStorage
,IAppSessionGyro
,IFocusEngineProvider
,IMessageBox
,IRuntimeImageCache
,IToaster
,IRuntimeReferenceLookup
,IVirtualizedReferenceLookup
,IGyroFocusEngineOwner
,ILocaleString
- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from interface com.iizix.gyro.IMessageBox
IMessageBox.Icon
Nested classes/interfaces inherited from interface com.iizix.gyro.IToaster
IToaster.Direction, IToaster.Position, IToaster.Type
Field Summary
Fields inherited from interface com.iizix.gyro.IAppSessionGyro
STORAGE_NAME
Fields inherited from interface com.iizix.gyro.IMessageBox
ICON_ERROR, ICON_INFORMATION, ICON_MAP, ICON_NONE, ICON_QUESTION, ICON_WARNING
Fields inherited from interface com.iizix.gyro.IToaster
TOASTER_DEFAULT_DURATION, TOASTER_MAX_DURATION, TOASTER_MIN_DURATION
Constructor Summary
ConstructorDescriptionAppSessionGyro
(ServerShell server, SessionInfo appSessionInfo, UserSessions userSessions, ClientParams clientParams, AuthenticatedUser authUser) Constructs the instance of the application for the first user session.Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a client connection listener for the application session.boolean
addDisposeListener
(IAppSessionDisposeListener listener) Adds a dispose listener for the application session.Changes the authenticated user due an external authentication mechanism such as LinkedIn.void
Clears the entire cache.void
Closes the remote windows for authentication.createClientSessionGyro
(ClientEndPoint clientEndPoint, Worker worker, EnvProps envProps) Called to create the ClientSessionGyro for the first client session or for parallel client sessions.int
Decreases the incremental lock state.boolean
dispose()
Disposes of the Application session gyro, and effectively closes all the client sessions and end point connections.Gets the application factory.Returns the application session history used for backward and forward navigation.getAppID()
Gets the application ID.Retrieves the KStringInfoProvider for the application session.Gets the application timer engine.Gets the application root for static references look-up.Get the web server file provider for the application session.Gets the application session info.Gets the AppSessionGyro's Thread Group.Gets the Worker for the Application.Gets the authenticated user information.Gets the user ID for background location service identification.Gets the active client session Gyro's for this application session Gyro.int
Gets the count of client sessions.long
Gets the creation time in milliseconds.Returns the current focus in the VirtualSpace.getCustomAppValue
(String key) Gets a value for a key in the custom app properties.Gets the original environment properties for Selector's or Value's.getFocusEngine
(IFocusComp comp) Returns the focus engine instance for the specified component.Gets an image definition from the image container for the client session.Retrieves the KStringInfoProvider for the application session.Gets the language code of the application session.Gets the local info class instance.getLocaleKString
(String id, boolean system) Gets the KString of a particular ID from the app's text tables that are flagged to also handle LocaleString's depending on the flag.Returns the location service for the application session.int
Returns the incremental lock count that governs the UI locking state.Gets the locale'd texts instance for the sessions language and text tables.Gets the concurrent hash map used to store the private data.getRootFromName
(GProp<?> requestor, String module) Gets the module root for a name.GProp
<?> getRuntimePropFromReference
(String reference) Gets a reference for runtime use to get the reference of an item.GProp
<?> getRuntimePropFromReference
(String reference, boolean fallBackToNonVirtualized) Gets a reference for runtime use to get the reference of an item.Gets the server of this session.Gets the selected Server configuration environment for the Application Session.static AppSessionGyro
Gets the AppSessionGyro instance for the current thread in an application session.static AppSessionGyro
getSessionInstance
(SessionInfo sessionInfo) Gets the AppSessionGyro instance for the current thread in a client session.Gets the SessionUserIdentifier.Gets the transaction coordinator of the session.Gets the user authentication UI interface used for the initial login.GProp
<?> getVirtualizedPropFromReference
(String reference) Attempts to look up a virtualized property from a reference to the VirtualSpace only.getVirtualizedVirtualSpace
(VirtualSpace virtualSpace, boolean doVirtualize) Gets the virtualized counterpart of a VirtualSpace.getVirtualizedVSComponent
(IVSComponent component) Gets the virtualized VSComponent counterpart from a non-virtualized VSComponent.<VSC extends VSComponent>
VSCgetVirtualizedVSComponent
(VSC component) Gets the virtualized VSComponent counterpart from a non-virtualized VSComponent.<T extends PropCnr>
VirtualsContainer<T> getVirtuals
(IPluginDescriptor<T> serverPluginDescriptor) Gets the instance of the VirtualsContainer for the plug-in.The VirtualsContainer instance for VirtualSpace.int
Increases the incremental lock state.boolean
initialize
(EnvProps envProps, ClientSessionGyro clientGyro) Initiates the application for the client session.boolean
Checks if the application session Gyro is disposed of.boolean
Get the current UI lock state.boolean
isVirtualized
(VirtualSpace virtualSpace) Returns if a VirtualSpace already is virtualized for the application.boolean
Locks the UI with a message and a delay.boolean
lockUI
(KString waitMsg, ProgressIndicatorDelay delay) Locks the UI with a message and a delay.void
messageBox
(IMessageBoxReply reply, IMessageBox.Icon icon, KString title, KString message, KString... buttons) Displays a message box with the specified title and message.void
onFocusChanged
(IFocusComp newComp, IFocusComp oldComp, IGProp<?> trigger, boolean isRemoteInduced, boolean isInternal) Called when focus changes.void
onFocusVetoChange
(FocusEvent event) Called to perform veto.boolean
Removes a client connection listener for the application session.boolean
Removes a dispose listener for the application session.boolean
removeImage
(String name) Removes an image with a name from the client session.requestOAuthCallbackDisplay
(IOAuthService service) Requests the OAuth (1.0a or 2.0) authentication callback provider to show an URL to the user in order to be accepted.Requests a UI lock state.boolean
setImage
(RuntimeImageDefinition image) Adds the image definition to the image container for the client session.setLocale
(LocaleInfo locale) Changes or sets the LocaleInfo for the environment.boolean
setLockMessage
(KString msg) Sets the message to display for the lock state, above the indicator.boolean
setLockMessage
(KString msg, int progress) Sets the message to display for the lock state, above the indicator, along with a progress value.boolean
setLockMessage
(KString msg, int delay, int progress) Sets the message to display for the lock state, above the indicator, along with a progress value.boolean
setLockProgress
(int progress) Sets the current progress bar value.Sets the focus to the specified VS component, regardless if the VS component is virtualized or not.setVirtualizeSupportFocus
(IVSComponent vsComp, IGProp<?> trigger) Sets the focus to the specified VS component, regardless if the VS component is virtualized or not.void
toast
(KString message, IToaster.Position position, IToaster.Direction direction, IToaster.Type type, int duration) Displays a simple, unobstructive and ephemeral text message to the user.toString()
Formats the instance to a String.boolean
unlockUI()
Unlocks the UI.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.gyro.IAppSessionGyro
post
Methods inherited from interface com.iizix.text.ILocaleString
getLocaleKString
Methods inherited from interface com.iizix.gyro.IMessageBox
messageBox, messageBox, messageBox
Methods inherited from interface com.iizix.api.IPrivateStorage
getPrivateData, getPrivateData, setPrivateData
Constructor Details
AppSessionGyro
public AppSessionGyro(ServerShell server, SessionInfo appSessionInfo, UserSessions userSessions, ClientParams clientParams, AuthenticatedUser authUser) throws UserException Constructs the instance of the application for the first user session. Subsequent parallel user sessions do not construct this instance.- Parameters:
server
- The Server.appSessionInfo
- The application session information.userSessions
- The user sessions.clientParams
- The client parameters.authUser
- The authenticated user information.- Throws:
UserException
- If the user is not allowed access.
Method Details
getSessionInstance
Gets the AppSessionGyro instance for the current thread in an application session.- Returns:
- The AppSessionGyro instance when called from a thread of the client session,
null
otherwise.
getSessionInstance
Gets the AppSessionGyro instance for the current thread in a client session.- Parameters:
sessionInfo
- A session information instance, or null for none.- Returns:
- The AppSessionGyro instance when called from a thread of the application session,
null
otherwise.
addDisposeListener
Adds a dispose listener for the application session. Calling this method multiple times with the same listener will have no effect (but to return false).- Specified by:
addDisposeListener
in interfaceIAppSessionGyro
- Parameters:
listener
- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
NullPointerException
- If the listener isnull
.
removeDisposeListener
Removes a dispose listener for the application session.- Specified by:
removeDisposeListener
in interfaceIAppSessionGyro
- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
addClientConnectionListener
Adds a client connection listener for the application session. Calling this method multiple times with the same listener will have no effect (but to return false).- Specified by:
addClientConnectionListener
in interfaceIAppSessionGyro
- Parameters:
listener
- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
NullPointerException
- If the listener isnull
.
removeClientConnectionListener
Removes a client connection listener for the application session.- Specified by:
removeClientConnectionListener
in interfaceIAppSessionGyro
- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
dispose
public boolean dispose()Disposes of the Application session gyro, and effectively closes all the client sessions and end point connections.- Specified by:
dispose
in interfaceIAppSessionGyro
- Returns:
- true for dispose success, false if already disposed of.
isDisposed
public boolean isDisposed()Checks if the application session Gyro is disposed of.- Specified by:
isDisposed
in interfaceIAppSessionGyro
- Returns:
- true if the user's app-session is disposed of along with all client sessions, false otherwise.
getVirtuals
public <T extends PropCnr> VirtualsContainer<T> getVirtuals(IPluginDescriptor<T> serverPluginDescriptor) Gets the instance of the VirtualsContainer for the plug-in. The instance is allocated if not yet created. This instance will be disposed of when the application session is disposed of.- Parameters:
serverPluginDescriptor
- The server plug-in descriptor.- Returns:
- The instance of the virtuals container, or null if appGyro is disposed of.
- Throws:
NullPointerException
- If the plug-ins server ID is null fromIPluginDescriptor.getServerID()
.
getServer
Gets the server of this session.getAppSessionInfo
Gets the application session info.- Specified by:
getAppSessionInfo
in interfaceIAppSessionGyro
- Returns:
- The original session information that initiated the application session.
getAppThreadGroup
Gets the AppSessionGyro's Thread Group.- Specified by:
getAppThreadGroup
in interfaceIAppSessionGyro
- Returns:
- The Virtual Thread Group.
getEnvironment
Gets the original environment properties for Selector's or Value's.This is NOT the same instance as the one available from the
ClientSessionGyro.getEnvironment()
.- Specified by:
getEnvironment
in interfaceIAppSessionGyro
- Specified by:
getEnvironment
in interfaceIRuntimeReferenceLookup
- Returns:
- The original environment properties for selectors, null if never initialized.
getServerConfigurationEnvironment
Gets the selected Server configuration environment for the Application Session.- Returns:
- The Server configuration environment to use for the sessions, null for none.
getFocusEngine
Returns the focus engine instance for the specified component.- Specified by:
getFocusEngine
in interfaceIAppSessionGyro
- Specified by:
getFocusEngine
in interfaceIFocusEngineProvider
- Parameters:
comp
- The component requesting the focus engine. For the AppSessionGyro, the focus engine returns an instance of the VirtualSpace focus engine if the component instance is a IVSComponent (VSTable, VSField, etc) or a VirtualSpace, for now.- Returns:
- The focus engine instance, or null if not found.
getCreationTime
public long getCreationTime()Gets the creation time in milliseconds.- Specified by:
getCreationTime
in interfaceIAppSessionGyro
- Returns:
- Milliseconds since the epoch.
getAppID
Gets the application ID.- Specified by:
getAppID
in interfaceIAppSessionGyro
- Returns:
- The AppID is an upper case string.
getAppFactory
Gets the application factory.- Specified by:
getAppFactory
in interfaceIRuntimeReferenceLookup
- Returns:
- The AppFactory.
getCustomAppValue
Gets a value for a key in the custom app properties.- Specified by:
getCustomAppValue
in interfaceIAppSessionGyro
- Parameters:
key
- The key or name of the property to retrieve.- Returns:
- The value, or null if no value is defined for the key, or the custom map is not defined.
getTransactionCoordinator
Gets the transaction coordinator of the session.- Specified by:
getTransactionCoordinator
in interfaceIAppSessionGyro
- Returns:
- The TXP coordinator, or null for none.
getVirtualSpaceVirtualsContainer
The VirtualsContainer instance for VirtualSpace. This instance is shared for all parallel client sessions (if this is enabled or allowed).getSessionUserIdentifier
Gets the SessionUserIdentifier.- Specified by:
getSessionUserIdentifier
in interfaceIAppSessionGyro
- Returns:
- The user identifier of the session.
getAuthenticatedUser
Gets the authenticated user information.- Specified by:
getAuthenticatedUser
in interfaceIAppSessionGyro
- Returns:
- The authenticated user instance, or
null
for none.
changeExternallyAuthenticatedUser
Changes the authenticated user due an external authentication mechanism such as LinkedIn.- Parameters:
authUser
- The new authenticated user.- Returns:
- The authentication result, perhaps error "user is disabled".
- Throws:
NullPointerException
- If the client gyro or authUser parameter is null.
getAppPropCnr
Gets the application root for static references look-up.getVirtualizedPropFromReference
Attempts to look up a virtualized property from a reference to the VirtualSpace only.- Specified by:
getVirtualizedPropFromReference
in interfaceIVirtualizedReferenceLookup
- Parameters:
reference
- The reference to look-up.- Returns:
- The virtualized instance of the property, null if not found.
getRuntimePropFromReference
Gets a reference for runtime use to get the reference of an item. The reference must be fully qualified such as "*ALIAS:/type/path" or "MODULE:/type/path" and cannot be relative.Note: The reference can be to the static or virtualized properties, but if a property type is virtualized and the property is not found, a fall-back to search the application for the static non-virtualized property IS NOT PERFORMED.
Calling this method is the same as calling
getRuntimePropFromReference(reference, false)}
.- Specified by:
getRuntimePropFromReference
in interfaceIAppSessionGyro
- Specified by:
getRuntimePropFromReference
in interfaceIRuntimeReferenceLookup
- Parameters:
reference
- The reference to look-up.- Returns:
- The property found, or null for reference not found.
getRuntimePropFromReference
Gets a reference for runtime use to get the reference of an item. The reference must be fully qualified such as "*ALIAS:/type/path" or "MODULE:/type/path" and cannot be relative.If the flag
fallBackToNonVirtualized
is false, the search will not fallback to searching for the non-virtualized property in the runtime app. The result will only returned virtualized properties, i.e. for a reference as e.g. "module:/vs/someVS", and depending on where this method is called (the client session), also includes other virtualized properties such as panels as e.g. "module:/panel/somePanel".To always fallback to also searching the runtime app, specify
fallBackToNonVirtualized
to true.- Specified by:
getRuntimePropFromReference
in interfaceIAppSessionGyro
- Specified by:
getRuntimePropFromReference
in interfaceIRuntimeReferenceLookup
- Parameters:
reference
- The reference to look-up.fallBackToNonVirtualized
- Flag indicating a fallback to non-virtualized properties.- Returns:
- The property found, or null for reference not found.
getRootFromName
Gets the module root for a name. In the Editor, the module is the project, and that root container is returned. In the Server, the module doesn't matter, so the real root returns itself.When running with assertions, this call throws an assertion error by default, showing that the call is directed to a non-root property container.
- Specified by:
getRootFromName
in interfaceIAppSessionGyro
- Specified by:
getRootFromName
in interfaceIRuntimeReferenceLookup
- Parameters:
requestor
- The requestor property.module
- The module name (without colon), i.e. the project name in the Designer.- Returns:
- The root property container, or null if this container is not the root, or if the module name is not found. The default implementation returns null.
createClientSessionGyro
public ClientSessionGyro createClientSessionGyro(ClientEndPoint clientEndPoint, Worker worker, EnvProps envProps) Called to create the ClientSessionGyro for the first client session or for parallel client sessions.- Parameters:
clientEndPoint
- The client end point.worker
- The worker.- Returns:
- The client session gyro
getClientSessionGyros
Gets the active client session Gyro's for this application session Gyro.- Specified by:
getClientSessionGyros
in interfaceIAppSessionGyro
- Returns:
- The array of active client session Gyro's.
getClientSessionsCount
public int getClientSessionsCount()Gets the count of client sessions.- Specified by:
getClientSessionsCount
in interfaceIAppSessionGyro
toString
Formats the instance to a String.initialize
Initiates the application for the client session. This is done only once for the same user and will remain in that state, e.g. languages, etc.- Parameters:
envProps
- The client environment properties.clientGyro
- The client session gyro used to place an additional session according to the current VirtualSpace.- Returns:
- true for success, false if configuration is unsupported.
isVirtualized
Returns if a VirtualSpace already is virtualized for the application.- Specified by:
isVirtualized
in interfaceIAppSessionGyro
- Parameters:
virtualSpace
- The VirtualSpace.- Returns:
- true if
vs
already is virtualized or a virtualized instance is present, false otherwise.
getVirtualizedVirtualSpace
Gets the virtualized counterpart of a VirtualSpace. If the VirtualSpace is not virtualized, it will be done. If the VirtualSpace parameter already is a virtualized VirtualSpace, that instance is returned.This method is typically used by data connectors as action actors that have another target VirtualSpace. Focus can be set to a component in another VirtualSpace once virtualized.
- Specified by:
getVirtualizedVirtualSpace
in interfaceIAppSessionGyro
- Parameters:
virtualSpace
- The VirtualSpace.doVirtualize
- Flag to virtualize the VirtualSpace if not already virtualized or not.- Returns:
- A virtualized VirtualSpace for the virtualSpace parameter, or the virtualSpace parameter instance if it was virtualized.
getVirtualizedVSComponent
Gets the virtualized VSComponent counterpart from a non-virtualized VSComponent. If the component's VirtualSpace is not virtualized, it will be done. If the component parameter already is virtualized, that instance is returned. This method can also process a VirtualSpace instance as it is implementing the IVSComponent interface.- Specified by:
getVirtualizedVSComponent
in interfaceIAppSessionGyro
- Parameters:
component
- A VS component.- Returns:
- A virtualized component for the component parameter, or the component parameter instance if it was virtualized.
null
is returned if the VirtualSpace is virtualized and the VSComponent counterpart doesn't exist or the class instance is not the same as the original component, or if thecomponent
parameter isnull
.
getVirtualizedVSComponent
Gets the virtualized VSComponent counterpart from a non-virtualized VSComponent. If the component's VirtualSpace is not virtualized, it will be done. If the component parameter already is virtualized, that instance is returned.- Specified by:
getVirtualizedVSComponent
in interfaceIAppSessionGyro
- Parameters:
component
- A VS component.- Returns:
- A virtualized component for the component parameter, or the component parameter instance if it was virtualized.
null
is returned if the VirtualSpace is virtualized and the VSComponent counterpart doesn't exist or the class instance is not the same as the original component, or if thecomponent
parameter isnull
.
onFocusVetoChange
Called to perform veto.- Specified by:
onFocusVetoChange
in interfaceIGyroFocusEngineOwner
- Parameters:
event
- The focus event, InternalFocusEvent perhaps.- Throws:
FocusVetoException
- When the focus is veto'ed.
onFocusChanged
public void onFocusChanged(IFocusComp newComp, IFocusComp oldComp, IGProp<?> trigger, boolean isRemoteInduced, boolean isInternal) Called when focus changes.- Specified by:
onFocusChanged
in interfaceIGyroFocusEngineOwner
- Parameters:
newComp
- New focus component.oldComp
- Old focus component.trigger
- The trigger property, null for none.isRemoteInduced
- If the event is remote induced.isInternal
- The internal flag as specified in thesetFocus
method to the focus engine.
getCurrentFocus
Returns the current focus in the VirtualSpace. If no particular component is in focus, the VirtualSpace that last had focus is returned.- Specified by:
getCurrentFocus
in interfaceIAppSessionGyro
- Returns:
- The component in focus, or null if no focus is currently set.
setVirtualizeSupportFocus
Sets the focus to the specified VS component, regardless if the VS component is virtualized or not. If not virtualized, it will be prior to setting the focus.- Specified by:
setVirtualizeSupportFocus
in interfaceIAppSessionGyro
- Parameters:
vsComp
- The VS component to focus.- Returns:
- Error message, or null for success.
setVirtualizeSupportFocus
Sets the focus to the specified VS component, regardless if the VS component is virtualized or not. If not virtualized, it will be prior to setting the focus.- Specified by:
setVirtualizeSupportFocus
in interfaceIAppSessionGyro
- Parameters:
vsComp
- The VS component to focus.trigger
- The trigger component, null for none.- Returns:
- Error message, or null for success.
getApplicationTimerEngine
Gets the application timer engine. All timer tasks as disposed of automatically when the application session exits.- Specified by:
getApplicationTimerEngine
in interfaceIAppSessionGyro
- Returns:
- The application session implementation of the timeout engine.
getAppWorker
Gets the Worker for the Application.- Specified by:
getAppWorker
in interfaceIAppSessionGyro
- Returns:
- The Application Worker.
getPrivateStorageMap
Gets the concurrent hash map used to store the private data.- Specified by:
getPrivateStorageMap
in interfaceIPrivateStorage
- Returns:
- The private storage map.
requestUILock
Requests a UI lock state. The object returned can be used to set a message below the lock spinner. It can also be used to set a progress indicator, also below the spinner. A progress indicator can also be handled using the lock object.Note: You MUST call the objects
{link @ILockState#release()}
method to release the lock state.- Specified by:
requestUILock
in interfaceIAppSessionGyro
- Returns:
- The lock state object.
isUILocked
public boolean isUILocked()Get the current UI lock state.You may also query the incremental lock state using
.getLockCount()
- Specified by:
isUILocked
in interfaceIAppSessionGyro
- Returns:
- true if busy state is on, false otherwise.
lockUI
Locks the UI with a message and a delay.Consider using the method
to handle UI locking along with optional message, wait delay and progress indicator.requestUILock()
This call will not change the potential wait message or wait message delay if the method is not successful.
Also consider using the method
in case multiple operations and threads can toggle the lock state.decrementUILock()
- Specified by:
lockUI
in interfaceIAppSessionGyro
- Parameters:
waitMsg
- The wait message, null for none.delay
- Delay before the message is shown in the Client.- Returns:
- Busy change flag, true if busy state changed, false otherwise. The return value may be false because the lock count is non-zero.
lockUI
Locks the UI with a message and a delay.Consider using the method
to handle UI locking along with optional message, wait delay and progress indicator.requestUILock()
This call will not change the potential wait message or wait message delay if the method is not successful.
Also consider using the method
in case multiple operations and threads can toggle the lock state.decrementUILock()
- Specified by:
lockUI
in interfaceIAppSessionGyro
- Parameters:
waitMsg
- The wait message, null for none.delay
- Delay of lock spinner: -2 for default (1.5 second), -1 disabled, 0=no delay, >0 wait time in milliseconds (1-20_000, i.e. 20 seconds).- Returns:
- Busy change flag, true if busy state changed, false otherwise. The return value may be false because the lock count is non-zero.
- Throws:
IllegalArgumentException
- If thedelay
value is not -1 to 20_000 milliseconds (20 seconds).
unlockUI
public boolean unlockUI()Unlocks the UI.Consider using the method
to handle UI locking along with optional message, wait delay and progress indicator.requestUILock()
This call will not change the potential wait message or wait message delay if the method is not successful.
Also consider using the method
in case multiple operations and threads can toggle the lock state.decrementUILock()
- Specified by:
unlockUI
in interfaceIAppSessionGyro
- Returns:
- Busy change flag, true if busy state changed, false otherwise. The return value may be false because the lock count is non-zero.
getLockCount
public int getLockCount()Returns the incremental lock count that governs the UI locking state. Note that the lock state may be in effect even if the lock count is zero.- Specified by:
getLockCount
in interfaceIAppSessionGyro
- Returns:
- The lock count, zero or positive value.
incrementUILock
public int incrementUILock()Increases the incremental lock state. If it was zero, it will UI lock the session. Each call to this method must match a call to
.decrementUILock()
Consider using the method
to handle UI locking along with optional message, wait delay and progress indicator.requestUILock()
- Specified by:
incrementUILock
in interfaceIAppSessionGyro
- Returns:
- The lock count, i.e. the number of calls that has been made to this method minus the number of calls to
, after the call to this method.decrementUILock()
decrementUILock
public int decrementUILock()Decreases the incremental lock state. If it becomes zero, it will UI unlock the session. Each call to this method must match a call to
.incrementUILock()
If this method is called and the lock count is zero, nothing will happen, but a warning event with a call stack will be logged.
- Specified by:
decrementUILock
in interfaceIAppSessionGyro
- Returns:
- The lock count, i.e. the number of calls that has been made to
minus the number of calls to this method.incrementUILock()
setLockMessage
Sets the message to display for the lock state, above the indicator.- Specified by:
setLockMessage
in interfaceIAppSessionGyro
- 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.
setLockMessage
Sets the message to display for the lock state, above the indicator, along with a progress value.- Specified by:
setLockMessage
in interfaceIAppSessionGyro
- 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.
setLockMessage
Sets the message to display for the lock state, above the indicator, along with a progress value.- Specified by:
setLockMessage
in interfaceIAppSessionGyro
- 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.
setLockProgress
public boolean setLockProgress(int progress) Sets the current progress bar value. This method will not do anything if the lock state is not present.- Specified by:
setLockProgress
in interfaceIAppSessionGyro
- 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.
getAppHistory
Returns the application session history used for backward and forward navigation.- Specified by:
getAppHistory
in interfaceIAppSessionGyro
- Returns:
- The application session history instance.
getLanguageCode
Gets the language code of the application session. This language may very well not be the one requested by the end user device, but rather one of the languages the application supports.- Specified by:
getLanguageCode
in interfaceIAppSessionGyro
- Returns:
- The language code.
getAppKStringInfoProvider
Retrieves the KStringInfoProvider for the application session.Note: it is recommended to use the
when available as it has more precise information available for the client session.IClientSessionGyro.getKStringInfoProvider()
- Specified by:
getAppKStringInfoProvider
in interfaceIAppSessionGyro
- Returns:
- The KString information provider instance, or null if not possible.
getKStringInfoProvider
Retrieves the KStringInfoProvider for the application session.Note: it is recommended to use the
when available as it has more precise information available for the client session.IClientSessionGyro.getKStringInfoProvider()
- Specified by:
getKStringInfoProvider
in interfaceIAppSessionGyro
- Specified by:
getKStringInfoProvider
in interfaceILocaleString
- Returns:
- The KString information provider instance, or null if not possible. This method returns the same value as
getAppKStringInfoProvider()
.
getLocale
Gets the local info class instance.- Specified by:
getLocale
in interfaceILocaleString
- Returns:
- The locale info class instance when the client environment has been set, otherwise the default client locale info instance specified for the server.
setLocale
Changes or sets the LocaleInfo for the environment.- Specified by:
setLocale
in interfaceIAppSessionGyro
- Parameters:
locale
- localeInfo The locale information to use.- Returns:
- The old LocaleInfo, or null if not set.
getLocaleKString
Gets the KString of a particular ID from the app's text tables that are flagged to also handle LocaleString's depending on the flag.- Specified by:
getLocaleKString
in interfaceILocaleString
- Parameters:
id
- The text ID.system
- Flagged to handle system strings for LocaleString's.- Returns:
- The KString for the text ID in current locale, null if not found.
getPrettyLocaledTexts
Gets the locale'd texts instance for the sessions language and text tables.- Specified by:
getPrettyLocaledTexts
in interfaceIAppSessionGyro
- Returns:
- The instance used to create locale'd strings for e.g. duration and distances.
getAppSessionFileProvider
Get the web server file provider for the application session.- Returns:
- The web server file provider.
- Throws:
IOException
- If the directory for the application session files failed to be created.IllegalStateException
- If the application session is disposed of.
requestOAuthCallbackDisplay
Requests the OAuth (1.0a or 2.0) authentication callback provider to show an URL to the user in order to be accepted.- Returns:
- The authentication callback.
closeAuthenticationWindows
public void closeAuthenticationWindows()Closes the remote windows for authentication.getImage
Gets an image definition from the image container for the client session.- Specified by:
getImage
in interfaceIRuntimeImageCache
- Parameters:
name
- The image name.- Returns:
- The predefined image definition, or null if not found.
setImage
Adds the image definition to the image container for the client session. If the image already exists, it is replaced with the new definition.- Specified by:
setImage
in interfaceIRuntimeImageCache
- Parameters:
image
- The image definition.- Returns:
- true if the container was changed, i.e. image was added or replaced, false for no change.
removeImage
Removes an image with a name from the client session.- Specified by:
removeImage
in interfaceIRuntimeImageCache
- Parameters:
name
- The image to remove.- Returns:
- true for removed, false if not found.
clearImageCache
public void clearImageCache()Clears the entire cache.- Specified by:
clearImageCache
in interfaceIRuntimeImageCache
messageBox
public void messageBox(IMessageBoxReply reply, IMessageBox.Icon icon, KString title, KString message, KString... buttons) Displays a message box with the specified title and message.The callback is done in the application worker thread.
- Specified by:
messageBox
in interfaceIMessageBox
- Parameters:
reply
- The reply callback that is called when the user chooses a button or session is closed,null
for none.icon
- Icon to display, see the{link Icon}
enumeration.title
- The title string, must be non-null.message
- The message to display, must be non-null.buttons
- The strings for the buttons to display, if none, just anOK
button is displayed. This array of buttons defined the index value returned by this method.- Throws:
NullPointerException
- Ificon
ormessage
is null, or if any of the elements inbuttons
array is null.IllegalStateException
- If the application session is disposed of.
toast
public void toast(KString message, IToaster.Position position, IToaster.Direction direction, IToaster.Type type, int duration) Displays a simple, unobstructive and ephemeral text message to the user.- Specified by:
toast
in interfaceIToaster
- Parameters:
message
- The message to display.position
- Position of toast, default value is Position.BOTTOM_CENTER if null.direction
- Direction of the toast animation, default Direction.UP if null.type
- Type of message style: message, warning, error of fatal, default is message if nullduration
- Duration of the toast message being shown in ms. Valid values are in the interval [0, 10000], 0 for a sticky toast.
getLocationService
Returns the location service for the application session.- Specified by:
getLocationService
in interfaceIAppSessionGyro
- Returns:
- The "application singleton" instance of the location service.
getAuthenticatedUserUUID
Gets the user ID for background location service identification.- Specified by:
getAuthenticatedUserUUID
in interfaceIAppSessionGyro
- Returns:
- String made up of the authenticated user's UUID, null if the user is not yet authenticated or undefined.
getUserAuthenticationUI
Gets the user authentication UI interface used for the initial login.- Specified by:
getUserAuthenticationUI
in interfaceIAppSessionGyro
- Returns:
- The user authentication interface.