Interface IClientSessionGyro
- All Superinterfaces:
ILocaleString
,IMessageBox
,IPrivateStorage
,IRuntimeImageCache
,IToaster
- All Known Implementing Classes:
ClientSessionGyro
- 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.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
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a dispose listener for the client session.Adds a new focus entry at the current location for this client session.boolean
Adds a screen orientation listener for the client session.boolean
addScreenSizeListener
(IScreenSizeListener listener) Adds a screen size listener for the client session.boolean
dispose()
Disposes of the Gyro instance so the client session ends.void
enterClientLock
(boolean isFromClient) Method called whenever the client lock state is enabled.void
Releases client lock state if the client is not in busy state.Gets the Gyro for the application session.getClientContextMenuReference
(UIContextMenu contextMenu, boolean fullPropReference) Gets the reference to use for a context menu.Gets the client sessions information.Gets the client timer engine.Gets the Worker for the current Client session.Returns the current focus in the UI.boolean
getDeviceParameters
(DeviceParameter... params) Retrieves parameters from the client device for the current app.Gets the current environment properties for Selector's or Value's.Gets the flashlight client-specific instance, currently only supported for operations on iiziRun clients for Android and iOS.Gets the history request instance for the client session.Retrieves the KStringInfoProvider for the client session.Gets the language code to use for the client session, or if not defined, the application session language code.Returns an instance of the geolocation service.getMatchingPanels
(VirtualSpace virtualSpace) Gets the panels that matches a VirtualSpace for this client session.int
Returns the animation that will be used for next panel that replaces another panel.default IOpenNativeSettings
Get the open native settings interface for the client-specific instance, supported only on iiziRun clients running iiziRun-based clients for Android and iOS.Gets the locale'd texts instance for the sessions language and text tables.int
Gets the current screen height.Gets the current screen orientation.Gets the current screen size.int
Gets the current screen width.static IClientSessionGyro
Gets the runtime application instance for the current thread in a client session.static IClientSessionGyro
getSessionInstance
(SessionInfo sessionInfo) Gets the runtime application instance for the current thread in a client session.Gets the current top-most panel.Returns the UI focus engine instance for the specified component.Gets the cached and sorted array of panels that is currently displayed.GProp<?>
getVirtualizedPropFromReference
(String reference) Attempts to look up a virtualized property from a reference by searching this instance.boolean
Checks if the client session Gyro is disposed of.boolean
Checks if screen orientation locking is supported or not.default boolean
Get the current UI lock state.boolean
Removes a dispose listener for the client session.boolean
Removes a screen orientation listener for the client session.boolean
removeScreenSizeListener
(IScreenSizeListener listener) Removes a screen size listener for the client session.Requests a UI lock state.void
Restarts the remote client.boolean
saveDeviceParameters
(DeviceParameter... params) Saves parameters on the client device for the current app.void
sendStat
(String event, DeviceParameter... params) Sends statistics event to the analytics engine on the client to log the event.void
Sets the UI busy state and optionally updates the message and/or progress.setLocale
(LocaleInfo locale) Changes or sets the LocaleInfo for the environment.int
setNextPanelAnimation
(int nextAnimation) Sets the animation that will be used for next panel that replaces another panel.default int
setNextPanelAnimation
(IUIPanelAnimation.Type type, IUIPanelAnimation.Direction direction, IUIPanelAnimation.Speed speed) Sets the animation that will be used for next panel that replaces another panel.void
setPseudoActionFocusToVS
(IUIFocusComp focusComp, IGProp<?> trigger) Called when a "pseudo UI action" is executed, making sure its VS counterpart has the current focus.void
setReady()
Sets the UI to "ready", i.e.boolean
Sets the UI to "ready", i.e.boolean
setScreenOrientation
(ScreenOrientation orientation) Locks the screen orientation.boolean
Updates the focus to the VS from the current focused UI component.default boolean
Triggers closing of the window on the client that was opened with triggerRemoteOpenWindow.boolean
triggerRemoteCloseWindow
(boolean ignoreCallbackListener) Triggers closing of the window on the client that was opened with triggerRemoteOpenWindow.default boolean
triggerRemoteOpenWindow
(String url, String target) Triggers opening of a browser window on the client.boolean
triggerRemoteOpenWindow
(String url, String target, WindowOptions options, IWindowCloseListener windowListener) Triggers opening of a browser window on the client.default boolean
triggerRemoteOpenWindow
(String url, String target, Runnable closeListener) Deprecated.boolean
Unlocks the screen orientation.Methods inherited from interface com.iizix.text.ILocaleString
getLocale, getLocaleKString, getLocaleKString
Methods inherited from interface com.iizix.gyro.IMessageBox
messageBox, messageBox, messageBox
Methods inherited from interface com.iizix.api.IPrivateStorage
getPrivateData, getPrivateData, getPrivateStorageMap, setPrivateData
Methods inherited from interface com.iizix.gyro.IRuntimeImageCache
clearImageCache, getImage, removeImage, setImage
Field Details
STORAGE_NAME
Local storage name in SessionInfo.
Method Details
getSessionInstance
Gets the runtime application instance for the current thread in a client session.- Returns:
- The RuntimeApp instance when called from a thread of the client session,
null
otherwise.
getSessionInstance
Gets the runtime application instance for the current thread in a client session.- Parameters:
sessionInfo
- A session information instance, or null for none.- Returns:
- The RuntimeApp instance when called from a thread of the client session,
null
otherwise.
addDisposeListener
Adds a dispose listener for the client session. Calling this method multiple times with the same listener will have no effect (but to return false).- 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 client session.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
dispose
boolean dispose()Disposes of the Gyro instance so the client session ends.- Returns:
- true for dispose success, false if already disposed of.
isDisposed
boolean isDisposed()Checks if the client session Gyro is disposed of.- Returns:
- true if disposed, false otherwise.
getAppSessionGyro
IAppSessionGyro getAppSessionGyro()Gets the Gyro for the application session.getClientSessionInfo
SessionInfo getClientSessionInfo()Gets the client sessions information.- Returns:
- The session information instance.
getUIFocusEngine
IFocusEngine getUIFocusEngine()Returns the UI focus engine instance for the specified component.- Returns:
- The UI focus engine instance.
getClientTimerEngine
ITimerEngine getClientTimerEngine()Gets the client timer engine. All timer tasks as disposed of automatically when the client session exits.- Returns:
- The client session implementation of the timeout engine.
synchronizeCurrentFocusWithVS
boolean synchronizeCurrentFocusWithVS()Updates the focus to the VS from the current focused UI component. This may be needed to synchronize the VS focus for a particular UI session to make sure it is synchronized.- Returns:
- true for success, false if nothing was done.
setPseudoActionFocusToVS
Called when a "pseudo UI action" is executed, making sure its VS counterpart has the current focus. This "pseudo action" can be e.g. a MLItemProp that has a context menu, as well as an direct action such as a UIButton.This method is not intended to be called but is used internally by the framework.
- Parameters:
focusComp
- The "pseudo action" focus component.trigger
- The trigger component, null for none.
getClientWorker
Worker getClientWorker()Gets the Worker for the current Client session.- Returns:
- The Client Worker, or null if the current thread is not associated to a Client.
getKStringInfoProvider
IKStringInfoProvider getKStringInfoProvider()Retrieves the KStringInfoProvider for the client session.- Specified by:
getKStringInfoProvider
in interfaceILocaleString
- Returns:
- The KString information provider instance, or null if not possible.
getEnvironment
EnvProps getEnvironment()Gets the current environment properties for Selector's or Value's.This is NOT the same instance as the one available from the
IAppSessionGyro.getEnvironment()
.- Returns:
- The current environment properties for selectors, null if client hasn't sent them yet.
getOpenNativeSettings
Get the open native settings interface for the client-specific instance, supported only on iiziRun clients running iiziRun-based clients for Android and iOS.- Returns:
- The open native settings interface. In order to test support for open native settings operations, use
IOpenNativeSettings.isSupported()
. - Throws:
NotFoundException
- In case the open native settings instance is not found, typically if the client session is under creation, or it has been disposed of.
getFlashlight
Gets the flashlight client-specific instance, currently only supported for operations on iiziRun clients for Android and iOS.- Returns:
- The flashlight instance. In order to test support of flashlight operations, use
IFlashlight.isSupported()
. - Throws:
NotFoundException
- In case the flashlight instance is not found, typically if the client session is under creation, or it has been disposed of.
getLocationService
ILocationService getLocationService()Returns an instance of the geolocation service.- Returns:
- The instance, always non-null.
getPrettyLocaledTexts
PrettyLocaledTexts getPrettyLocaledTexts()Gets the locale'd texts instance for the sessions language and text tables.- Returns:
- The instance used to create locale'd strings for e.g. duration and distances.
setLocale
Changes or sets the LocaleInfo for the environment.- Parameters:
locale
- localeInfo The locale information to use.- Returns:
- The old LocaleInfo, or null if not set.
- Throws:
PropTypeException
- If the property is read-only.
getLanguageCode
String getLanguageCode()Gets the language code to use for the client session, or if not defined, the application session language code.- Returns:
- The language code, or null for default.
getTopmostPanel
UIPanelBase getTopmostPanel()Gets the current top-most panel.- Returns:
- The panel, null if none has been created.
getVirtualizedPanels
UIPanelBase[] getVirtualizedPanels()Gets the cached and sorted array of panels that is currently displayed.The index 0 is the topmost panel and the higher the index, the more overlapped the panel is. The highest index is the top-level main panel covering the screen.
Do not modify this array!
- Returns:
- The virtualized panels.
getMatchingPanels
Gets the panels that matches a VirtualSpace for this client session. The VirtualSpace can be virtualized or not, and the client session environment properties are used to determine the panels in question (i.e. depending on their selectors).This method is quite CPU intensive and should NOT be done too often. The return value is however cached during the focus handler mappings from VirtualSpace to the UI, so only one such call is done.
The ordering is not significant and can be a mix of primary and secondary panels, however the matching panel is the virtualized instance if one is present, otherwise it is the non-virtualized instance.
Note: The result from this method should not be cached because the matching panels may very well change during a client session due to e.g. a change in client capabilities or alike (that affects the result of the selectors used).
- Parameters:
virtualSpace
- The VirtualSpace to look-up the panels for.- Returns:
- A cloned cached array of the matching panels.
The array of matching panels, can be a mix of virtualized and non-virtualized panels!
getVirtualizedPropFromReference
Attempts to look up a virtualized property from a reference by searching this instance.- Parameters:
reference
- The reference to look-up.- Returns:
- The virtualized instance of the property, null if not found.
getClientContextMenuReference
Gets the reference to use for a context menu.- Parameters:
contextMenu
- The context menu.fullPropReference
- Flag indicating a full property reference string should be returned, false for short (used internally by the server).- Returns:
- The reference to use, empty string for none (never null).
- Throws:
IllegalArgumentException
- If the context menu is not a stand-alone context menu but a child of a panel component.
requestUILock
ILockState 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.- Returns:
- The lock state object.
- Throws:
IllegalStateException
- If the client session is disposed of.
isUILocked
default boolean isUILocked()Get the current UI lock state.This state is taken from the Application Session Gyro, and callin this method equals to calling
getAppSessionGyro().isUILocked()
.- Returns:
- true if busy state is on, false otherwise.
- Throws:
IllegalStateException
- If the client session is disposed of.
setBusy
Sets the UI busy state and optionally updates the message and/or progress.This method is intended to be used with advanced UI programming where a message is used in conjunction with a progress.
If this functionality is not required, it is recommended to let the AppSessionGyro handle the busy state.
- Parameters:
msg
- Optional 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-20000, i.e. 20 seconds).progress
- Progress value, -1 for none, otherwise a value between 0 and 100.- Throws:
IllegalArgumentException
- If progress value is not -1 or 0 to 100, or delay is smaller than -2 or larger than 20000.
setReady
void setReady()Sets the UI to "ready", i.e. clears busy state.Note: the state is not set to ready immediately, merely the busy state. The UI is triggered to be synchronized with the VirtualSpace in the Client Worker thread, and a change of panel may be the result.
This method is intended to be used with advanced UI programming where a message is used in conjunction with a progress.
If this functionality is not required, it is recommended to let the AppSessionGyro handle the busy state.
setReady
Sets the UI to "ready", i.e. clears busy state.Note: the state is not set to ready immediately, merely the busy state. The UI is triggered to be synchronized with the VirtualSpace in the Client Worker thread, and a change of panel may be the result.
Specify a runnable instance if you wish to be notified when the panel is unlocked. This runnable will be called at a later stage from the Client Worker thread.
The runnable will be be called if the busy state is turned on or the client has been locked.
This method is intended to be used with advanced UI programming where a message is used in conjunction with a progress.
If this functionality is not required, it is recommended to let the AppSessionGyro handle the busy state.
- Parameters:
runnable
- The runnable to be notified, null for none.- Returns:
- true if the runnable will be called (if present), false if it will not be called.
getCurrentFocus
UIComp getCurrentFocus()Returns the current focus in the UI. If no particular component is in focus, the topmost panel is returned.- Returns:
- The component in focus, or null if not a single panel has yet been created.
getNextPanelAnimation
int getNextPanelAnimation()Returns the animation that will be used for next panel that replaces another panel.This animation only applies to full-page panels.
This value is reset to
as soon as a panel replacement has been made.IUIPanelAnimation.ANIMATION_DEFAULT
- Returns:
- The composite animation value, or
for none.IUIPanelAnimation.ANIMATION_DEFAULT
setNextPanelAnimation
int setNextPanelAnimation(int nextAnimation) Sets the animation that will be used for next panel that replaces another panel.This animation only applies to full-page panels.
This value is reset to
as soon as a panel replacement has been made.IUIPanelAnimation.ANIMATION_DEFAULT
- Returns:
- The old "next panel animation" composite animation value, or
for none.IUIPanelAnimation.ANIMATION_DEFAULT
setNextPanelAnimation
default int setNextPanelAnimation(IUIPanelAnimation.Type type, IUIPanelAnimation.Direction direction, IUIPanelAnimation.Speed speed) Sets the animation that will be used for next panel that replaces another panel.This animation only applies to full-page panels.
This value is reset to
as soon as a panel replacement has been made.IUIPanelAnimation.ANIMATION_DEFAULT
- Parameters:
type
- The animation type.direction
- The animation direction.speed
- The animation speed.- Returns:
- The old "next panel animation" composite animation value, or
for none.IUIPanelAnimation.ANIMATION_DEFAULT
enterClientLock
void enterClientLock(boolean isFromClient) Method called whenever the client lock state is enabled.- Parameters:
isFromClient
- Flag indicating the state change is induced from client side. If this flag is false, the lock state
exitClientLock
void exitClientLock()Releases client lock state if the client is not in busy state. The lock state will be released when the VS has been synchronized at a later stage, but very quickly.getHistoryRequest
HistoryRequest getHistoryRequest()Gets the history request instance for the client session.- Returns:
- This client session's instance for history requests, never changes during the session's lifetime.
addHistoryEntry
IAppHistoryEntry addHistoryEntry()Adds a new focus entry at the current location for this client session. The VirtualSpace and UI location is recorded to the previous and forward locations in the entry.The entry is added at the current index and will clear all forward operations at that point to the end, i.e.
is called before adding the entry and moving the index forward by one (1).IAppHistory.clearForwardEntries()
Once added, the history entry forward and backward information can be set or adjusted.
- Returns:
- The newly added history entry, null if history operations are currently in progress (i.e. a forward or backward history operation is running).
getScreenWidth
int getScreenWidth()Gets the current screen width.- Returns:
- The current screen width, or zero if not initialized.
getScreenHeight
int getScreenHeight()Gets the current screen height.- Returns:
- The current screen height, or zero if not initialized.
getScreenSize
Size getScreenSize()Gets the current screen size.- Returns:
- The current screen size, zero width and/or height if not initialized.
addScreenSizeListener
Adds a screen size listener for the client session. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
listener
- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
NullPointerException
- If the listener isnull
.
removeScreenSizeListener
Removes a screen size listener for the client session.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
isScreenOrientationLockSupported
boolean isScreenOrientationLockSupported()Checks if screen orientation locking is supported or not.- Returns:
- true if the functions to lock or unlock screen orientation are supported, false otherwise.
addScreenOrientationListener
Adds a screen orientation listener for the client session. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
listener
- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
NullPointerException
- If the listener isnull
.
removeScreenOrientationListener
Removes a screen orientation listener for the client session.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
getScreenOrientation
ScreenOrientation getScreenOrientation()Gets the current screen orientation.- Returns:
- The orientation,
ScreenOrientation.unknown
if not supported.
setScreenOrientation
Locks the screen orientation.Note that there may be a delay in the orientation change after calling this method. This could be due to slow client connection, disconnected client or just due to device lag.
- Parameters:
orientation
- The orientation.- Returns:
- true for success, false for not supported.
- Throws:
IllegalArgumentException
- Iforientation
isScreenOrientation.unknown
.
unlockScreenOrientation
boolean unlockScreenOrientation()Unlocks the screen orientation.Note that there may be a delay in the orientation change after calling this method. This could be due to slow client connection, disconnected client or just due to device lag.
- Returns:
- true for success, false for not supported.
sendStat
Sends statistics event to the analytics engine on the client to log the event.- Parameters:
event
- The event name.params
- Parameters to send, null values and sensitive parameters are ignored.
saveDeviceParameters
Saves parameters on the client device for the current app.Sensitive parameters are encrypted with a key kept on the server side. The encrypted data is padded and sent to the client and no key is used on the client side. Only the fingerprint of the server key used is included in the encrypted data. This means that the sensitive parameter is virtually undecipherable on the client side.
- Parameters:
params
- Parameters to save. ADeviceParameter
value ofnull
means that the device parameter and its value is removed from storage. Upon return of this method, eachDeviceParameter
ofparams
is updated with a new state. Possible states areDeviceParameter.State.SUCCESS
,DeviceParameter.State.UNAVAILABLE
,DeviceParameter.State.NOT_FOUND
orDeviceParameter.State.ENCRYPT_ERROR
.- Returns:
true
for success of at least one device parameter,false
for failure (or no parameters to save). In case of functional failure (i.e. not if a device parameter is not found), an error is logged in the server.
getDeviceParameters
Retrieves parameters from the client device for the current app. The variables values and state are filled in before the return of this method call. The state indicates success, some error or if the parameter is not found. The state for eachDeviceParameter
is eitherDeviceParameter.State.SUCCESS
,DeviceParameter.State.NOT_FOUND
,DeviceParameter.State.UNAVAILABLE
orDeviceParameter.State.DECRYPT_ERROR
.- Parameters:
params
- The parameters to retrieve.- Returns:
true
for success,false
if device parameters are not present. The return code istrue
if at least one device parameter was successfully retrieved. Iffalse
is returned and theDevParams
instance is not found inEnvProps
for the client, an error is logged in the server.
triggerRemoteOpenWindow
Triggers opening of a browser window on the client.- Parameters:
url
- The URL to open.target
- The target, null for _blank.- Returns:
- true for success, false if the window cannot be opened because another window already is open or that the session is disposed of. In case of failure, any callback close listener will not be invoked.
triggerRemoteOpenWindow
@Deprecated default boolean triggerRemoteOpenWindow(String url, String target, Runnable closeListener) Deprecated.Triggers opening of a browser window on the client.- Parameters:
url
- The URL to open.target
- The target, null for _blank.closeListener
- Callback to listen to close window, null for none.- Returns:
- true for success, false if the window cannot be opened because another window already is open or that the session is disposed of. In case of failure, any callback close listener will not be invoked.
triggerRemoteOpenWindow
boolean triggerRemoteOpenWindow(String url, String target, WindowOptions options, IWindowCloseListener windowListener) Triggers opening of a browser window on the client.- Parameters:
url
- The URL to open.target
- The target, null for _blank.options
- Options to use, null for "new tab" for a browser client.windowListener
- Callback to listen to blocked or user close window, null for none. When "spawn mode" is used in theoptions
, this parameter is ignored, i.e. as if set tonull
.- Returns:
- true for success, false if the window cannot be opened because another window already is open or that the session is disposed of. In case of failure, any callback close listener will not be invoked.
triggerRemoteCloseWindow
default boolean triggerRemoteCloseWindow()Triggers closing of the window on the client that was opened with triggerRemoteOpenWindow.- Returns:
- true for success, false if no open window is present.
triggerRemoteCloseWindow
boolean triggerRemoteCloseWindow(boolean ignoreCallbackListener) Triggers closing of the window on the client that was opened with triggerRemoteOpenWindow.- Parameters:
ignoreCallbackListener
- Flag to ignore calling a potential callback listener.- Returns:
- true for success, false if no open window is present.
restartRemoteClient
void restartRemoteClient()Restarts the remote client. This is done without asking anything: it will just restart the iiziRun or browser by disconnecting from server and reloading the page directly. For iiziRun Developer/Custom sessions, this will bring up that interface.
triggerRemoteOpenWindow(String, String, WindowOptions, IWindowCloseListener)
instead.