Class Helper

java.lang.Object
ch.autumo.ui.utils.Helper

public class Helper extends Object
Helper.
  • Method Details

    • loadAppConfiguration

      public static Properties loadAppConfiguration(BaseApp app)
      Load configuration properties / app settings.
      Parameters:
      app - the application
      Returns:
      configuration properties
    • storeBaseConfiguration

      public static void storeBaseConfiguration(BaseApp app, Properties baseSettings)
      Store BASE configuration properties 'base.ifc'.
      Parameters:
      app - the application
      baseSettings - the settings
    • storeAppConfiguration

      public static void storeAppConfiguration(BaseApp app, Properties settings, String comment)
      Store application configuration 'app.cfg'.
      Parameters:
      app - the application
      settings - the settings
      comment - the settings
    • getPropertiesPath

      public static String getPropertiesPath(BaseApp app)
      Get base configuration/settings path for the application.
      Parameters:
      app - the application
      Returns:
      the base configuration directory
    • loadTemplateBaseConfiguration

      public static Properties loadTemplateBaseConfiguration(BaseApp app)
      Load template base configuration properties 'base.ifc' if any.
      Parameters:
      app - the application
      Returns:
      configuration properties
    • loadTemplateConfiguration

      public static Properties loadTemplateConfiguration(BaseApp app)
      Load template configuration properties 'app.cfg'
      Parameters:
      app - the application
      Returns:
      configuration properties
    • getBaseStyle

      public static String getBaseStyle()
      Get style resource from the autumo-ui base.
      Returns:
      resource
    • getBaseHTMLStyleURL

      public static URL getBaseHTMLStyleURL()
      Get style resource from the autumo-ui base.
      Returns:
      resource
    • getBaseHTMLStyle

      public static String getBaseHTMLStyle()
      Get style resource from the autumo-ui base.
      Returns:
      resource
    • getBaseStyleURL

      public static URL getBaseStyleURL()
      Get style resource from the autumo-ui base.
      Returns:
      resource
    • getBaseResource

      public static String getBaseResource(String relativeResourcePath)
      Get a resource from the autumo-ui base.
      Parameters:
      relativeResourcePath - relative resource path
      Returns:
      resource
    • getBaseResourceURL

      public static URL getBaseResourceURL(String relativeResourcePath)
      Get a resource from the autumo-ui base.
      Parameters:
      relativeResourcePath - relative resource path
      Returns:
      resource
    • getBaseResourceStream

      public static InputStream getBaseResourceStream(String relativeResourcePath)
      Get a resource stream from the autumo-ui base.
      Parameters:
      relativeResourcePath - relative resource path
      Returns:
      resource stream
    • getAppResource

      public static String getAppResource(BaseApp app, String resourcePath)
      Get a resource path in external form.
      Parameters:
      app - the application
      resourcePath - relative or absolute resource path
      Returns:
      resource path in external form
    • getAppResourceURL

      public static URL getAppResourceURL(BaseApp app, String resourcePath)
      Get a resource URL.
      Parameters:
      app - the application
      resourcePath - relative or absolute resource path
      Returns:
      resource path in external form
    • getAppResourceStream

      public static InputStream getAppResourceStream(BaseApp app, String resourcePath)
      Get a resource stream from the application.
      Parameters:
      app - the application
      resourcePath - relative or absolute resource path
      Returns:
      resource stream
    • getTranslatedText

      public static String getTranslatedText(BaseApp app, String translationId)
      Get a text translation.
      Parameters:
      app - the application
      translationId - translation ID
      Returns:
      translated text
    • getMessageBundle

      public static ResourceBundle getMessageBundle(String baseResourcePath)
      Get resource bundle.
      Parameters:
      baseResourcePath - base resource path, e.g. '/ch/autumo/.../', no backslashes!
      Returns:
      resource bundle
    • isSupportedLang

      public static boolean isSupportedLang(String lang)
      Is the language supported by the app?
      Parameters:
      lang - lang code, e.g., 'en'
      Returns:
      true if so
    • hasExtension

      public static boolean hasExtension(Path file)
      File has an extension.
      Parameters:
      file - file
      Returns:
      true if there's an extension
    • extensionDotIndex

      public static int extensionDotIndex(Path file)
      Get extension dot index.
      Parameters:
      file - file
      Returns:
      extension dot index
    • getWebVersions

      public static Versions getWebVersions(BaseApp app)
      Get web versions for current application.
      Parameters:
      app - application
      Returns:
      timeout read and connection timeout in seconds
    • createWebView

      public static javafx.scene.web.WebView createWebView(BaseApp app)
      Create a web view with a proper local storage for the underlying web engine.
      Parameters:
      app - application
      Returns:
      web view
    • getCountryData

      public static CountryData getCountryData()
      Get loaded country data.
      Returns:
      country data
    • nameFromPath

      public static String nameFromPath(Path path)
      File name without extension from path.
      Parameters:
      path - path
      Returns:
      name without extension from path
    • openURL

      public static void openURL(String url)
      Open an URL on the desktop.
      Parameters:
      url - URL
    • openFolder

      public static boolean openFolder(String folder)
      Open a folder on the desktop.
      Parameters:
      folder - folder
      Returns:
      true, if folder could be opened
    • editFile

      public static void editFile(String file)
      Edit a file on the desktop.
      Parameters:
      file - file
    • openFile

      public static void openFile(String file)
      Open a file on the desktop.
      Parameters:
      file - file
    • chooseFolder

      public static String chooseFolder(String defaultDir, javafx.stage.Stage parent, String title, String desc)
      Choose a folder.
      Parameters:
      defaultDir - default directory or null
      parent - parent stage
      title - title
      desc - description
      Returns:
      absolute directory path
    • chooseFile

      public static String chooseFile(String defaultDir, javafx.stage.Stage parent, String title, String desc, String extension)
      Choose a file.
      Parameters:
      defaultDir - default directory or null
      parent - parent stage
      title - title
      desc - description
      extension - allowed extension
      Returns:
      absolute file path
    • saveFile

      public static String saveFile(String defaultDir, javafx.stage.Stage parent, String title, String desc, String extension)
      Choose a file for saving.
      Parameters:
      defaultDir - default directory or null
      parent - parent stage
      title - title
      desc - description
      extension - allowed extension
      Returns:
      absolute file path
    • atariBusy

      public static javafx.scene.Cursor atariBusy()
      Return an Atari-busy-cursor!
      Returns:
      Atari-busy-cursor
    • startTime

      public static void startTime()
      Start timer.
    • stopTime

      public static void stopTime(String id, Class clazz)
      Stop timer.
      Parameters:
      id - id foe info logging
      clazz - class for info clogging