Package com.storedobject.ui
Class Application
java.lang.Object
com.storedobject.vaadin.Application
com.storedobject.ui.Application
- All Implemented Interfaces:
- Device,- ErrorLogger,- RequiresApproval,- RunningLogic
- 
Nested Class SummaryNested Classes
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionApplication(ApplicationLayout applicationLayout) Application(ApplicationLayout applicationLayout, boolean singleLogicMode) Application(ApplicationLayout applicationLayout, boolean singleLogicMode, boolean abortOnLogicSwitch) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddContent(long fileId, AbstractContentGenerator content) voidaddMultiContent(long fileId, AbstractContentGenerator content) voidalert(LoginMessage message) voidvoidvoidDisplays an alert dialog with a specified caption, message, and icon.voidalertCountChanged(Object owner) This method is invoked whenever alter count changes for a particular owner.voidattached()Invoked whenever this application is attached to a UI.protected booleancanCreateMenu(Logic logic) protected booleancanCreateMenu(LogicGroup logicGroup) voidvoidclose()Close the application by closing all registered "resources".voidclose(int reason) Closes the application server connection with a specified reason.voidCloses the current session or process and redirects to the specified exit site.voidCloses the current session, releasing resources and optionally triggering client-side behaviors based on the provided parameters.voidcloseAllViews(boolean forShutdown) Close all current views by invokingView.abort()on each of them.voidCloses the application open.voidCloses the currently displayed wait message, if any.protected ApplicationEnvironmentAn "application environment" may be created to specify certain behaviours of the application.static ObjectcreateInstance(String propertyName, boolean showError, boolean raiseError) protected final ApplicationLayoutThis method is invoked only once to determine the layout of the application.protected Runnableprotected PostLoginvoiddetached()Invoked whenever this application is detached from its UI (it may get attached again to another UI if the user just refreshed the browser).voidFor internal use only.voiddownload(ContentProducer producer, Consumer<Long> informMe) voidvoidExit the application after showing a message.final voidforgotPassword(IdentityCheck identityCheck) final booleanforgotPassword(Login login) static Applicationget()Retrieves the current instance of the Application.getAlert()Retrieves a StyledBuilder object that represents an alert.Retrieves a StyledBuilder object that represents an alert, using the provided reference.Retrieves a StyledBuilder instance configured for a specific alert.Retrieves a configured alert using the provided alert handler and reference ID.com.vaadin.flow.component.ComponentRetrieves the alert button component.Retrieves the identifier of the biometric device associated with this instance.intThe reason for closing the application.Get ISO 2-character the country-code of the user in capital letters.static StringRetrieves the default country associated with the application.static CurrencyRetrieves the default currency used by the application.final Stringstatic MediaFileRetrieves the background image used for the home view.static StringgetLogicCaption(String defaultCaption) Get the caption of the currently running logic from the currentApplication.getLogicTitle(String defaultTitle) Get the title of the currently running logic.getLogin()This returns theLogininstance associated with application.final MessageViewerfinal StringgetName()getProgressBar(boolean indeterminate) Retrieves the TransactionManager associated with the server.protected Consumer<com.vaadin.flow.component.UI> Get UI configurator if any so that UI will be passed to it for handling any special configuration.static FilterProvidergetUserVisibility(String action) voidinformation(StyledBuilder appDetails) protected voidinit(com.vaadin.flow.server.VaadinRequest request) This method is invoked byApplicationViewclass.protected booleanThis method is invoked when the application comes up.booleanChecks if biometric authentication is available on the device.booleanChecks if biometric authentication is registered on the device.booleanIs the application theme currently in compact mode?booleanDetermines whether the application menu is currently opened.voidloadStyles(String textContentName) voidLog something (goes to the System error stream).voidLog something along with an exception (goes to the System error stream).final booleanfinal voidlogin()Handles the login process for the application.voidlogout()voidopenMenu()Triggers the action to open the aplication menu.voidvoidRemove the alert and speaker buttons from the toolbar.voidsetAbortOnLogicSwitch(boolean abortOnLogicSwitch) voidsetCompactTheme(boolean compactMode) Set the application theme in compact mode.voidvoidsetDeviceLayout(DeviceLayout layout) voidsetRunningLogic(Logic logic) voidsetServer(ApplicationServer server) voidsetSingleLogicMode(boolean singleLogicMode) booleanWhether this application supportsCloseableViewor not.voidDisplays the details of an object with the given identifier.voidview(Id objectId, String actionName, Consumer<StoredObject> action) Performs a view operation for the given object ID and action name, executing the provided action.voidDisplays the specified media file.voidDisplays the given media file in the appropriate view mode.voidview(StoredObject object) Displays or processes a view for the specified stored object.voidview(StoredObject object, ObjectViewerButton<?>... actionButtons) Displays the specified stored object with optional action buttons.voidview(StoredObject object, String actionName, Consumer<StoredObject> action) Displays the given stored object and performs an action based on the provided action name.voidview(String caption, ContentProducer producer, Consumer<Long> timeTracker, boolean windowMode) Displays a view with the specified caption and content producer.voidview(String caption, ContentProducer producer, Consumer<Long> timeTracker, boolean windowMode, com.vaadin.flow.component.Component... extraHeaderButtons) Displays content produced by the given ContentProducer in a specific view.voidDisplays the view for a specific object based on its ID with the provided caption.voidview(String caption, Id objectId, ObjectViewerButton<?>... actionButtons) Displays the view for the specified object with the given caption and action buttons.voidOpens a view for the specified object using the provided parameters.voidDisplays the media file with the given caption.voidDisplays the specified media file in the viewer with the given caption.voidview(String caption, StoredObject object) Displays the specified stored object with an optional caption.voidview(String caption, StoredObject object, ObjectViewerButton<?>... actionButtons) Displays the given stored object using the specified caption and action buttons.voidview(String caption, StoredObject object, String actionName, Consumer<StoredObject> action) Displays the given stored object using a specific viewer with an associated action.protected voidviewDetached(View view) This method is invoked whenever a runningViewis detached.Methods inherited from class com.storedobject.vaadin.Applicationaccess, addBrowserResizedListener, addContentResizedListener, clearAlert, clearAlerts, clearAlerts, createMenuItem, createMenuItem, createMenuItemGroup, error, error, execute, execute, get, getActiveView, getActiveViewCount, getActiveViews, getAlertCount, getAlerts, getCaption, getCommonAlert, getContentHeight, getContentWidth, getData, getDeviceHeight, getDeviceWidth, getEnvironment, getIdentifier, getIPAddress, getLinkName, getLocale, getMajorVersion, getMinorVersion, getPage, getQueryParameter, getUI, getURL, getViewFor, getWebBrowser, isFullScreenMode, isSpeakerOn, isSpeaking, loggedin, message, message, registerAlert, registerResource, removeData, removeData, removeQueryParameter, removeQueryParameters, setCaption, setData, setData, setLocale, setPollInterval, setPollInterval, setPostFocus, showAlerts, showAlerts, showNotification, showNotification, showNotification, showNotification, speak, startPolling, stopPolling, tray, tray, warning, warningMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.storedobject.core.Devicedownload, download, download, getDateFormat, getDefaultEntity, getDeviceHeight, getDeviceWidth, getIdentifier, getIPAddress, getLocale, getMajorVersion, getMinorVersion, setLocale, showNotification, showNotification, showNotification, showNotification, view, view, view, view, view, view, view, view, view, view, view, view, view, view, view
- 
Field Details- 
COLOR_ERROR- See Also:
 
