Module de.seggebaeing.sqlanalyzer
Class ResourceLoader
java.lang.Object
de.seggebaeing.sqlanalyzer.presentation.util.ResourceLoader
Utility for loading de.seggebaeing.sqlanalyzer.presentation resources from the classpath (icons, help HTML, FXML).
Uses the thread context ClassLoader; returns
null
when unavailable.
Stateless and thread-safe.- Since:
- 1.0
- Author:
- Felix Seggebäing
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic URL
getFxmlUrl
(String fileName) Resolves a URL to an FXML resource under/fxml/
, appending.fxml
if absent.static URL
getHelpHtmlUrl
(String fileName) Resolves a help document URL from the classpath under/help/
, appending.html
if the extension is missing.static javafx.scene.image.Image
Loads an icon image from the classpath under/icon/
.
-
Constructor Details
-
ResourceLoader
public ResourceLoader()
-
-
Method Details
-
loadIcon
Loads an icon image from the classpath under/icon/
.- Parameters:
fileName
- the icon file name (e.g.,"app.png"
); must not benull
- Returns:
- the loaded
Image
, ornull
if the resource cannot be found - Throws:
NullPointerException
- iffileName
isnull
-
getHelpHtmlUrl
Resolves a help document URL from the classpath under/help/
, appending.html
if the extension is missing. Logs a warning when the resource cannot be found.- Parameters:
fileName
- the help file name (with or without.html
); must not benull
- Returns:
- the
URL
to the resource, ornull
if unavailable - Throws:
NullPointerException
- iffileName
isnull
-
getFxmlUrl
Resolves a URL to an FXML resource under/fxml/
, appending.fxml
if absent. Uses the thread contextClassLoader
.- Parameters:
fileName
- the FXML file name (with or without.fxml
); must not benull
- Returns:
- the
URL
of the resource, ornull
if not found - Throws:
NullPointerException
- iffileName
isnull
-