Package ch.autumo.ui.utils
Class Helper
java.lang.Object
ch.autumo.ui.utils.Helper
Helper.
-
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.scene.Cursor
Return an Atari-busy-cursor!static String
chooseFile
(String defaultDir, javafx.stage.Stage parent, String title, String desc, String extension) Choose a file.static String
chooseFolder
(String defaultDir, javafx.stage.Stage parent, String title, String desc) Choose a folder.static javafx.scene.web.WebView
createWebView
(BaseApp app) Create a web view with a proper local storage for the underlying web engine.static void
Edit a file on the desktop.static int
extensionDotIndex
(Path file) Get extension dot index.static String
getAppResource
(BaseApp app, String resourcePath) Get a resource path in external form.static InputStream
getAppResourceStream
(BaseApp app, String resourcePath) Get a resource stream from the application.static URL
getAppResourceURL
(BaseApp app, String resourcePath) Get a resource URL.static String
Get style resource from the autumo-ui base.static URL
Get style resource from the autumo-ui base.static String
getBaseResource
(String relativeResourcePath) Get a resource from the autumo-ui base.static InputStream
getBaseResourceStream
(String relativeResourcePath) Get a resource stream from the autumo-ui base.static URL
getBaseResourceURL
(String relativeResourcePath) Get a resource from the autumo-ui base.static String
Get style resource from the autumo-ui base.static URL
Get style resource from the autumo-ui base.static CountryData
Get loaded country data.static ResourceBundle
getMessageBundle
(String baseResourcePath) Get resource bundle.static String
getPropertiesPath
(BaseApp app) Get base configuration/settings path for the application.static String
getTranslatedText
(BaseApp app, String translationId) Get a text translation.static Versions
getWebVersions
(BaseApp app) Get web versions for current application.static boolean
hasExtension
(Path file) File has an extension.static boolean
isSupportedLang
(String lang) Is the language supported by the app?static Properties
Load configuration properties / app settings.static Properties
Load template base configuration properties 'base.ifc' if any.static Properties
Load template configuration properties 'app.cfg'static String
nameFromPath
(Path path) File name without extension from path.static void
Open a file on the desktop.static boolean
openFolder
(String folder) Open a folder on the desktop.static void
Open an URL on the desktop.static String
Choose a file for saving.static void
Start timer.static void
Stop timer.static void
storeAppConfiguration
(BaseApp app, Properties settings, String comment) Store application configuration 'app.cfg'.static void
storeBaseConfiguration
(BaseApp app, Properties baseSettings) Store BASE configuration properties 'base.ifc'.
-
Method Details
-
loadAppConfiguration
Load configuration properties / app settings.- Parameters:
app
- the application- Returns:
- configuration properties
-
storeBaseConfiguration
Store BASE configuration properties 'base.ifc'.- Parameters:
app
- the applicationbaseSettings
- the settings
-
storeAppConfiguration
Store application configuration 'app.cfg'.- Parameters:
app
- the applicationsettings
- the settingscomment
- the settings
-
getPropertiesPath
Get base configuration/settings path for the application.- Parameters:
app
- the application- Returns:
- the base configuration directory
-
loadTemplateBaseConfiguration
Load template base configuration properties 'base.ifc' if any.- Parameters:
app
- the application- Returns:
- configuration properties
-
loadTemplateConfiguration
Load template configuration properties 'app.cfg'- Parameters:
app
- the application- Returns:
- configuration properties
-
getBaseStyle
Get style resource from the autumo-ui base.- Returns:
- resource
-
getBaseHTMLStyleURL
Get style resource from the autumo-ui base.- Returns:
- resource
-
getBaseHTMLStyle
Get style resource from the autumo-ui base.- Returns:
- resource
-
getBaseStyleURL
Get style resource from the autumo-ui base.- Returns:
- resource
-
getBaseResource
Get a resource from the autumo-ui base.- Parameters:
relativeResourcePath
- relative resource path- Returns:
- resource
-
getBaseResourceURL
Get a resource from the autumo-ui base.- Parameters:
relativeResourcePath
- relative resource path- Returns:
- resource
-
getBaseResourceStream
Get a resource stream from the autumo-ui base.- Parameters:
relativeResourcePath
- relative resource path- Returns:
- resource stream
-
getAppResource
Get a resource path in external form.- Parameters:
app
- the applicationresourcePath
- relative or absolute resource path- Returns:
- resource path in external form
-
getAppResourceURL
Get a resource URL.- Parameters:
app
- the applicationresourcePath
- relative or absolute resource path- Returns:
- resource path in external form
-
getAppResourceStream
Get a resource stream from the application.- Parameters:
app
- the applicationresourcePath
- relative or absolute resource path- Returns:
- resource stream
-
getTranslatedText
Get a text translation.- Parameters:
app
- the applicationtranslationId
- translation ID- Returns:
- translated text
-
getMessageBundle
Get resource bundle.- Parameters:
baseResourcePath
- base resource path, e.g. '/ch/autumo/.../', no backslashes!- Returns:
- resource bundle
-
isSupportedLang
Is the language supported by the app?- Parameters:
lang
- lang code, e.g., 'en'- Returns:
- true if so
-
hasExtension
File has an extension.- Parameters:
file
- file- Returns:
- true if there's an extension
-
extensionDotIndex
Get extension dot index.- Parameters:
file
- file- Returns:
- extension dot index
-
getWebVersions
Get web versions for current application.- Parameters:
app
- application- Returns:
- timeout read and connection timeout in seconds
-
createWebView
Create a web view with a proper local storage for the underlying web engine.- Parameters:
app
- application- Returns:
- web view
-
getCountryData
Get loaded country data.- Returns:
- country data
-
nameFromPath
File name without extension from path.- Parameters:
path
- path- Returns:
- name without extension from path
-
openURL
Open an URL on the desktop.- Parameters:
url
- URL
-
openFolder
Open a folder on the desktop.- Parameters:
folder
- folder- Returns:
- true, if folder could be opened
-
editFile
Edit a file on the desktop.- Parameters:
file
- file
-
openFile
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 nullparent
- parent stagetitle
- titledesc
- 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 nullparent
- parent stagetitle
- titledesc
- descriptionextension
- 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 nullparent
- parent stagetitle
- titledesc
- descriptionextension
- 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
Stop timer.- Parameters:
id
- id foe info loggingclazz
- class for info clogging
-