- 
COLOR_SUCCESS- See Also:
 
- 
COLOR_INFO- See Also:
 
- 
COLOR_NORMAL- See Also:
 
 
- 
- 
Constructor Details- 
Applicationpublic Application()
- 
Application
- 
Application
- 
Applicationpublic Application(ApplicationLayout applicationLayout, boolean singleLogicMode, boolean abortOnLogicSwitch) 
 
- 
- 
Method Details- 
initprotected void init(com.vaadin.flow.server.VaadinRequest request) Description copied from class:ApplicationThis method is invoked byApplicationViewclass. If you want to override this method, make sure thatsuperis called.- Overrides:
- initin class- Application
- Parameters:
- request- Vaadin Request
 
- 
initDescription copied from class:ApplicationThis method is invoked when the application comes up.- Overrides:
- initin class- Application
- Parameters:
- link- The context path of the application.
- Returns:
- True if application can go ahead. Otherwise, an "Initialization failed" message is displayed.
 Default return value is true.
 
- 
getUIConfiguratorDescription copied from class:ApplicationGet UI configurator if any so that UI will be passed to it for handling any special configuration. This will be invoked beforeApplication.setUI(UI)is called.- Overrides:
- getUIConfiguratorin class- Application
- Returns:
- Default implementation returns null.
 
