Module org.tentackle.fx.rdc
Package org.tentackle.fx.rdc.app
Class DesktopApplication<C extends 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:
DomainContextProvider,org.tentackle.reflect.ClassMappedListener,org.tentackle.session.SessionProvider
public abstract class DesktopApplication<C extends FxController>
extends AbstractClientApplication
implements org.tentackle.reflect.ClassMappedListener
Java FX tentackle desktop application.
- Author:
- harald
-
Field Summary
Fields inherited from class org.tentackle.app.AbstractApplication
DISABLE_MODIFICATION_TRACKER, DISABLE_SECURITY_MANAGER, ENABLE_STATISTICS, LOCALE, SCRIPTING -
Constructor Summary
ConstructorsConstructorDescriptionDesktopApplication(String name, String version) Creates an FX desktop application. -
Method Summary
Modifier and TypeMethodDescriptionvoidclassMapped(String name, Class<?> clazz) voidconfigureMainStage(javafx.stage.Stage mainStage) Configures and sets the main stage.protected voidprotected voidprotected voidcreateDomainContext(org.tentackle.session.Session session) createLoginFailedHandler(javafx.scene.Parent view, org.tentackle.session.SessionInfo sessionInfo) Creates the login failed handler.protected voidClass<? extends FxApplication>Gets the FX application class.static DesktopApplication<?>Gets the running desktop application.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.Gets the main controller.Gets the main-controller to be displayed initially.
Maintains the main-scene of the application.javafx.stage.StageGets the main stage.Gets the exception handler.protected voidprotected booleanvoidlogin(javafx.scene.Parent view, org.tentackle.session.SessionInfo sessionInfo) Performs the login and final startup of the application.voidRegisters a handler for uncaught exceptions.voidsetFxApplication(FxApplication fxApplication) Sets the FX application instance.voidsetMainController(C mainController) Sets the main controller instance.voidshowApplicationStatus(String msg, double progress) Displays a message during login.
Makes sure that the message is shown at least 100ms.voidshowApplicationStatus(String msg, double progress, long minMillis) Displays a message during login.protected voidstartup()Methods inherited from class org.tentackle.app.AbstractClientApplication
updateSessionInfoAfterLoginMethods inherited from class org.tentackle.app.AbstractApplication
activateStatistics, applyProperties, cleanup, configure, createSession, createSessionInfo, 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, unregisterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.tentackle.pdo.DomainContextProvider
on, op
-
Constructor Details
-
DesktopApplication
Creates an FX desktop application.- Parameters:
name- the application nameversion- the application version
-
-
Method Details
-
getDesktopApplication
Gets the running desktop application.- Returns:
- the application
-
isInteractiveImpl
protected boolean isInteractiveImpl()- Overrides:
isInteractiveImplin classAbstractApplication
-
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
Sets the main controller instance.- Parameters:
mainController- the main controller
-
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
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
Sets the FX application instance.- Parameters:
fxApplication- the FX application
-
getApplicationClass
Gets the FX application class.- Returns:
- the fx application class
-
showApplicationStatus
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
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
Gets the exception handler.- Returns:
- the handler
-
createDomainContext
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 classAbstractApplication- Returns:
- the domain context
-
startup
protected void startup()- Specified by:
startupin classAbstractApplication
-
configurePreferences
protected void configurePreferences()- Overrides:
configurePreferencesin classAbstractApplication
-
configureSecurityManager
protected void configureSecurityManager()- Overrides:
configureSecurityManagerin classAbstractApplication
-
configureModificationTracker
protected void configureModificationTracker()- Overrides:
configureModificationTrackerin classAbstractApplication
-
finishStartup
protected void finishStartup()- Overrides:
finishStartupin classAbstractApplication
-
initializeScripting
protected void initializeScripting()- Overrides:
initializeScriptingin classAbstractApplication
-
classMapped
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
-