Package org.teamapps.ux.session
Class SessionContext
java.lang.Object
org.teamapps.ux.session.SessionContext
public class SessionContext
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description ExecutionDecoratorStackexecutionDecoratorsDecorators around all executions inside this SessionContext.Event<UiSessionActivityState>onActivityStateChangedEvent<java.lang.Void>onDestroyed -
Constructor Summary
Constructors Constructor Description SessionContext(QualifiedUiSessionId sessionId, ClientInfo clientInfo, javax.servlet.http.HttpSession httpSession, UiCommandExecutor commandExecutor, UxServerContext serverContext, org.teamapps.icons.api.IconTheme iconTheme, com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper) -
Method Summary
Modifier and Type Method Description voidaddClientToken(java.lang.String token)voidaddExecutionDecorator(ExecutionDecorator decorator, boolean outer)Adds a decorator that gets invoked whenever a Thread is bound to this SessionContext.voidaddRootComponent(java.lang.String containerElementId, RootPanel rootPanel)voidclearClientTokens()java.lang.StringcreateFileLink(java.io.File file)java.lang.StringcreateResourceLink(Resource resource)java.lang.StringcreateResourceLink(Resource resource, java.lang.String uniqueIdentifier)static SessionContextcurrent()static SessionContextcurrentOrNull()voiddestroy()voiddownloadFile(java.lang.String fileUrl, java.lang.String downloadFileName)voidexitFullScreen()voidflushCommands()Deprecated.no more needed.ResourcegetBinaryResource(int resourceId)ClientBackPressureInfogetClientBackPressureInfo()ClientInfogetClientInfo()ClientObjectgetClientObject(java.lang.String clientObjectId)SessionConfigurationgetConfiguration()javax.servlet.http.HttpSessiongetHttpSession()org.teamapps.icons.api.IconThemegetIconTheme()java.util.LocalegetLanguageLocale()java.util.LocalegetLocale()java.lang.StringgetLocalized(java.lang.String key, java.lang.Object... parameters)java.util.ResourceBundlegetMessageBundle()TemplategetTemplate(java.lang.String id)java.time.ZoneIdgetTimeZone()java.io.FilegetUploadedFileByUuid(java.lang.String uuid)voidhandleActivityStateChangedInternal(boolean active)voidhandleSessionDestroyedInternal()booleanisActive()booleanisDestroyed()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)voidregisterBackgroundImage(java.lang.String id, java.lang.String image, java.lang.String blurredImage)voidregisterClientObject(ClientObject clientObject)TemplateReferenceregisterTemplate(java.lang.String id, Template template)voidregisterTemplates(java.util.Map<java.lang.String,Template> templates)voidremoveClientToken(java.lang.String token)java.lang.StringresolveIcon(org.teamapps.icons.api.Icon icon)java.util.concurrent.CompletableFuture<java.lang.Void>runWithContext(java.lang.Runnable runnable)java.util.concurrent.CompletableFuture<java.lang.Void>runWithContext(java.lang.Runnable runnable, boolean forceEnqueue)voidsetBackgroundColor(org.teamapps.common.format.Color color, int animationDuration)voidsetBackgroundImage(java.lang.String id, int animationDuration)voidsetConfiguration(SessionConfiguration config)voidsetCustomMessageBundleProvider(java.util.function.Function<java.util.Locale,java.util.ResourceBundle> provider)voidsetIconTheme(org.teamapps.icons.api.IconTheme theme)voidshowNotification(org.teamapps.icons.api.Icon icon, java.lang.String caption)voidshowNotification(org.teamapps.icons.api.Icon icon, java.lang.String caption, java.lang.String description)voidshowNotification(org.teamapps.icons.api.Icon icon, java.lang.String caption, java.lang.String description, boolean dismissable, int displayTimeInMillis, boolean showProgress)voidshowNotification(Notification notification, NotificationPosition position)voidshowNotification(Notification notification, NotificationPosition position, EntranceAnimation entranceAnimation, ExitAnimation exitAnimation)voidshowPopup(Popup popup)voidshowPopupAtCurrentMousePosition(Popup popup)voidshowWindow(Window window, int animationDuration)voidunregisterClientObject(ClientObject clientObject)
-
Field Details
-
onActivityStateChanged
-
onDestroyed
-
executionDecorators
Decorators around all executions inside this SessionContext. These will be invoked when the Thread is already bound to the SessionContext, so SessionContext.current() will return this instance.
-
-
Constructor Details
-
SessionContext
public SessionContext(QualifiedUiSessionId sessionId, ClientInfo clientInfo, javax.servlet.http.HttpSession httpSession, UiCommandExecutor commandExecutor, UxServerContext serverContext, org.teamapps.icons.api.IconTheme iconTheme, com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper)
-
-
Method Details
-
current
-
currentOrNull
-
setCustomMessageBundleProvider
public void setCustomMessageBundleProvider(java.util.function.Function<java.util.Locale,java.util.ResourceBundle> provider) -
getLocale
public java.util.Locale getLocale() -
getMessageBundle
public java.util.ResourceBundle getMessageBundle() -
getLocalized
public java.lang.String getLocalized(java.lang.String key, java.lang.Object... parameters) -
isActive
public boolean isActive() -
handleActivityStateChangedInternal
public void handleActivityStateChangedInternal(boolean active) -
isDestroyed
public boolean isDestroyed() -
destroy
public void destroy() -
handleSessionDestroyedInternal
public void handleSessionDestroyedInternal() -
onDestroyed
-
queueCommand
public <RESULT> void queueCommand(org.teamapps.dto.UiCommand<RESULT> command, java.util.function.Consumer<RESULT> resultCallback) -
queueCommand
public <RESULT> void queueCommand(org.teamapps.dto.UiCommand<RESULT> command) -
getClientInfo
-
getHttpSession
public javax.servlet.http.HttpSession getHttpSession() -
flushCommands
@Deprecated public void flushCommands()Deprecated.no more needed. commands are sent as early as the client can handle them. -
getClientBackPressureInfo
-
getIconTheme
public org.teamapps.icons.api.IconTheme getIconTheme() -
setIconTheme
public void setIconTheme(org.teamapps.icons.api.IconTheme theme) -
createFileLink
public java.lang.String createFileLink(java.io.File file) -
createResourceLink
-
getBinaryResource
-
getUploadedFileByUuid
public java.io.File getUploadedFileByUuid(java.lang.String uuid) -
registerTemplate
-
registerTemplates
-
getTemplate
-
runWithContext
public java.util.concurrent.CompletableFuture<java.lang.Void> runWithContext(java.lang.Runnable runnable) -
runWithContext
public java.util.concurrent.CompletableFuture<java.lang.Void> runWithContext(java.lang.Runnable runnable, boolean forceEnqueue)- Parameters:
runnable-forceEnqueue- No synchronous execution! Enqueue this at the end of this SessionContext's work queue.- Returns:
-
addExecutionDecorator
Adds a decorator that gets invoked whenever a Thread is bound to this SessionContext. The decorator will be called right after the Thread is bound to this SessionContext, so SessionContext.current() will return this instance.- Parameters:
decorator-outer- Whether to add this decorator as outermost or innermost execution wrapper.
-
getConfiguration
-
setConfiguration
-
showPopupAtCurrentMousePosition
-
showPopup
-
getLanguageLocale
public java.util.Locale getLanguageLocale() -
getTimeZone
public java.time.ZoneId getTimeZone() -
resolveIcon
public java.lang.String resolveIcon(org.teamapps.icons.api.Icon icon) -
registerClientObject
-
unregisterClientObject
-
getClientObject
-
createResourceLink
-
showWindow
-
downloadFile
public void downloadFile(java.lang.String fileUrl, java.lang.String downloadFileName) -
registerBackgroundImage
public void registerBackgroundImage(java.lang.String id, java.lang.String image, java.lang.String blurredImage) -
setBackgroundImage
public void setBackgroundImage(java.lang.String id, int animationDuration) -
setBackgroundColor
public void setBackgroundColor(org.teamapps.common.format.Color color, int animationDuration) -
exitFullScreen
public void exitFullScreen() -
addRootComponent
-
addClientToken
public void addClientToken(java.lang.String token) -
removeClientToken
public void removeClientToken(java.lang.String token) -
clearClientTokens
public void clearClientTokens() -
showNotification
public void showNotification(Notification notification, NotificationPosition position, EntranceAnimation entranceAnimation, ExitAnimation exitAnimation) -
showNotification
-
showNotification
public void showNotification(org.teamapps.icons.api.Icon icon, java.lang.String caption) -
showNotification
public void showNotification(org.teamapps.icons.api.Icon icon, java.lang.String caption, java.lang.String description) -
showNotification
public void showNotification(org.teamapps.icons.api.Icon icon, java.lang.String caption, java.lang.String description, boolean dismissable, int displayTimeInMillis, boolean showProgress)
-