- 
getLogin
- 
setCompactThemepublic void setCompactTheme(boolean compactMode) Set the application theme in compact mode.- Parameters:
- compactMode- Whether to show compact mode or not.
 
- 
isCompactThemepublic boolean isCompactTheme()Is the application theme currently in compact mode?- Returns:
- True/false.
 
- 
supportsCloseableViewpublic boolean supportsCloseableView()Whether this application supportsCloseableViewor not. Applications may override the standard menu system, and the overridden menu system may not have support for displaying the appropriate "close" icon for closing the view. In such cases, this method should returnfalse.- Returns:
- True/false. Default is true.
 
- 
attachedpublic void attached()Description copied from class:ApplicationInvoked whenever this application is attached to a UI. Default implementation does nothing.- Overrides:
- attachedin class- Application
 
- 
loadStyles
- 
createLayoutDescription copied from class:ApplicationThis method is invoked only once to determine the layout of the application.- Specified by:
- createLayoutin class- Application
- Returns:
- Application layout.
 
- 
getName
- 
createEnvironmentDescription copied from class:ApplicationAn "application environment" may be created to specify certain behaviours of the application. If this method returnsnull, a default "environment" will be created.- Overrides:
- createEnvironmentin class- Application
- Returns:
- Returns null by default.
 
- 
setSingleLogicModepublic void setSingleLogicMode(boolean singleLogicMode) 
- 
setAbortOnLogicSwitchpublic void setAbortOnLogicSwitch(boolean abortOnLogicSwitch) 
- 
execute
- 
logoutpublic void logout()
- 
detachedpublic void detached()Description copied from class:ApplicationInvoked whenever this application is detached from its UI (it may get attached again to another UI if the user just refreshed the browser). The default implementation closes the application (Application.close()) after 20 seconds.- Overrides:
- detachedin class- Application
 
- 
getCloseReasonpublic int getCloseReason()The reason for closing the application. A negative number is returned if a redirection had happened while closing.0: Not closed 1, -1: Logged out by the user. 2, -2: Closed after showing a message. 3, -3: Application server session expired. 4, -4: Login failed and closed. 5, -5: Canceled from the login screen. 6, -6: Canceled while selecting the entity. 7, -7: Timed out during interactive session dialog. 8, -8: Closed by the user in the interactive session dialog. 9, -9: Closed while switching to another server/DB. 10, -10: MFA not verified. 100, -100: Programmatic close from unknown code. 101, -101: Programmatic redirection for authentication. - Returns:
- Reason code.
 
- 
closepublic void close()Description copied from class:ApplicationClose the application by closing all registered "resources". If the associated session is not closed and no other Application instance exists, it will also be closed.- Specified by:
- closein interface- Device
- Overrides:
- closein class- Application
 
- 
close
- 
closepublic void close(int reason) Closes the application server connection with a specified reason. Handles the logic for determining the exit site from global properties or layout configuration before initiating closure.- Parameters:
- reason- the integer code representing the reason for closing the connection
 
