Module org.tentackle.fx.rdc
Package org.tentackle.fx.rdc.app
Class DesktopApplication<C extends org.tentackle.fx.FxController>
- java.lang.Object
-
- org.tentackle.app.AbstractApplication
-
- org.tentackle.app.AbstractClientApplication
-
- org.tentackle.fx.rdc.app.DesktopApplication<C>
-
- Type Parameters:
C- the main controller type
- All Implemented Interfaces:
org.tentackle.pdo.DomainContextProvider,org.tentackle.reflect.ClassMappedListener,org.tentackle.session.SessionProvider
public abstract class DesktopApplication<C extends org.tentackle.fx.FxController> extends org.tentackle.app.AbstractClientApplication implements org.tentackle.reflect.ClassMappedListenerJava FX tentackle desktop application.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description DesktopApplication(java.lang.String name, java.lang.String version)Creates an FX desktop application.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclassMapped(java.lang.String name, java.lang.Class<?> clazz)voidconfigureMainStage(javafx.stage.Stage mainStage)Configures and sets the main stage.protected voidconfigureModificationTracker()protected voidconfigurePreferences()protected voidconfigureSecurityManager()org.tentackle.pdo.DomainContextcreateDomainContext(org.tentackle.session.Session session)LoginFailedHandlercreateLoginFailedHandler(javafx.scene.Parent view, org.tentackle.session.SessionInfo sessionInfo)Creates the login failed handler.protected voidfinishStartup()java.lang.Class<? extends FxApplication>getApplicationClass()Gets the FX application class.static DesktopApplication<?>getDesktopApplication()Gets the running desktop application.FxApplicationgetFxApplication()Gets the FX application instance.
This is the instance of the class provided bygetApplicationClass().
The FX-application ususally provides a login-view and is responsible to spawn the main view after successful login.CgetMainController()Gets the main controller.abstract java.lang.Class<? extends C>getMainControllerClass()Gets the main-controller to be displayed initially.
Maintains the main-scene of the application.javafx.stage.StagegetMainStage()Gets the main stage.java.lang.Thread.UncaughtExceptionHandlergetUncaughtExceptionHandler()Gets the exception handler.protected voidinitializeScripting()protected booleanisInteractiveImpl()voidlogin(javafx.scene.Parent view, org.tentackle.session.SessionInfo sessionInfo)Performs the login and final startup of the application.voidregisterUncaughtExceptionHandler()Registers a handler for uncaught exceptions.voidsetFxApplication(FxApplication fxApplication)Sets the FX application instance.voidsetMainController(C mainController)Sets the main controller instance.voidshowApplicationStatus(java.lang.String msg, double progress)Displays a message during login.
Makes sure that the message is shown at least 100ms.voidshowApplicationStatus(java.lang.String msg, double progress, long minMillis)Displays a message during login.protected voidstartup()-
Methods inherited from class org.tentackle.app.AbstractClientApplication
createSessionInfo, updateSessionInfoAfterLogin
-
Methods inherited from class org.tentackle.app.AbstractApplication
activateStatistics, applyProperties, cleanup, configure, createSession, getCommandLine, getCreationTime, getDomainContext, getName, getProperties, getProperty, getRunningApplication, getSession, getSessionInfo, getUser, getUser, getVersion, initialize, isInteractive, isServer, isServerImpl, isSystemExitNecessaryToStop, logStackdump, register, setDomainContext, setProperties, setSessionInfo, start, start, stop, stop, toString, unregister
-
-
-
-
Method Detail
-
getDesktopApplication
public static DesktopApplication<?> getDesktopApplication()
Gets the running desktop application.- Returns:
- the application
-
isInteractiveImpl
protected boolean isInteractiveImpl()
- Overrides:
isInteractiveImplin classorg.tentackle.app.AbstractApplication
-
getMainControllerClass
public abstract java.lang.Class<? extends C> getMainControllerClass()
Gets the main-controller to be displayed initially.
Maintains the main-scene of the application.- Returns:
- the main controller class
-
configureMainStage
public void configureMainStage(javafx.stage.Stage mainStage)
Configures and sets the main stage.If overridden, make sure to invoke super.configureMainStage!
- Parameters:
mainStage- the main stage
-
getMainStage
public javafx.stage.Stage getMainStage()
Gets the main stage.- Returns:
- the stage
-
setMainController
public void setMainController(C mainController)
Sets the main controller instance.- Parameters:
mainController- the main controller
-
getMainController
public C getMainController()
Gets the main controller.- Returns:
- the main controller
-
createLoginFailedHandler
public LoginFailedHandler createLoginFailedHandler(javafx.scene.Parent view, org.tentackle.session.SessionInfo sessionInfo)
Creates the login failed handler.- Parameters:
view- the viewsessionInfo- the session info- Returns:
- the handler
-
login
public void login(javafx.scene.Parent view, org.tentackle.session.SessionInfo sessionInfo)Performs the login and final startup of the application.The method must hide the view when the main application windows is displayed after successful login.
Notice that this method is invoked from within the FX thread.
- Parameters:
view- the view to hide if login succeeded and application window visiblesessionInfo- the session info
-
getFxApplication
public FxApplication getFxApplication()
Gets the FX application instance.
This is the instance of the class provided bygetApplicationClass().
The FX-application ususally provides a login-view and is responsible to spawn the main view after successful login.- Returns:
- the FX application
-
setFxApplication
public void setFxApplication(FxApplication fxApplication)
Sets the FX application instance.- Parameters:
fxApplication- the FX application
-
getApplicationClass
public java.lang.Class<? extends FxApplication> getApplicationClass()
Gets the FX application class.- Returns:
- the fx application class
-
showApplicationStatus
public void showApplicationStatus(java.lang.String msg, double progress, long minMillis)Displays a message during login.- Parameters:
msg- the status messageprogress- the progress, 0 to disable, negative if infinite, 1.0 if doneminMillis- minimum milliseconds the previous message must have been visible
-
showApplicationStatus
public void showApplicationStatus(java.lang.String msg, double progress)Displays a message during login.
Makes sure that the message is shown at least 100ms.- Parameters:
msg- the status messageprogress- the progress, 0 to disable, negative if infinite, 1.0 if done
-
registerUncaughtExceptionHandler
public void registerUncaughtExceptionHandler()
Registers a handler for uncaught exceptions.
-
getUncaughtExceptionHandler
public java.lang.Thread.UncaughtExceptionHandler getUncaughtExceptionHandler()
Gets the exception handler.- Returns:
- the handler
-
createDomainContext
public org.tentackle.pdo.DomainContext createDomainContext(org.tentackle.session.Session session)
Overridden to create a DomainContext with a thread-local session.
In deskop client apps there are 2 threads using their own session:
- the FX thread
- the ModificationTracker thread
- Overrides:
createDomainContextin classorg.tentackle.app.AbstractApplication- Returns:
- the domain context
-
startup
protected void startup()
- Specified by:
startupin classorg.tentackle.app.AbstractApplication
-
configurePreferences
protected void configurePreferences()
- Overrides:
configurePreferencesin classorg.tentackle.app.AbstractApplication
-
configureSecurityManager
protected void configureSecurityManager()
- Overrides:
configureSecurityManagerin classorg.tentackle.app.AbstractApplication
-
configureModificationTracker
protected void configureModificationTracker()
- Overrides:
configureModificationTrackerin classorg.tentackle.app.AbstractApplication
-
finishStartup
protected void finishStartup()
- Overrides:
finishStartupin classorg.tentackle.app.AbstractApplication
-
initializeScripting
protected void initializeScripting()
- Overrides:
initializeScriptingin classorg.tentackle.app.AbstractApplication
-
classMapped
public void classMapped(java.lang.String name, java.lang.Class<?> clazz)Whenever a PDO class is used the first time, pre-compile all validator scripts in background, if any. This usually improves UX snappiness.
The default implementation adds a
Taskto theModificationTracker.- Specified by:
classMappedin interfaceorg.tentackle.reflect.ClassMappedListener
-
-