public abstract class DesktopApplication extends AbstractApplication
start(java.lang.String[]).
To shutdown gracefully, application should invokd stop().
At minimum, the method doCreateWindow() must be implemented.
The subclass just needs to provide a main-method, for example:
public static void main(String args[]) {
new MyAbstractApplication().start(args);
}
| Constructor and Description |
|---|
DesktopApplication(String name,
Icon logo)
Creates a swing desktop application.
|
| Modifier and Type | Method and Description |
|---|---|
void |
changeLookAndFeel(String name)
Changes the look and feel.
|
protected void |
configureModificationTracker() |
protected void |
configurePreferences()
Installs the preferences backend.
The option "systemprefs" forces usage of system preferences only. |
DomainContext |
createDomainContext(org.tentackle.session.Session session) |
LoginDialog |
createLoginDialog(org.tentackle.session.SessionInfo sessionInfo,
Icon logo)
Creates the login dialog.
|
JMenu |
createLookAndFeelMenu()
Creates a menu to select the look and feel.
|
protected void |
doConfigureApplication()
Do anything what's necessary after the connection has been established.
|
protected abstract FormWindow |
doCreateWindow()
Creates the top level window.
The method must not setVisible(true) and is executed from within the EventQueue. |
protected void |
doFinishStartup()
Finishes the startup.
Invoked after all has been displayed. |
protected void |
doInitializeGUI()
Initializes the GUI.
The default implementation initializes the Tentackle-EventQueue. |
protected DomainContext |
doLogin()
Connects to the database backend (or application server).
|
protected void |
doShowWindow()
Shows the window.
|
protected void |
doStop(int exitValue)
Terminates the application gracefully.
|
protected void |
doStop(int exitValue,
Exception ex)
Terminates the application gracefully.
|
org.tentackle.misc.CommandLine |
getCommandLine()
Gets the command line.
|
static DesktopApplication |
getDesktopApplication()
Gets the running desktop application.
|
Icon |
getLogo()
Gets the logo.
|
FormWindow |
getWindow()
Gets the application's window.
|
protected void |
installLookAndFeels()
Installs the available look and feels.
|
boolean |
isServer() |
void |
setLookAndFeel(String name)
Sets the look and feel.
|
<T extends PersistentDomainObject<T>> |
showEditDialog(Class<T> clazz)
Brings up a non-modal edit dialog for a given class.
|
<T extends PersistentDomainObject<T>> |
showEditDialog(Component comp,
Class<T> clazz,
boolean modal)
Brings up an edit dialog for a given class.
|
<T extends PersistentDomainObject<T>> |
showEditDialog(Component comp,
T object,
boolean modal)
Brings up an edit dialog for a given object.
|
void |
showLoginStatus(String msg)
Displays a message during login.
|
<T extends PersistentDomainObject<T>> |
showSearchDialog(Class<T> clazz)
Brings up a search dialog for a given class.
|
<T extends PersistentDomainObject<T>> |
showSearchDialog(FormWindow w,
Class<T> clazz)
Brings up a search dialog for a given class.
|
void |
start(String[] args)
Launches the application.
|
void |
stop()
Gracefully terminates the application.
|
applyProperties, configureSecurityManager, createSession, createSessionInfo, deregisterJdbcDrivers, detectContainer, detectJNLP, doInitialize, getCreationTime, getDomainContext, getName, getProperties, getProperty, getRunningApplication, getSession, getSessionInfo, getUser, getUser, isDeployedByJNLP, isRunningInContainer, logStackdump, register, setDomainContext, setName, setProperties, setSessionInfo, toString, unregister, updateSessionInfoAfterLoginclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waiton, oppublic static DesktopApplication getDesktopApplication()
public boolean isServer()
isServer in class AbstractApplicationprotected void configureModificationTracker()
configureModificationTracker in class AbstractApplicationpublic 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:
createDomainContext in class AbstractApplicationpublic void start(String[] args)
args - the arguments (usually from commandline)public void stop()
public org.tentackle.misc.CommandLine getCommandLine()
public Icon getLogo()
public FormWindow getWindow()
public void setLookAndFeel(String name)
name - the name of the look and feelpublic void changeLookAndFeel(String name)
name - the name of the l&fpublic JMenu createLookAndFeelMenu()
public void showLoginStatus(String msg)
msg - the status messagepublic <T extends PersistentDomainObject<T>> T showEditDialog(Component comp, T object, boolean modal)
T - the PDO typecomp - some component of the owner window, null if noneobject - the object to createPdo the dialog formodal - true if modal, else non-modalpublic <T extends PersistentDomainObject<T>> T showEditDialog(Component comp, Class<T> clazz, boolean modal)
T - the PDO typecomp - some component of the owner window, null if noneclazz - is the object's classmodal - true if modal, else non-modalpublic <T extends PersistentDomainObject<T>> void showEditDialog(Class<T> clazz)
T - the PDO typeclazz - is the object's classpublic <T extends PersistentDomainObject<T>> void showSearchDialog(FormWindow w, Class<T> clazz)
T - the PDO typew - is the related window, null if noneclazz - is the object's classpublic <T extends PersistentDomainObject<T>> void showSearchDialog(Class<T> clazz)
T - the PDO typeclazz - is the object's classprotected void configurePreferences()
"systemprefs" forces usage of system preferences only.configurePreferences in class AbstractApplicationprotected void installLookAndFeels()
public LoginDialog createLoginDialog(org.tentackle.session.SessionInfo sessionInfo, Icon logo)
sessionInfo - the session infologo - the application logoprotected DomainContext doLogin() throws org.tentackle.misc.ApplicationException
Notice: if the application is started via JNLP (Java WebStart) and the
commandline option "--backend=" is given, it is interpreted as a URL
to the backend-properties file relative to the JNLP codebase. If it starts with
"<protocol>://" it is taken as an absolute URL.
Example:
--backend=http://www.tentackle.org/Invoicer/backend.properties is the same as: --backend=backend.properties if the codebase is http://www.tentackle.org/Invoicer.
org.tentackle.misc.ApplicationException - if login failedprotected void doConfigureApplication()
throws org.tentackle.misc.ApplicationException
doConfigureApplication in class AbstractApplicationorg.tentackle.misc.ApplicationException - if failedprotected abstract FormWindow doCreateWindow() throws org.tentackle.misc.ApplicationException
org.tentackle.misc.ApplicationException - if failedprotected void doInitializeGUI()
throws org.tentackle.misc.ApplicationException
org.tentackle.misc.ApplicationException - if failedFormUtilities.getEventQueue()protected void doShowWindow()
throws org.tentackle.misc.ApplicationException
org.tentackle.misc.ApplicationException - if failedprotected void doFinishStartup()
throws org.tentackle.misc.ApplicationException
"--nomodthread" given.doFinishStartup in class AbstractApplicationorg.tentackle.misc.ApplicationException - if failedprotected void doStop(int exitValue,
Exception ex)
exitValue - the doStop value for System.exit()ex - an exception causing the termination, null if noneprotected void doStop(int exitValue)
exitValue - the doStop value for System.exit()Tentackle - distributed, domain- and model-driven