- 
closeCloses the current session, releasing resources and optionally triggering client-side behaviors based on the provided parameters. This method ensures proper cleanup and performs actions such as closing views, removing layout components, and optionally navigating to an external site.- Parameters:
- exitSite- The URL to navigate to when the session is closed. If null or empty, a default close behavior is executed.
- reason- The integer code representing the reason for the closure. This value influences internal handling of the close operation.
 
- 
exit
- 
closeAllViewspublic void closeAllViews(boolean forShutdown) Close all current views by invokingView.abort()on each of them.- Parameters:
- forShutdown- True should be passed if this is for a shutdown so that all internal timers will be removed.
 
- 
getRetrieves the current instance of the Application.- Returns:
- The current Application instance.
 
- 
getDefaultCurrencyRetrieves the default currency used by the application.- Returns:
- the default Currencyof the application
- Throws:
- SORuntimeException- if the default currency cannot be determined
 
- 
getDefaultCountryRetrieves the default country associated with the application. If an application instance is available, this method fetches and returns the country set in the application's transaction manager. If no application instance is available, an exception is thrown.- Returns:
- the default country as a string if available
- Throws:
- SORuntimeException- if the default country cannot be determined
 
- 
isBiometricAvailablepublic boolean isBiometricAvailable()Checks if biometric authentication is available on the device.- Returns:
- true if biometric authentication is available, false otherwise.
 
- 
isBiometricRegisteredpublic boolean isBiometricRegistered()Checks if biometric authentication is registered on the device.- Returns:
- true if biometric authentication is registered, false otherwise.
 
- 
getBiometricDeviceIdRetrieves the identifier of the biometric device associated with this instance.- Returns:
- the unique identifier of the biometric device
 
- 
disableBiometricpublic void disableBiometric()For internal use only.
- 
getTransactionManagerRetrieves the TransactionManager associated with the server.- Returns:
- the TransactionManager if the server is not null; otherwise, null.
 
- 
logDescription copied from class:ApplicationLog something (goes to the System error stream).- Specified by:
- login interface- Device
- Specified by:
- login interface- ErrorLogger
- Overrides:
- login class- Application
- Parameters:
- anything- Message to log, it could be a- Throwable
 
- 
logDescription copied from class:ApplicationLog something along with an exception (goes to the System error stream).- Specified by:
- login interface- Device
- Specified by:
- login interface- ErrorLogger
- Overrides:
- login class- Application
- Parameters:
- anything- Message to log, it could be a- Throwable
- error- Error to be printed
 
- 
setRunningLogic- Specified by:
- setRunningLogicin interface- RunningLogic
 
- 
getRunningLogic- Specified by:
- getRunningLogicin interface- RunningLogic
 
- 
getLogicTitleGet the title of the currently running logic. Note: A call to this method will reset it, and you cannot call it again to get it!- Parameters:
- defaultTitle- Default title to be returned if there is no current logic.
- Returns:
- Title of the logic or default title.
 
- 
getLogicCaptionGet the caption of the currently running logic from the currentApplication. Note: A call to this method will reset it, and you cannot call it again to get it!- Parameters:
- defaultCaption- Default caption to be returned if there is no current logic or application instance in the current context.
- Returns:
- Title of the logic or default caption.
 
- 
setServer
- 
getServer
- 
setDate
- 
parse- Specified by:
- parsein interface- Device
- Throws:
- SOException
 
- 
getMessageViewer- Specified by:
- getMessageViewerin interface- Device
 
- 
getDeviceType- Specified by:
- getDeviceTypein interface- Device
 
- 
getDisplayVersion
- 
getDriverIdentifier- Specified by:
- getDriverIdentifierin interface- Device
 
- 
getDeviceLayout- Specified by:
- getDeviceLayoutin interface- Device
 
- 
setDeviceLayout- Specified by:
- setDeviceLayoutin interface- Device
 
- 
viewDisplays the specified media file. By default, the media file is not set to fullscreen mode.- Parameters:
- mediaFile- the media file to be displayed
 
