mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-19 20:34:30 -04:00
Use ViewFactory interface in favor of GuiceViewFactory impl
This commit is contained in:
parent
5a75a1aa10
commit
fcaded1c33
1 changed files with 5 additions and 5 deletions
|
@ -27,7 +27,7 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import viewfx.view.View;
|
import viewfx.view.View;
|
||||||
import viewfx.view.support.guice.GuiceViewFactory;
|
import viewfx.view.ViewFactory;
|
||||||
|
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.JavaFXBuilderFactory;
|
import javafx.fxml.JavaFXBuilderFactory;
|
||||||
|
@ -41,11 +41,11 @@ public class ViewLoader {
|
||||||
|
|
||||||
private final Map<URL, View> cache = new HashMap<>();
|
private final Map<URL, View> cache = new HashMap<>();
|
||||||
private final BuilderFactory builderFactory = new JavaFXBuilderFactory();
|
private final BuilderFactory builderFactory = new JavaFXBuilderFactory();
|
||||||
private final GuiceViewFactory controllerFactory;
|
private final ViewFactory viewFactory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ViewLoader(GuiceViewFactory controllerFactory) {
|
public ViewLoader(ViewFactory viewFactory) {
|
||||||
this.controllerFactory = controllerFactory;
|
this.viewFactory = viewFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public View load(URL url) {
|
public View load(URL url) {
|
||||||
|
@ -56,7 +56,7 @@ public class ViewLoader {
|
||||||
if (useCaching && cache.containsKey(url))
|
if (useCaching && cache.containsKey(url))
|
||||||
return cache.get(url);
|
return cache.get(url);
|
||||||
|
|
||||||
FXMLLoader loader = new FXMLLoader(url, BSResources.getResourceBundle(), builderFactory, controllerFactory);
|
FXMLLoader loader = new FXMLLoader(url, BSResources.getResourceBundle(), builderFactory, viewFactory);
|
||||||
View view = loader.getController();
|
View view = loader.getController();
|
||||||
cache.put(url, view);
|
cache.put(url, view);
|
||||||
return view;
|
return view;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue