Package io.jmix.ui
Class App
java.lang.Object
io.jmix.ui.App
- Direct Known Subclasses:
JmixApp
Central class of the web application. An instance of this class is created for each client's session and is bound
to
Use
VaadinSession.
Use
getInstance() static method to obtain the reference to the current App instance.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected org.springframework.context.ApplicationContextprotected BackgroundTaskManagerstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected AppCookiesprotected CorePropertiesstatic final Stringprotected ExceptionHandlersprotected MessageToolsprotected javax.servlet.ServletContextprotected UiSettingsCacheprotected ThemeConstantsprotected ThemeConstantsRepositoryprotected UiPropertiesprotected UiThemePropertiesstatic final Stringprotected WindowConfig -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBackgroundTask(Future task) voidvoidprotected voidapplyTheme(String appWindowTheme) voidprotected voidvoidcloseWindowsInternal(boolean fireEvent) Removes all windows from all UIs and firesCloseWindowsInternalEventapplication event.voidvoidCalled on each browser tab initialization.protected voidvoidprotected StringintgetCookieMaxAge(String name) getCookieValue(String name) static AppDeprecated.protected voidCalled when the first UI of the session is initialized.protected voidinitExceptionHandlers(boolean isConnected) Initializes exception handlers immediately after login and logout.static booleanisBound()protected ThemeConstantsabstract voidlogout()Try to perform logout.voidnavigateTo(String topLevelWindowId) Deprecated.voidCalled from heartbeat request.protected voidprotected voidvoidRemoves all windows from all UIs.protected voidremoveAllWindows(List<AppUI> uis) Removes all windows in the givenuis.voidremoveBackgroundTask(Future task) voidremoveCookie(String name) protected LocaleresolveLocale(Locale requestLocale) protected abstract StringvoidvoidsetUserAppTheme(String themeName)
-
Field Details
-
DEFAULT_THEME_NAME
- See Also:
-
USER_SESSION_ATTR
- See Also:
-
APP_THEME_COOKIE_PREFIX
- See Also:
-
COOKIE_LOCALE
- See Also:
-
COOKIE_REMEMBER_ME
- See Also:
-
COOKIE_LOGIN
- See Also:
-
COOKIE_PASSWORD
- See Also:
-
exceptionHandlers
-
coreProperties
-
servletContext
@Autowired(required=false) protected javax.servlet.ServletContext servletContext -
windowConfig
-
themeConstantsRepository
-
messageTools
-
settingsCache
-
applicationContext
@Autowired protected org.springframework.context.ApplicationContext applicationContext -
uiProperties
-
uiThemeProperties
-
cookies
-
backgroundTaskManager
-
themeConstants
-
-
Constructor Details
-
App
public App()
-
-
Method Details
-
loadTheme
-
applyTheme
-
initExceptionHandlers
protected void initExceptionHandlers(boolean isConnected) Initializes exception handlers immediately after login and logout. Can be overridden in descendants to manipulate exception handlers programmatically.- Parameters:
isConnected- true after login, false after logout
-
getThemeConstants
-
getAppUIs
-
loginOnStart
public abstract void loginOnStart() -
init
Called when the first UI of the session is initialized. -
resolveLocale
-
createTopLevelWindow
Called on each browser tab initialization. -
routeTopLevelWindowId
-
createTopLevelWindow
public void createTopLevelWindow() -
onHeartbeat
public void onHeartbeat()Called from heartbeat request.
Used for ping middleware session and show session messages -
getInstance
- Returns:
- Current App instance. Can be invoked anywhere in application code.
- Throws:
IllegalStateException- if no application instance is bound to the currentVaadinSession
-
isBound
public static boolean isBound()- Returns:
- true if an
Appinstance is currently bound and can be safely obtained bygetInstance()
-
getWindowManager
Deprecated.Get screens API fromAppUIinstead.- Returns:
- WindowManagerImpl instance or null if the current UI has no MainWindow
-
getExceptionHandlers
-
getCookieValue
-
getCookieMaxAge
-
addCookie
-
addCookie
-
removeCookie
-
getLocale
-
setLocale
-
setUserAppTheme
-
addBackgroundTask
-
removeBackgroundTask
-
cleanupBackgroundTasks
public void cleanupBackgroundTasks() -
removeAllWindows
public void removeAllWindows()Removes all windows from all UIs. -
removeAllWindows
Removes all windows in the givenuis.- Parameters:
uis-AppUIinstances
-
logout
Try to perform logout. If there are unsaved changes in opened windows then logout will not be performed and unsaved changes dialog will appear.- Returns:
- operation result object
-
performStandardLogout
-
performForceLogout
protected void performForceLogout() -
forceLogout
protected void forceLogout() -
closeWindowsInternal
public void closeWindowsInternal(boolean fireEvent) Removes all windows from all UIs and firesCloseWindowsInternalEventapplication event.- Parameters:
fireEvent- fire event or not
-
getContextPathName
-
clearSettingsCache
protected void clearSettingsCache() -
forceRefreshUIsExceptCurrent
public void forceRefreshUIsExceptCurrent()
-
AppUIinstead.