- 
view
- 
viewDisplays the given media file in the appropriate view mode.- Parameters:
- mediaFile- the media file to be viewed
- windowMode- indicates whether the media should be displayed in windowed mode
 
- 
viewDisplays the specified media file in the viewer with the given caption.- Parameters:
- caption- The title or description to be displayed alongside the media file.
- mediaFile- The media file that needs to be displayed.
- windowMode- Determines whether the viewer should open in windowed mode (true for windowed mode, false for fullscreen mode).
 
- 
view
- 
viewDisplays the details of an object with the given identifier.- Parameters:
- objectId- the identifier of the object to be viewed
 
- 
viewDisplays or processes a view for the specified stored object. If the view logic requires additional parameters, it defaults the first parameter to null.- Parameters:
- object- the stored object to be viewed or processed
 
- 
viewDisplays the specified stored object with an optional caption.- Parameters:
- caption- the caption to be displayed along with the stored object
- object- the stored object to be viewed
 
- 
viewOpens a view for the specified object using the provided parameters.- Parameters:
- caption- the caption or title to be displayed in the view
- objectId- the identifier of the object to be viewed
- actionName- the name of the action to be performed in the view
- action- a callback that provides a consumer for the stored object
 
- 
viewDisplays the view for the specified object with the given caption and action buttons.- Parameters:
- caption- The caption to be displayed for the view.
- objectId- The ID of the object to be viewed.
- actionButtons- Optional action buttons to be displayed with the view.
 
- 
viewPerforms a view operation for the given object ID and action name, executing the provided action.- Parameters:
- objectId- the unique identifier of the object to be viewed
- actionName- the name of the action to be performed
- action- a Consumer functional interface to execute the specific operation on the object
 
- 
viewDisplays the given stored object and performs an action based on the provided action name.- Parameters:
- object- the stored object to be viewed
- actionName- the name of the action to be executed
- action- a consumer that defines the behavior to execute on the stored object
 
- 
viewDisplays the specified stored object with optional action buttons.- Parameters:
- object- the stored object to be viewed
- actionButtons- an optional array of action buttons to be included in the view
 
- 
viewpublic void view(String caption, StoredObject object, String actionName, Consumer<StoredObject> action) Displays the given stored object using a specific viewer with an associated action.- Parameters:
- caption- the caption or title to be used for the view
- object- the stored object to be viewed
- actionName- the name of the action that can be performed on the object
- action- the action to be executed on the stored object
 
- 
viewDisplays the given stored object using the specified caption and action buttons.- Parameters:
- caption- the caption or title to display for the view
- object- the stored object that needs to be viewed
- actionButtons- optional action buttons to display along with the view
 
- 
viewpublic void view(String caption, ContentProducer producer, Consumer<Long> timeTracker, boolean windowMode) Displays a view with the specified caption and content producer. Tracks the render time and allows for an optional windowed mode.- Specified by:
- viewin interface- Device
- Parameters:
- caption- the title or label of the view to be displayed
- producer- the content producer responsible for generating the view's content
- timeTracker- a consumer to track and handle the rendering time in milliseconds
- windowMode- a boolean flag indicating whether the view should be displayed in windowed mode
 
- 
viewpublic void view(String caption, ContentProducer producer, Consumer<Long> timeTracker, boolean windowMode, com.vaadin.flow.component.Component... extraHeaderButtons) Displays content produced by the given ContentProducer in a specific view. Manages the display lifecycle, including the addition of header buttons and tracking view time. Supports windowed mode and asynchronous content generation.- Parameters:
- caption- The title or caption to be displayed for the view.
- producer- The ContentProducer responsible for generating content to be displayed.
- timeTracker- A Consumer that accepts a Long value representing the time spent in the view.
- windowMode- A boolean indicating whether the view should be displayed in window mode.
- extraHeaderButtons- Optional additional header buttons to be displayed in the view.
 
