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
Modifier and TypeFieldDescriptionstatic final String
protected org.springframework.context.ApplicationContext
protected BackgroundTaskManager
static final String
static final String
static final String
static final String
protected AppCookies
protected CoreProperties
static final String
protected ExceptionHandlers
protected MessageTools
protected javax.servlet.ServletContext
protected UiSettingsCache
protected ThemeConstants
protected ThemeConstantsRepository
protected UiProperties
protected UiThemeProperties
static final String
protected WindowConfig
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBackgroundTask
(Future task) void
void
protected void
applyTheme
(String appWindowTheme) void
protected void
void
closeWindowsInternal
(boolean fireEvent) Removes all windows from all UIs and firesCloseWindowsInternalEvent
application event.void
void
Called on each browser tab initialization.protected void
void
protected String
int
getCookieMaxAge
(String name) getCookieValue
(String name) static App
Deprecated.protected void
Called when the first UI of the session is initialized.protected void
initExceptionHandlers
(boolean isConnected) Initializes exception handlers immediately after login and logout.static boolean
isBound()
protected ThemeConstants
abstract void
logout()
Try to perform logout.void
navigateTo
(String topLevelWindowId) Deprecated.void
Called from heartbeat request.protected void
protected void
void
Removes all windows from all UIs.protected void
removeAllWindows
(List<AppUI> uis) Removes all windows in the givenuis
.void
removeBackgroundTask
(Future task) void
removeCookie
(String name) protected Locale
resolveLocale
(Locale requestLocale) protected abstract String
void
void
setUserAppTheme
(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
App
instance is currently bound and can be safely obtained bygetInstance()
-
getWindowManager
Deprecated.Get screens API fromAppUI
instead.- 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
-AppUI
instances
-
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 firesCloseWindowsInternalEvent
application event.- Parameters:
fireEvent
- fire event or not
-
getContextPathName
-
clearSettingsCache
protected void clearSettingsCache() -
forceRefreshUIsExceptCurrent
public void forceRefreshUIsExceptCurrent()
-
AppUI
instead.