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 Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionApplication
(ApplicationLayout applicationLayout) Application
(ApplicationLayout applicationLayout, boolean singleLogicMode) Application
(ApplicationLayout applicationLayout, boolean singleLogicMode, boolean abortOnLogicSwitch) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addContent
(long fileId, AbstractContentGenerator content) void
addMultiContent
(long fileId, AbstractContentGenerator content) void
alert
(LoginMessage message) void
void
void
void
alertCountChanged
(Object owner) This method is invoked whenever alter count changes for a particular owner.void
attached()
Invoked whenever this application is attached to a UI.protected boolean
canCreateMenu
(Logic logic) protected boolean
canCreateMenu
(LogicGroup logicGroup) void
void
close()
Close the application by closing all registered "resources".void
close
(int reason) void
void
void
closeAllViews
(boolean forShutdown) Close all current views by invokingView.abort()
on each of them.void
void
protected ApplicationEnvironment
An "application environment" may be created to specify certain behaviours of the application.static Object
createInstance
(String propertyName, boolean showError, boolean raiseError) protected final ApplicationLayout
This method is invoked only once to determine the layout of the application.protected Runnable
protected PostLogin
void
detached()
Invoked whenever this application is detached from its UI (it may get attached again to another UI if the user just refreshed the browser).void
For internal use only.void
download
(ContentProducer producer, Consumer<Long> informMe) void
void
Exit the application after showing a message.final void
forgotPassword
(IdentityCheck identityCheck) final boolean
forgotPassword
(Login login) static Application
get()
getAlert()
com.vaadin.flow.component.Component
int
The reason for closing the application.Get ISO 2-character the country-code of the user in capital letters.static String
static Currency
final String
static MediaFile
static String
getLogicCaption
(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 return theLogin
instance associated with application.final MessageViewer
final String
getName()
getProgressBar
(boolean indeterminate) 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 FilterProvider
getUserVisibility
(String action) void
information
(StyledBuilder appDetails) protected void
init
(com.vaadin.flow.server.VaadinRequest request) This method is invoked byApplicationView
class.protected boolean
This method is invoked when the application comes up.boolean
boolean
boolean
Is the application theme currently in compact mode?boolean
void
loadStyles
(String textContentName) void
Log something (goes to the System error stream).void
Log something along with an exception (goes to the System error stream).final boolean
final void
login()
This method can be overridden to accept login credentials andApplication.loggedin()
must be called if successfully logged in.void
logout()
void
openMenu()
void
void
Remove the alert and speaker buttons from the toolbar.void
setAbortOnLogicSwitch
(boolean abortOnLogicSwitch) void
setCompactTheme
(boolean compactMode) Set the application theme in compact mode.void
void
setDeviceLayout
(DeviceLayout layout) void
setRunningLogic
(Logic logic) void
setServer
(ApplicationServer server) void
setSingleLogicMode
(boolean singleLogicMode) boolean
Whether this application supportsCloseableView
or not.void
void
view
(Id objectId, String actionName, Consumer<StoredObject> action) void
void
void
view
(StoredObject object) void
view
(StoredObject object, String actionName, Consumer<StoredObject> action) void
view
(String caption, ContentProducer producer, Consumer<Long> timeTracker, boolean windowMode) void
view
(String caption, ContentProducer producer, Consumer<Long> timeTracker, boolean windowMode, com.vaadin.flow.component.Component... extraHeaderButtons) void
void
void
void
void
view
(String caption, StoredObject object) void
view
(String caption, StoredObject object, String actionName, Consumer<StoredObject> action) protected void
viewDetached
(View view) This method is invoked whenever a runningView
is detached.Methods inherited from class com.storedobject.vaadin.Application
access, 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, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.storedobject.core.Device
download, 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
-
Application
public Application() -
Application
-
Application
-
Application
public Application(ApplicationLayout applicationLayout, boolean singleLogicMode, boolean abortOnLogicSwitch)
-
-
Method Details
-
init
protected void init(com.vaadin.flow.server.VaadinRequest request) Description copied from class:Application
This method is invoked byApplicationView
class. If you want to override this method, make sure thatsuper
is called.- Overrides:
init
in classApplication
- Parameters:
request
- Vaadin Request
-
init
Description copied from class:Application
This method is invoked when the application comes up.- Overrides:
init
in classApplication
- 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
.
-
getUIConfigurator
Description copied from class:Application
Get 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:
getUIConfigurator
in classApplication
- Returns:
- Default implementation returns
null
.
-
getLogin
-
setCompactTheme
public void setCompactTheme(boolean compactMode) Set the application theme in compact mode.- Parameters:
compactMode
- Whether to show compact mode or not.
-
isCompactTheme
public boolean isCompactTheme()Is the application theme currently in compact mode?- Returns:
- True/false.
-
supportsCloseableView
public boolean supportsCloseableView()Whether this application supportsCloseableView
or not. Applications may override the standard menu system and the overridden menu system may not have support for displaying appropriate "close" icon for closing the view. In such cases, this method should returnfalse
.- Returns:
- True/false. Default is true.
-
attached
public void attached()Description copied from class:Application
Invoked whenever this application is attached to a UI. Default implementation does nothing.- Overrides:
attached
in classApplication
-
loadStyles
-
createLayout
Description copied from class:Application
This method is invoked only once to determine the layout of the application.- Specified by:
createLayout
in classApplication
- Returns:
- Application layout.
-
getName
-
createEnvironment
Description copied from class:Application
An "application environment" may be created to specify certain behaviours of the application. If this method returnsnull
, a default "environment" will be created.- Overrides:
createEnvironment
in classApplication
- Returns:
- Returns null by default.
-
setSingleLogicMode
public void setSingleLogicMode(boolean singleLogicMode) -
setAbortOnLogicSwitch
public void setAbortOnLogicSwitch(boolean abortOnLogicSwitch) -
execute
-
logout
public void logout() -
detached
public void detached()Description copied from class:Application
Invoked 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:
detached
in classApplication
-
getCloseReason
public 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: Cancelled from the login screen. 6, -6: Cancelled 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.
-
close
public void close()Description copied from class:Application
Close 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:
close
in interfaceDevice
- Overrides:
close
in classApplication
-
close
-
close
public void close(int reason) -
close
-
exit
-
closeAllViews
public 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.
-
get
-
getDefaultCurrency
-
getDefaultCountry
-
isBiometricAvailable
public boolean isBiometricAvailable() -
isBiometricRegistered
public boolean isBiometricRegistered() -
getBiometricDeviceId
-
disableBiometric
public void disableBiometric()For internal use only. -
getTransactionManager
-
log
Description copied from class:Application
Log something (goes to the System error stream).- Specified by:
log
in interfaceDevice
- Specified by:
log
in interfaceErrorLogger
- Overrides:
log
in classApplication
- Parameters:
anything
- Message to log, it could be aThrowable
-
log
Description copied from class:Application
Log something along with an exception (goes to the System error stream).- Specified by:
log
in interfaceDevice
- Specified by:
log
in interfaceErrorLogger
- Overrides:
log
in classApplication
- Parameters:
anything
- Message to log, it could be aThrowable
error
- Error to be printed
-
setRunningLogic
- Specified by:
setRunningLogic
in interfaceRunningLogic
-
getRunningLogic
- Specified by:
getRunningLogic
in interfaceRunningLogic
-
getLogicTitle
Get the title of the currently running logic. Note: A call to this method will reset it, and you can not 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.
-
getLogicCaption
Get the caption of the currently running logic from the currentApplication
. Note: A call to this method will reset it, and you can not 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:
parse
in interfaceDevice
- Throws:
SOException
-
getMessageViewer
- Specified by:
getMessageViewer
in interfaceDevice
-
getDeviceType
- Specified by:
getDeviceType
in interfaceDevice
-
getDisplayVersion
-
getDriverIdentifier
- Specified by:
getDriverIdentifier
in interfaceDevice
-
getDeviceLayout
- Specified by:
getDeviceLayout
in interfaceDevice
-
setDeviceLayout
- Specified by:
setDeviceLayout
in interfaceDevice
-
view
-
view
-
view
-
view
-
view
-
view
-
view
-
view
-
view
-
view
-
view
-
view
public void view(String caption, StoredObject object, String actionName, Consumer<StoredObject> action) -
view
-
view
public void view(String caption, ContentProducer producer, Consumer<Long> timeTracker, boolean windowMode, com.vaadin.flow.component.Component... extraHeaderButtons) -
closeWaitMessage
public void closeWaitMessage() -
download
-
removeToolbarButtons
public void removeToolbarButtons()Remove the alert and speaker buttons from the toolbar. -
getAlertButton
public com.vaadin.flow.component.Component getAlertButton() -
alert
-
alert
-
alert
-
alert
-
getAlert
-
getAlert
-
getAlert
-
getAlert
-
alertCountChanged
Description copied from class:Application
This method is invoked whenever alter count changes for a particular owner.- Overrides:
alertCountChanged
in classApplication
- Parameters:
owner
- Alert owner
-
openMenu
public void openMenu() -
closeMenu
public void closeMenu() -
isMenuOpened
public boolean isMenuOpened() -
getHomeImage
-
login
public final void login()Description copied from class:Application
This method can be overridden to accept login credentials andApplication.loggedin()
must be called if successfully logged in.- Overrides:
login
in classApplication
-
createLogin
-
createPostLogin
-
viewDetached
Description copied from class:Application
This method is invoked whenever a runningView
is detached. (Sometimes, the application wants to take some action when a view is detached).- Overrides:
viewDetached
in classApplication
- Parameters:
view
- View that is detached now.
-
loggedIn
-
forgotPassword
- Specified by:
forgotPassword
in interfaceDevice
-
forgotPassword
-
getUserVisibility
-
getProgressBar
-
getBusyIndicator
-
information
-
canCreateMenu
-
canCreateMenu
-
getCountry
Description copied from class:Application
Get 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:
getCountry
in classApplication
- Returns:
- ISO country code. (Default is "US").
-
checkDayEnd
public void checkDayEnd() -
addContent
-
addMultiContent
-
getSMSSender
-
getMailSender
-
createInstance
-