Package ch.autumo.ui.utils
Class Helper
java.lang.Object
ch.autumo.ui.utils.Helper
Helper.
-
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.scene.CursorReturn an Atari-busy-cursor!static StringchooseFile(String defaultDir, javafx.stage.Stage parent, String title, String desc, String extension) Choose a file.static StringchooseFolder(String defaultDir, javafx.stage.Stage parent, String title, String desc) Choose a folder.static javafx.scene.web.WebViewcreateWebView(BaseApp app) Create a web view with a proper local storage for the underlying web engine.static voidEdit a file on the desktop.static intextensionDotIndex(Path file) Get extension dot index.static StringgetAppResource(BaseApp app, String resourcePath) Get a resource path in external form.static InputStreamgetAppResourceStream(BaseApp app, String resourcePath) Get a resource stream from the application.static URLgetAppResourceURL(BaseApp app, String resourcePath) Get a resource URL.static StringGet style resource from the autumo-ui base.static URLGet style resource from the autumo-ui base.static StringgetBaseResource(String relativeResourcePath) Get a resource from the autumo-ui base.static InputStreamgetBaseResourceStream(String relativeResourcePath) Get a resource stream from the autumo-ui base.static URLgetBaseResourceURL(String relativeResourcePath) Get a resource from the autumo-ui base.static StringGet style resource from the autumo-ui base.static URLGet style resource from the autumo-ui base.static CountryDataGet loaded country data.static ResourceBundlegetMessageBundle(String baseResourcePath) Get resource bundle.static StringgetPropertiesPath(BaseApp app) Get base configuration/settings path for the application.static StringgetTranslatedText(BaseApp app, String translationId) Get a text translation.static VersionsgetWebVersions(BaseApp app) Get web versions for current application.static booleanhasExtension(Path file) File has an extension.static booleanisSupportedLang(String lang) Is the language supported by the app?static PropertiesLoad configuration properties / app settings.static PropertiesLoad template base configuration properties 'base.ifc' if any.static PropertiesLoad template configuration properties 'app.cfg'static StringnameFromPath(Path path) File name without extension from path.static voidOpen a file on the desktop.static booleanopenFolder(String folder) Open a folder on the desktop.static voidOpen an URL on the desktop.static StringChoose a file for saving.static voidStart timer.static voidStop timer.static voidstoreAppConfiguration(BaseApp app, Properties settings, String comment) Store application configuration 'app.cfg'.static voidstoreBaseConfiguration(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
-