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.session.SessionProvider
public abstract class DesktopApplication<C extends org.tentackle.fx.FxController> extends org.tentackle.app.AbstractClientApplicationJava FX tentackle desktop application.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description DesktopApplication(java.lang.String name)Creates an FX desktop application.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.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.protected voidstartup()-
Methods inherited from class org.tentackle.app.AbstractClientApplication
detectJNLP, isDeployedByJNLP, isServerImpl, updateSessionInfoAfterLogin
-
Methods inherited from class org.tentackle.app.AbstractApplication
cleanup, configure, createSession, createSessionInfo, getCommandLine, getCreationTime, getDomainContext, getName, getProperties, getProperty, getRunningApplication, getSession, getSessionInfo, getUser, getUser, initialize, isServer, isSystemExitNecessaryToStop, logStackdump, register, setDomainContext, setName, setProperties, setSessionInfo, start, start, stop, stop, toString, unregister
-
-
-
-
Method Detail
-
getDesktopApplication
public static DesktopApplication<?> getDesktopApplication()
Gets the running desktop application.- Returns:
- the application
-
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)Displays a message during login.- 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
-
-