Class SessionContext
java.lang.Object
org.teamapps.ux.session.SessionContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ExecutionDecoratorStackDecorators around all executions inside this SessionContext.final Event<UiSessionActivityState> final Event<CustomMessageEvent> final Event<UiSessionClosingReason> final Event<KeyboardEvent> final Event<NavigationStateChangeEvent> -
Constructor Summary
ConstructorsConstructorDescriptionSessionContext(UiSession uiSession, ExecutorService sessionExecutor, ClientInfo clientInfo, SessionConfiguration sessionConfiguration, jakarta.servlet.http.HttpSession httpSession, UxServerContext serverContext, SessionIconProvider iconProvider, String navigationPathPrefix, jakarta.ws.rs.ext.ParamConverterProvider navigationParamConverterProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClientToken(String token) voidaddExecutionDecorator(ExecutionDecorator decorator, boolean outer) Adds a decorator that gets invoked whenever a Thread is bound to this SessionContext.voidaddIconBundle(IconBundle iconBundle) voidaddRootComponent(String containerElementSelector, Component component) addRootPanel(String containerElementSelector) voidaddRootPanel(String containerElementSelector, Component rootPanel) voidchangeNavigationHistoryState(String pathWithQueryParams, boolean fireEvent, NavigationHistoryOperation operation) voidvoidRemoves all decorators.static WindowcreateDefaultSessionMessageWindow(String title, String message, String refreshButtonCaption, String cancelButtonCaption) createFileLink(File file) createResourceLink(Resource resource) createResourceLink(Resource resource, String uniqueIdentifier) static SessionContextcurrent()static SessionContextvoiddestroy()voidvoidvoidvoidvoidgetBinaryResource(int resourceId) getClientObject(String clientObjectId) jakarta.servlet.http.HttpSessionIcon<?, ?> getLocalized(String key, Object... parameters) getName()jakarta.ws.rs.ext.ParamConverterProvidergetState()getTemplate(String id) com.ibm.icu.util.ULocalegetUploadedFileByUuid(String uuid) voidvoidhandleStaticEvent(UiEvent event) booleanisActive()booleanvoidnavigateBack(int steps) voidnavigateForward(int steps) Same asonDestroyedbut mockable.voidpushNavigationHistoryState(String pathWithQueryParams, boolean fireEvent) Pushes a new entry (URL) to the browser's navigation history without reloading the site.voidqueueCommand(UiCommand<?> command) <RESULT> voidqueueCommand(UiCommand<RESULT> command, Consumer<RESULT> resultCallback) voidregisterBackgroundImage(String id, String image, String blurredImage) voidregisterClientObject(ClientObject clientObject) registerTemplate(String id, Template template) voidregisterTemplates(Map<String, Template> templates) voidremoveClientToken(String token) voidremoveExecutionDecorator(ExecutionDecorator decorator) Removes the specified execution decorator.voidreplaceNavigationHistoryState(String pathWithQueryParams, boolean fireEvent) Same aspushNavigationHistoryState(String, boolean), except that it replaces the current browser history entry (URL).resolveIcon(Icon icon) voidroute()runWithContext(Runnable runnable) runWithContext(Runnable runnable, boolean forceEnqueue) <R> CompletableFuture<R> runWithContext(Callable<R> runnable) <R> CompletableFuture<R> runWithContext(Callable<R> callable, boolean forceEnqueue) voidsetBackgroundColor(Color color, int animationDuration) voidsetBackgroundImage(String id, int animationDuration) voidsetConfiguration(SessionConfiguration config) <I extends Icon<I,S>, S>
voidsetDefaultStyleForIconClass(Class<I> iconClass, S defaultStyle) voidsetFavicon(String url) voidsetFavicon(Icon<?, ?> icon) voidsetFavicon(Resource resource) voidsetGlobalKeyEventsEnabled(boolean unmodified, boolean modifiedWithAltKey, boolean modifiedWithCtrlKey, boolean modifiedWithMetaKey, boolean includeRepeats, boolean keyDown, boolean keyUp) voidvoidvoidsetRoutingMode(RoutingMode routingMode) voidsetSessionErrorWindow(Window sessionErrorWindow) voidsetSessionExpiredWindow(Window sessionExpiredWindow) voidsetSessionTerminatedWindow(Window sessionTerminatedWindow) voidvoidsetTranslationProvider(TranslationProvider translationProvider) voidsetULocale(com.ibm.icu.util.ULocale locale) voidshowDefaultBackground(int animationDuration) voidshowNotification(Icon icon, String caption) voidshowNotification(Icon icon, String caption, String description) voidshowNotification(Icon icon, String caption, String description, boolean dismissable, int displayTimeInMillis, boolean showProgress) voidshowNotification(Notification notification, NotificationPosition position) voidshowNotification(Notification notification, NotificationPosition position, EntranceAnimation entranceAnimation, ExitAnimation exitAnimation) voidvoidvoidshowWindow(Window window, int animationDuration) subscribeToCustomMessages(String type, Consumer<CustomMessageEvent> handler) toString()voidunregisterClientObject(ClientObject clientObject) void
-
Field Details
-
onGlobalKeyEventOccurred
-
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. -
onCustomMessage
-
-
Constructor Details
-
SessionContext
public SessionContext(UiSession uiSession, ExecutorService sessionExecutor, ClientInfo clientInfo, SessionConfiguration sessionConfiguration, jakarta.servlet.http.HttpSession httpSession, UxServerContext serverContext, SessionIconProvider iconProvider, String navigationPathPrefix, jakarta.ws.rs.ext.ParamConverterProvider navigationParamConverterProvider)
-
-
Method Details
-
getCurrentLocation
-
getBaseRouter
-
getRouter
-
current
-
currentOrNull
-
setTranslationProvider
-
getTranslationProvider
-
addIconBundle
-
getIcon
-
getULocale
public com.ibm.icu.util.ULocale getULocale() -
getLocale
-
setLocale
-
setULocale
public void setULocale(com.ibm.icu.util.ULocale locale) -
getLocalized
-
isActive
public boolean isActive() -
getState
-
isDestroyed
public boolean isDestroyed() -
destroy
public void destroy() -
queueCommand
-
queueCommand
-
getClientInfo
-
getHttpSession
public jakarta.servlet.http.HttpSession getHttpSession() -
getClientBackPressureInfo
-
createFileLink
-
createResourceLink
-
getBinaryResource
-
getUploadedFileByUuid
-
registerTemplate
-
registerTemplates
-
getTemplate
-
runWithContext
-
runWithContext
- Parameters:
runnable-forceEnqueue- No synchronous execution! Enqueue this at the end of this SessionContext's work queue.
-
runWithContext
-
runWithContext
-
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.
-
removeExecutionDecorator
Removes the specified execution decorator. -
clearExecutionDecorators
public void clearExecutionDecorators()Removes all decorators. -
getConfiguration
-
setConfiguration
-
showPopupAtCurrentMousePosition
-
showPopup
-
getTimeZone
-
getIconProvider
-
setDefaultStyleForIconClass
-
resolveIcon
-
registerClientObject
-
unregisterClientObject
-
getClientObject
-
createResourceLink
-
showWindow
-
download
-
download
-
download
-
download
-
registerBackgroundImage
-
setBackgroundImage
-
showDefaultBackground
public void showDefaultBackground(int animationDuration) -
setBackgroundColor
-
exitFullScreen
public void exitFullScreen() -
addRootComponent
-
addRootPanel
-
addRootPanel
-
addRootPanel
-
addClientToken
-
removeClientToken
-
clearClientTokens
public void clearClientTokens() -
showNotification
public void showNotification(Notification notification, NotificationPosition position, EntranceAnimation entranceAnimation, ExitAnimation exitAnimation) -
showNotification
-
showNotification
-
showNotification
-
showNotification
-
setSessionExpiredWindow
-
setSessionErrorWindow
-
setSessionTerminatedWindow
-
createDefaultSessionMessageWindow
-
requestWakeLock
-
goToUrl
-
setFavicon
-
setFavicon
-
setFavicon
-
setTitle
-
setGlobalKeyEventsEnabled
public void setGlobalKeyEventsEnabled(boolean unmodified, boolean modifiedWithAltKey, boolean modifiedWithCtrlKey, boolean modifiedWithMetaKey, boolean includeRepeats, boolean keyDown, boolean keyUp) -
getSessionId
-
handleStaticEvent
-
route
public void route() -
getAsUiSessionListenerInternal
-
setName
-
getName
-
getRoutingParamConverterProvider
public jakarta.ws.rs.ext.ParamConverterProvider getRoutingParamConverterProvider() -
getUiSessionStats
-
toString
-
getRoutingMode
-
setRoutingMode
-
onDestroyed
Same asonDestroyedbut mockable. -
subscribeToCustomMessages
-