public class SceneManager extends Object
Constructor and Description |
---|
SceneManager() |
Modifier and Type | Method and Description |
---|---|
<T extends javafx.fxml.Initializable,K extends javafx.scene.Node> |
addScene(String id,
K scene,
T controller)
Adds the specific view and its controller to the map.
|
void |
automate()
Deprecated.
Use another "automate" method instead. This does not work unless used with a SceneManager object you have created.
(Does not work with the defaultSceneManager object provided).
NOTE : CustomStage.getDefaultSceneManager().automate(); will not work
When called gets the directory to collect files as the directory of the caller class. Ex : If "Foo.class" calls this method, then fxml files available in the same directory as "Foo.class" will be loaded. |
void |
automate(String dir)
This is used to make the FileLoader eligible to load the given type of files from the directory given in String format.
|
void |
automate(URL url)
This is used to make the FileLoader eligible to load the given type of files from the directory of the URL provides.
|
<T extends javafx.fxml.Initializable> |
getController(String id) |
String[] |
getIds() |
<K extends javafx.scene.Node> |
getScene(String id) |
public <T extends javafx.fxml.Initializable,K extends javafx.scene.Node> void addScene(String id, K scene, T controller)
T
- Class of the Controller (extends Initializable)K
- Class of the view (extends Node)id
- name which you will access this scene later oncontroller
- controller of the specific view (this must implement Initializable)scene
- parent node retrieved from fxmlLoader.load()public <K extends javafx.scene.Node> K getScene(String id)
K
- Class of the view (extends Node)id
- id which is used to map the scenepublic <T extends javafx.fxml.Initializable> T getController(String id)
T
- Class of the view (extends Node)id
- id which is used to map the scenepublic String[] getIds()
public void automate()
CustomStage.getDefaultSceneManager().automate();
will not work
When called gets the directory to collect files as the directory of the caller class. Ex : If "Foo.class" calls this method, then fxml files available in the same directory as "Foo.class" will be loaded.
public void automate(String dir)
This is used to make the FileLoader eligible to load the given type of files from the directory given in String format.
dir
- directory path for fxml files to be loaded frompublic void automate(URL url)
This is used to make the FileLoader eligible to load the given type of files from the directory of the URL provides.
Ex : sceneManager.automate(getClass().getResource("/path/to/file/myfile.fxml")))
Will make the FileLoader eligible to load file with ".fxml" extension from the "/path/to/file" directory.
url
- URL of a class to determine the package which needs to be lookup for fxml files to loadCopyright © 2018. All rights reserved.