Package apps
Class AppsBase
- java.lang.Object
-
- apps.AppsBase
-
- Direct Known Subclasses:
Apps3
,JmriFaceless
public abstract class AppsBase extends java.lang.Object
Base class for the core of JMRI applications.This provides a non-GUI base for applications. Below this is the
Apps3
subclass which provides basic Swing GUI support.There are a series of steps in the configuration:
- preInit
- Initialize log4j, invoked from the main()
- ctor
- Construct the basic application object
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
configDeferredLoadOK
protected boolean
configOK
protected boolean
preferenceFileExists
(package private) static boolean
preInit
-
Constructor Summary
Constructors Constructor Description AppsBase(java.lang.String applicationName, java.lang.String configFileDef, java.lang.String[] args)
Create and initialize the application object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configureProfile()
Configure theProfile
to use for this application.static java.lang.String
getConfigFileName()
static boolean
handleQuit()
The application decided to quit, handle that.static void
handleRestart()
The application decided to restart, handle that.protected void
installConfigurationManager()
protected void
installManagers()
static void
preInit(java.lang.String applicationName)
Initial actions before frame is created, invoked in the applications main() routine.protected void
setAndLoadPreferenceFile()
Invoked to load the preferences information, and in the process configure the system.protected static void
setConfigFilename(java.lang.String def, java.lang.String[] args)
Set up the configuration file name at startup.protected static void
setJmriSystemProperty(java.lang.String key, java.lang.String value)
protected void
start()
Final actions before releasing control of the application to the user, invoked explicitly after object has been constructed in main().
-
-
-
Field Detail
-
configOK
protected boolean configOK
-
configDeferredLoadOK
protected boolean configDeferredLoadOK
-
preferenceFileExists
protected boolean preferenceFileExists
-
preInit
static boolean preInit
-
-
Constructor Detail
-
AppsBase
public AppsBase(java.lang.String applicationName, java.lang.String configFileDef, java.lang.String[] args)
Create and initialize the application object.- Parameters:
applicationName
- user-visible name of applicationconfigFileDef
- default config filenameargs
- arguments passed to application at launch
-
-
Method Detail
-
preInit
public static void preInit(java.lang.String applicationName)
Initial actions before frame is created, invoked in the applications main() routine.- Initialize logging
- Set application name
- Parameters:
applicationName
- The application name as presented to the user
-
configureProfile
protected void configureProfile()
Configure theProfile
to use for this application.Note that GUI-based applications must override this method, since this method does not provide user feedback.
-
installConfigurationManager
protected void installConfigurationManager()
-
installManagers
protected void installManagers()
-
setAndLoadPreferenceFile
protected void setAndLoadPreferenceFile()
Invoked to load the preferences information, and in the process configure the system. The high-level steps are:- Locate the preferences file based through
FileUtil.getFile(String)
- See if the preferences file exists, and handle it if it doesn't
- Obtain a
ConfigureManager
from theInstanceManager
- Ask that ConfigureManager to load the file, in the process loading information into existing and new managers.
- Do any deferred loads that are needed
- If needed, migrate older formats
- Locate the preferences file based through
-
start
protected void start()
Final actions before releasing control of the application to the user, invoked explicitly after object has been constructed in main().
-
setConfigFilename
protected static void setConfigFilename(java.lang.String def, java.lang.String[] args)
Set up the configuration file name at startup.The Configuration File name variable holds the name used to load the configuration file during later startup processing. Applications invoke this method to handle the usual startup hierarchy:
- If an absolute filename was provided on the command line, use it
- If a filename was provided that's not absolute, consider it to be in the preferences directory
- If no filename provided, use a default name (that's application specific)
- Parameters:
def
- Default value if no other is providedargs
- Argument array from the main routine
-
getConfigFileName
public static java.lang.String getConfigFileName()
-
setJmriSystemProperty
protected static void setJmriSystemProperty(java.lang.String key, java.lang.String value)
-
handleQuit
public static boolean handleQuit()
The application decided to quit, handle that.- Returns:
- always returns false
-
handleRestart
public static void handleRestart()
The application decided to restart, handle that.
-
-