Class BaseApp

java.lang.Object
javafx.application.Application
ch.autumo.ui.fx.BaseApp
All Implemented Interfaces:
LicensedApplication, SecureApplication, InstallEndListener

public abstract class BaseApp extends javafx.application.Application implements LicensedApplication, InstallEndListener
The Java FX application. In any case you always can use the getters from ConfigurationManager to retrieve any configuration parameter.
See Also:
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
      Logger.
    • baseCfgFile

      protected String baseCfgFile
      The base configuration file ('cfg/base.cfg').
    • baseProps

      protected Properties baseProps
      The base configuration properties.
  • Constructor Details

  • Method Details

    • start

      public void start(javafx.stage.Stage primaryStage)
      Specified by:
      start in class javafx.application.Application
    • startup

      protected void startup(javafx.stage.Stage primaryStage)
      Called before everything else, overwrite if necessary.
      Parameters:
      primaryStage - primary stage
    • stop

      public void stop() throws Exception
      Overrides:
      stop in class javafx.application.Application
      Throws:
      Exception
    • storeProps

      public void storeProps()
      Store configuration properties to disk.
    • completed

      public void completed(ProcessException ex)
      Description copied from interface: InstallEndListener
      Will be called when the installer is finished.
      Specified by:
      completed in interface InstallEndListener
      Parameters:
      ex - an exception if any or null
    • getConfigurationParameter

      public String getConfigurationParameter(String key)
      Get a configuration parameter/value.
      Parameters:
      key - key
      Returns:
      value or null
    • getPrimaryStage

      public javafx.stage.Stage getPrimaryStage()
      Get primary stage.
      Returns:
      primary stage
    • loadConfigurationParamaterFromFile

      public String loadConfigurationParamaterFromFile(String key)
      Load a configuration parameter directly from configuration file.
      Parameters:
      key - key for value
      Returns:
      value if any, otherwise null
    • removeConfig

      public void removeConfig()
      Remove app configuration from disk.
    • licenseAccepted

      public final void licenseAccepted()
      Set license accepted flag.
    • isLicenseAccepted

      public final boolean isLicenseAccepted()
      Get license accepted flag.
      Returns:
      true, if license was accepted by the user during install
    • isInstalled

      public boolean isInstalled()
      Checks if this app has been installed before; Installer has been run.
      Returns:
      true if app is installed
    • loadRecentFiles

      public void loadRecentFiles(Properties p)
      Load recent used files.
      Parameters:
      p - configuration properties
    • clearRecentFiles

      public void clearRecentFiles()
      Clear recent used file list.
    • getRecentFiles

      public List<File> getRecentFiles()
      Get recent used files.
      Returns:
      recent files
    • addRecentFile

      public void addRecentFile(File file)
      Add a recent used file.
      Parameters:
      file - recent file
    • removeRecentFile

      public boolean removeRecentFile(File file)
      Remove a file from recent used file list.
      Parameters:
      file - file to remove
      Returns:
      true if removed, false otherwise
    • getInitConfidParameter

      public String getInitConfidParameter(String id)
      Get initial fallback value for the configuration file by specified configuration ID. This is only used if every other method failed; e.g. missing template configuration.
      Parameters:
      id - configuration ID
      Returns:
      configuration value
    • getBaseConfigTemplateFile

      public abstract String getBaseConfigTemplateFile()
      Get base configuration template file. Overwrite this method if you want your application to be licensed.
      Returns:
      base configuration template file
    • getConfigTemplateFile

      public abstract String getConfigTemplateFile()
      Get configuration template file.
      Returns:
      configuration template file
    • getBaseProperties

      protected final Properties getBaseProperties()
      Get base properties (properties from 'cfg/base.ifc'). Used for optional runtime checks.
      Returns:
      base properties
    • getBasePropertiesFile

      protected final String getBasePropertiesFile()
      Get base properties file ('cfg/base.ifc') for possible modifications; e.g. trial period, etc. Used for optional runtime checks.
      Returns:
      base properties
    • getManufacturer

      protected String getManufacturer()
      Manufacturer of this application. We suggest not using spaces for this information; it is used to group the application's data on the desktop in a directory where all application data of a certain manufacturer is located. Overwrite this and use your own enterprise/company name. Typical locations on systems: - Linux : /home/USER/.APPNAME (no manufacturer name used) - macOS : /Users/USER/Library/Application Support/MANUFACTURER/APPNAME - Windows : C:\Users\USER\AppData\Roaming\MANUFACTURER/APPNAME
      Returns:
      manufacturer name
    • preInitialize

      protected abstract javafx.scene.layout.Pane preInitialize(javafx.stage.Stage primaryStage)
      Pre-initialize the FX GUI for the installer. Create the main view here and call UI.setup(...). Run before the installer if any.
      Parameters:
      primaryStage - primary stage
      Returns:
      the main view
    • initialize

      protected abstract void initialize(javafx.stage.Stage primaryStage, Properties p)
      Initialize the FX GUI - preInitialize(Stage) must have been called before this method! This will show the main view created previously. Run after the installer if any.
      Parameters:
      primaryStage - primary stage
      p - loaded configuration properties
    • getBaseResourcePath

      public abstract String getBaseResourcePath()
      Get base resource path for application.
      Returns:
      base resource path for application
    • getInMemoryConfigName

      public abstract String getInMemoryConfigName()
      Get in-memory configuration name.
      Returns:
      in-memory configuration name
    • getAppVersion

      public abstract String getAppVersion()
      Get application version. It is also used for online upgrade checks, if applied.
      Specified by:
      getAppVersion in interface LicensedApplication
      Returns:
      application version
    • getAppTitle

      public abstract String getAppTitle()
      Get application title. Part of the online license check, if applied.
      Specified by:
      getAppTitle in interface LicensedApplication
      Returns:
      application title
    • getInternalAppName

      public abstract String getInternalAppName()
      Get an internal application name; make sure it is one word with small and/or big letters and no space. It is used for internal purposes, e.g. configuration directory.
      Returns:
      application name
    • finish

      public abstract void finish(javafx.stage.Stage primaryStage)
      Finish program.
      Parameters:
      primaryStage - primary stage
    • getInternalSecurityKey

      public String getInternalSecurityKey()
      Overwrite if you want to use an own internal security key. It is only used when this application is licensed through autumo's licensing mechanism that involves an autumo license server. Contact autumo for more information.
      Specified by:
      getInternalSecurityKey in interface SecureApplication
      See Also:
    • getUniqueSecurityKey

      public final String getUniqueSecurityKey()
      Specified by:
      getUniqueSecurityKey in interface SecureApplication
      See Also:
    • getPassphrase

      public String getPassphrase()
      Specified by:
      getPassphrase in interface SecureApplication
      See Also:
    • initializeBaseConfig

      public void initializeBaseConfig(String rootFolder) throws Exception
      Specified by:
      initializeBaseConfig in interface LicensedApplication
      Throws:
      Exception
    • getLicensePath

      public final String getLicensePath()
      Specified by:
      getLicensePath in interface LicensedApplication
    • getLicInfoTitle

      public final String getLicInfoTitle()
      Specified by:
      getLicInfoTitle in interface LicensedApplication
    • isAllowed2ReadEnvData

      public final boolean isAllowed2ReadEnvData()
      Specified by:
      isAllowed2ReadEnvData in interface LicensedApplication
    • setAllowed2ReadEnvData

      public final void setAllowed2ReadEnvData(boolean allow)
      Specified by:
      setAllowed2ReadEnvData in interface LicensedApplication
    • getRuntimeType

      public String getRuntimeType()
      Overwrite if there's a specific runtime version; e.g. Trial, Full version.
      Specified by:
      getRuntimeType in interface LicensedApplication
      See Also:
    • getLicType

      public String getLicType()
      Overwrite if there's a specific license version; e.g. Basic, Professional, Enterprise.
      Specified by:
      getLicType in interface LicensedApplication
    • getInlineChecks

      public InlineChecks getInlineChecks()
      Overwrite if inline-checks are used!
      Specified by:
      getInlineChecks in interface LicensedApplication
    • getApiKey

      public String getApiKey()
      Specified by:
      getApiKey in interface LicensedApplication
    • getLicSrvUrl

      public String getLicSrvUrl()
      Specified by:
      getLicSrvUrl in interface LicensedApplication
    • getProductKey

      public String getProductKey()
      You most likely want to overwrite this method if your application can be registered or is registered and product key is not read and decrypted from 'base.ifc'. Must match the product key configured at the autumo product license server. Part of the online license check, if applied.
      Specified by:
      getProductKey in interface LicensedApplication
    • getRegVersion

      public RegistrationVersion getRegVersion()
      You most likely want to overwrite this method if your application can be registered or is registered. Part of the whole licensing mechanism, if applied.
      Specified by:
      getRegVersion in interface LicensedApplication