java.lang.Object
io.github.palexdev.materialfx.utils.LoaderUtils
Utils class to load FXML views.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkFxmlFile
(URL fxmlFile) Check if the given URL is an fxml file.static Parent
fxmlLoad
(MFXLoaderBean loaderBean) Creates a new FXMLLoader with locationMFXLoaderBean.getFxmlFile()
and controllerMFXLoaderBean.getControllerFactory()
(if not null) and loads the fxml file.static Parent
fxmlLoad
(FXMLLoader fxmlLoader, MFXLoaderBean loaderBean) Sets the location and the controller factory (if not null) for the given fxmlLoader withMFXLoaderBean.getFxmlFile()
andMFXLoaderBean.getControllerFactory()
, and loads the fxml file.static String
generateKey
(URL fxmlFile) If no key is specified when calling 'addItem' then a default key is generated, corresponds to the fxml file name without the extension.Submits a value-returning task for execution and returns a Future representing the pending results of the task.
-
Method Details
-
submit
Submits a value-returning task for execution and returns a Future representing the pending results of the task. The Future'sget
method will return the task's result upon successful completion.If you would like to immediately block waiting for a task, you can use constructions of the form
result = exec.submit(aCallable).get();
Note: The
Executors
class includes a set of methods that can convert some other common closure-like objects, for example,PrivilegedAction
toCallable
form so they can be submitted.- Parameters:
task
- the task to submit- Returns:
- a Future representing pending completion of the task
- Throws:
RejectedExecutionException
- if the task cannot be scheduled for executionNullPointerException
- if the task is null
-
fxmlLoad
Creates a new FXMLLoader with locationMFXLoaderBean.getFxmlFile()
and controllerMFXLoaderBean.getControllerFactory()
(if not null) and loads the fxml file.- Returns:
- the loaded object hierarchy from the fxml
- Throws:
IOException
- See Also:
-
fxmlLoad(FXMLLoader, URL)
fxmlLoad(FXMLLoader, URL, Callback)
-
fxmlLoad
Sets the location and the controller factory (if not null) for the given fxmlLoader withMFXLoaderBean.getFxmlFile()
andMFXLoaderBean.getControllerFactory()
, and loads the fxml file. This method is useful for example when using a DI framework with JavaFX.- Parameters:
fxmlLoader
- the FXMLLoader instance to use- Returns:
- the loaded object hierarchy from the fxml
- Throws:
IOException
- See Also:
-
fxmlLoad(FXMLLoader, URL)
fxmlLoad(FXMLLoader, URL, Callback)
-
checkFxmlFile
Check if the given URL is an fxml file. -
generateKey
If no key is specified when calling 'addItem' then a default key is generated, corresponds to the fxml file name without the extension.- Parameters:
fxmlFile
- The given fxml file- Returns:
- The generated key
-