Package org.teamapps.ux.session
Class SimpleSessionContext
- java.lang.Object
-
- org.teamapps.ux.session.SimpleSessionContext
-
- All Implemented Interfaces:
LockableSessionContext,SessionContext
public class SimpleSessionContext extends java.lang.Object implements LockableSessionContext
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSimpleSessionContext.UTF8Control
-
Constructor Summary
Constructors Constructor Description SimpleSessionContext(QualifiedUiSessionId sessionId, ClientInfo clientInfo, CommandDispatcher commandDispatcher, UxServerContext serverContext, org.teamapps.icons.api.IconTheme iconTheme, com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcreateFileLink(java.io.File file)java.lang.StringcreateResourceLink(java.util.function.Supplier<java.io.InputStream> inputStreamSupplier, long length, java.lang.String resourceName)java.lang.StringcreateResourceLink(java.util.function.Supplier<java.io.InputStream> inputStreamSupplier, long length, java.lang.String resourceName, java.lang.String uniqueIdentifier)voiddestroy()voidflushCommands()ResourcegetBinaryResource(int resourceId)ClientInfogetClientInfo()SessionConfigurationgetConfiguration()org.teamapps.icons.api.IconThemegetIconTheme()longgetLastClientEventTimestamp()java.util.LocalegetLocale()java.lang.StringgetLocalized(java.lang.String key, java.lang.Object... parameters)java.util.ResourceBundlegetMessageBundle()SessionStoregetSessionStore()TemplategetTemplate(java.lang.String id)java.io.FilegetUploadedFileByUuid(java.lang.String uuid)booleanisOpen()voidlock(long timeoutMillis)Event<java.lang.Void>onDestroyed()<RESULT> voidqueueCommand(org.teamapps.dto.UiCommand<RESULT> command)<RESULT> voidqueueCommand(org.teamapps.dto.UiCommand<RESULT> command, java.util.function.Consumer<RESULT> resultCallback)TemplateReferenceregisterTemplate(java.lang.String id, Template template)voidregisterTemplates(java.util.Map<java.lang.String,Template> templates)voidrunWithContext(java.lang.Runnable runnable)Does the following: Releases the current SessionContext (A) lock (if present) Acquires the lock for this SessionContext (B) Sets this SessionContext (B) as the current context (CurrentSessionContext). Executes the specified Runnable. Sets back the last SessionContext (A) as current context. Releases the lock for this SessionContext (B) Reacquires the lock for the last (A)voidsetConfiguration(SessionConfiguration config)voidsetCustomMessageBundleProvider(java.util.function.Function<java.util.Locale,java.util.ResourceBundle> provider)voidsetIconTheme(org.teamapps.icons.api.IconTheme theme)voidsetLastClientEventTimestamp(long timestamp)voidunlock()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.teamapps.ux.session.SessionContext
addClientToken, addRootComponent, clearClientTokens, closeWindow, closeWindow, createResourceLink, downloadFile, exitFullScreen, getComponent, getLanguageLocale, getTimeZone, registerBackgroundImage, registerComponent, removeClientToken, resolveIcon, setBackgroundColor, setBackgroundImage, showNotification, showNotification, showNotification, showWindow, unregisterComponent
-
-
-
-
Constructor Detail
-
SimpleSessionContext
public SimpleSessionContext(QualifiedUiSessionId sessionId, ClientInfo clientInfo, CommandDispatcher commandDispatcher, UxServerContext serverContext, org.teamapps.icons.api.IconTheme iconTheme, com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper)
-
-
Method Detail
-
setCustomMessageBundleProvider
public void setCustomMessageBundleProvider(java.util.function.Function<java.util.Locale,java.util.ResourceBundle> provider)
-
getLocale
public java.util.Locale getLocale()
- Specified by:
getLocalein interfaceSessionContext
-
getMessageBundle
public java.util.ResourceBundle getMessageBundle()
- Specified by:
getMessageBundlein interfaceSessionContext
-
getLocalized
public java.lang.String getLocalized(java.lang.String key, java.lang.Object... parameters)- Specified by:
getLocalizedin interfaceSessionContext
-
getLastClientEventTimestamp
public long getLastClientEventTimestamp()
- Specified by:
getLastClientEventTimestampin interfaceSessionContext
-
setLastClientEventTimestamp
public void setLastClientEventTimestamp(long timestamp)
- Specified by:
setLastClientEventTimestampin interfaceSessionContext
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceSessionContext
-
destroy
public void destroy()
- Specified by:
destroyin interfaceSessionContext
-
onDestroyed
public Event<java.lang.Void> onDestroyed()
- Specified by:
onDestroyedin interfaceSessionContext
-
queueCommand
public <RESULT> void queueCommand(org.teamapps.dto.UiCommand<RESULT> command, java.util.function.Consumer<RESULT> resultCallback)- Specified by:
queueCommandin interfaceSessionContext
-
queueCommand
public <RESULT> void queueCommand(org.teamapps.dto.UiCommand<RESULT> command)
- Specified by:
queueCommandin interfaceSessionContext
-
getClientInfo
public ClientInfo getClientInfo()
- Specified by:
getClientInfoin interfaceSessionContext
-
flushCommands
public void flushCommands()
- Specified by:
flushCommandsin interfaceSessionContext
-
getIconTheme
public org.teamapps.icons.api.IconTheme getIconTheme()
- Specified by:
getIconThemein interfaceSessionContext
-
setIconTheme
public void setIconTheme(org.teamapps.icons.api.IconTheme theme)
- Specified by:
setIconThemein interfaceSessionContext
-
getSessionStore
public SessionStore getSessionStore()
- Specified by:
getSessionStorein interfaceSessionContext
-
createFileLink
public java.lang.String createFileLink(java.io.File file)
- Specified by:
createFileLinkin interfaceSessionContext
-
createResourceLink
public java.lang.String createResourceLink(java.util.function.Supplier<java.io.InputStream> inputStreamSupplier, long length, java.lang.String resourceName)- Specified by:
createResourceLinkin interfaceSessionContext
-
createResourceLink
public java.lang.String createResourceLink(java.util.function.Supplier<java.io.InputStream> inputStreamSupplier, long length, java.lang.String resourceName, java.lang.String uniqueIdentifier)- Specified by:
createResourceLinkin interfaceSessionContext
-
getBinaryResource
public Resource getBinaryResource(int resourceId)
- Specified by:
getBinaryResourcein interfaceSessionContext
-
getUploadedFileByUuid
public java.io.File getUploadedFileByUuid(java.lang.String uuid)
- Specified by:
getUploadedFileByUuidin interfaceSessionContext
-
registerTemplate
public TemplateReference registerTemplate(java.lang.String id, Template template)
- Specified by:
registerTemplatein interfaceSessionContext
-
registerTemplates
public void registerTemplates(java.util.Map<java.lang.String,Template> templates)
- Specified by:
registerTemplatesin interfaceSessionContext
-
getTemplate
public Template getTemplate(java.lang.String id)
- Specified by:
getTemplatein interfaceSessionContext
-
lock
public void lock(long timeoutMillis)
- Specified by:
lockin interfaceLockableSessionContext
-
unlock
public void unlock()
- Specified by:
unlockin interfaceLockableSessionContext
-
runWithContext
public void runWithContext(java.lang.Runnable runnable)
Does the following:- Releases the current SessionContext (A) lock (if present)
- Acquires the lock for this SessionContext (B)
- Sets this SessionContext (B) as the current context (CurrentSessionContext).
- Executes the specified Runnable.
- Sets back the last SessionContext (A) as current context.
- Releases the lock for this SessionContext (B)
- Reacquires the lock for the last (A)
- Specified by:
runWithContextin interfaceSessionContext- Parameters:
runnable- the code to be executed.
-
getConfiguration
public SessionConfiguration getConfiguration()
- Specified by:
getConfigurationin interfaceSessionContext
-
setConfiguration
public void setConfiguration(SessionConfiguration config)
- Specified by:
setConfigurationin interfaceSessionContext
-
-