Package net.rgielen.fxweaver.core
Class LazyFxControllerAndView<C,V extends javafx.scene.Node>
- java.lang.Object
-
- net.rgielen.fxweaver.core.LazyFxControllerAndView<C,V>
-
- All Implemented Interfaces:
FxControllerAndView<C,V>
public class LazyFxControllerAndView<C,V extends javafx.scene.Node> extends Object implements FxControllerAndView<C,V>
AFxControllerAndViewimplementation that takes a supplier to lazily load the actual view and controller when being on the JavaFXApplicationthread, which is not the case during constructor injection. The implementation is NOT threadsafe, since JavaFX GUI is supposed to work single threaded.- Author:
- Rene Gielen
-
-
Constructor Summary
Constructors Constructor Description LazyFxControllerAndView(Supplier<FxControllerAndView<C,V>> supplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CgetController()Optional<V>getView()protected FxControllerAndView<C,V>initOrGet()Non-threadsafe lazy loader implementation.StringtoString()
-
-
-
Constructor Detail
-
LazyFxControllerAndView
public LazyFxControllerAndView(Supplier<FxControllerAndView<C,V>> supplier)
-
-
Method Detail
-
getController
public C getController()
- Specified by:
getControllerin interfaceFxControllerAndView<C,V extends javafx.scene.Node>
-
getView
public Optional<V> getView()
- Specified by:
getViewin interfaceFxControllerAndView<C,V extends javafx.scene.Node>
-
initOrGet
protected FxControllerAndView<C,V> initOrGet()
Non-threadsafe lazy loader implementation. If thread safety is really required, a derived class may override this method to provide a threadsafe variant.
-
-