- 
closeWaitMessagepublic void closeWaitMessage()Closes the currently displayed wait message, if any. This method invokes the close operation on the instance of the waitMessage.
- 
download
- 
removeToolbarButtonspublic void removeToolbarButtons()Remove the alert and speaker buttons from the toolbar.
- 
getAlertButtonpublic com.vaadin.flow.component.Component getAlertButton()Retrieves the alert button component.- Returns:
- the Component representing the alert button
 
- 
alert
- 
alert
- 
alert
- 
alertDisplays an alert dialog with a specified caption, message, and icon.- Parameters:
- caption- the title text to be displayed on the alert dialog
- alert- the message content to be displayed in the alert dialog
- icon- the identifier for the icon to be shown in the alert dialog
 
- 
getAlertRetrieves a StyledBuilder object that represents an alert. Optionally, parameters can be provided to specify the type or content of the alert.- Returns:
- a StyledBuilder instance representing the alert.
 
- 
getAlertRetrieves a StyledBuilder instance configured for a specific alert.- Parameters:
- alertHandler- the handler object used to identify or process the alert
- Returns:
- a StyledBuilder instance for the specified alert
 
- 
getAlertRetrieves a configured alert using the provided alert handler and reference ID.- Parameters:
- alertHandler- the object responsible for handling alert configurations
- reference- the unique identifier associated with the alert
- Returns:
- a StyledBuilder instance representing the constructed alert
 
- 
getAlertRetrieves a StyledBuilder object that represents an alert, using the provided reference.- Parameters:
- reference- the identifier used to locate or configure the alert
- Returns:
- a StyledBuilder object associated with the specified reference
 
- 
alertCountChangedDescription copied from class:ApplicationThis method is invoked whenever alter count changes for a particular owner.- Overrides:
- alertCountChangedin class- Application
- Parameters:
- owner- Alert owner
 
- 
openMenupublic void openMenu()Triggers the action to open the aplication menu.
- 
closeMenupublic void closeMenu()Closes the application open.
- 
isMenuOpenedpublic boolean isMenuOpened()Determines whether the application menu is currently opened.- Returns:
- true if the menu is opened, false otherwise
 
- 
getHomeImageRetrieves the background image used for the home view.- Returns:
- a MediaFile representing the background image for the home view
 
- 
loginpublic final void login()Handles the login process for the application. The method performs the following main tasks: 1. Retrieves the application name and sets the screen caption with the application's name and display version unless the application name is unavailable or invalid. 2. Loads and executes the home view for the application if an appropriate HTML content or home background image is available. Otherwise, it proceeds with alternate views. 3. Displays a notice image if available, invoking the `view` method. 4. Initializes the login form, either by calling a custom login form or falling back to a predefined screen-based login method. This method ensures proper handling of missing resources or errors during execution by catching and safely ignoring exceptions. It is an entry point for managing the application's user authentication interface and sets up the required resources for a fresh login session.- Overrides:
- loginin class- Application
 
- 
createLogin
- 
createPostLogin
- 
viewDetachedDescription copied from class:ApplicationThis method is invoked whenever a runningViewis detached. (Sometimes, the application wants to take some action when a view is detached).- Overrides:
- viewDetachedin class- Application
- Parameters:
- view- View that is detached now.
 
- 
loggedIn
- 
forgotPassword- Specified by:
- forgotPasswordin interface- Device
 
- 
forgotPassword
- 
getUserVisibility
- 
getProgressBar
- 
getBusyIndicator
- 
information
- 
canCreateMenu
- 
canCreateMenu
- 
getCountryDescription copied from class:ApplicationGet ISO 2-character the country-code of the user in capital letters. (Examples: "US" for US, "IN" for India). This information is used for formatting the numbers inNumericField.- Overrides:
- getCountryin class- Application
- Returns:
- ISO country code. (Default is "US").
 
- 
checkDayEndpublic void checkDayEnd()
- 
addContent
- 
addMultiContent
- 
getSMSSender
- 
getMailSender
- 
createInstance
 
-