- java.lang.Object
-
- org.tentackle.fx.DefaultFxFactory
-
- All Implemented Interfaces:
FxFactory
@Service(FxFactory.class) public class DefaultFxFactory extends java.lang.Object implements FxFactory
Default implementation of an fx factory.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description DefaultFxFactory()Creates the default factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javafx.util.BuilderFactorycreateBuilderFactory()Creates the builder factory.<T extends FxController>
TcreateController(java.lang.Class<T> controllerClass, java.net.URL fxmlUrl, java.util.ResourceBundle resources, java.net.URL cssUrl)Creates a controller together with its FXML-based view.
The controller class must be annotated withFxControllerService.javafx.stage.StagecreateStage(javafx.stage.StageStyle stageStyle, javafx.stage.Modality modality)Creates a configured stage.<S> TableConfiguration<S>createTableConfiguration(java.lang.Class<S> objectClass, java.lang.String name)Creates an empty configuration for a PDO class.<S> TableConfiguration<S>createTableConfiguration(S template, java.lang.String name)Creates an empty configuration from a template object.<M,V>
ValueTranslator<V,M>createValueTranslator(java.lang.Class<M> modelClass, java.lang.Class<V> viewClass, FxComponent component)Creates a value translator.javafx.util.BuilderFactorygetBuilderFactory()Gets the builder factory.<T> Configurator<T>getConfigurator(java.lang.Class<T> clazz)Gets the configurator for a given class.java.util.Collection<java.lang.Class<FxController>>getControllerClasses()Gets all classes annotated withFxControllerService.javafx.scene.image.ImagegetImage(java.lang.String realm, java.lang.String name)Gets the given image.
Throws IllegalArgumentException if no such image and/or realm.voidpreloadControllers()Loads all controllers marked withFxControllerService.CACHING.PRELOAD.
-
-
-
Method Detail
-
getBuilderFactory
public javafx.util.BuilderFactory getBuilderFactory()
Description copied from interface:FxFactoryGets the builder factory.- Specified by:
getBuilderFactoryin interfaceFxFactory- Returns:
- the FX builder factory
-
getConfigurator
public <T> Configurator<T> getConfigurator(java.lang.Class<T> clazz)
Description copied from interface:FxFactoryGets the configurator for a given class.- Specified by:
getConfiguratorin interfaceFxFactory- Type Parameters:
T- the node type- Parameters:
clazz- the class- Returns:
- the configurator, null if none
-
createValueTranslator
public <M,V> ValueTranslator<V,M> createValueTranslator(java.lang.Class<M> modelClass, java.lang.Class<V> viewClass, FxComponent component)
Description copied from interface:FxFactoryCreates a value translator.- Specified by:
createValueTranslatorin interfaceFxFactory- Type Parameters:
M- the model typeV- the view type- Parameters:
modelClass- the model's value classviewClass- the view's value classcomponent- the fx component- Returns:
- the value translator best fitting for the requested types
-
createStage
public javafx.stage.Stage createStage(javafx.stage.StageStyle stageStyle, javafx.stage.Modality modality)Description copied from interface:FxFactoryCreates a configured stage.- Specified by:
createStagein interfaceFxFactory- Parameters:
stageStyle- the stylemodality- the modality- Returns:
- the stage
-
createController
public <T extends FxController> T createController(java.lang.Class<T> controllerClass, java.net.URL fxmlUrl, java.util.ResourceBundle resources, java.net.URL cssUrl)
Description copied from interface:FxFactoryCreates a controller together with its FXML-based view.
The controller class must be annotated withFxControllerService.- Specified by:
createControllerin interfaceFxFactory- Type Parameters:
T- the controller type- Parameters:
controllerClass- the controller classfxmlUrl- the URL to load the FXML from, null if derived from controllerClass or FxController annotationresources- the resource bundle, null if derived from controllerClass or FxController annotationcssUrl- the URL to load the CSS from, null if derived from controllerClass or FxController annotation- Returns:
- the initialized controller
-
getControllerClasses
public java.util.Collection<java.lang.Class<FxController>> getControllerClasses()
Description copied from interface:FxFactoryGets all classes annotated withFxControllerService.- Specified by:
getControllerClassesin interfaceFxFactory- Returns:
- the classes
-
preloadControllers
public void preloadControllers()
Description copied from interface:FxFactoryLoads all controllers marked withFxControllerService.CACHING.PRELOAD.- Specified by:
preloadControllersin interfaceFxFactory
-
getImage
public javafx.scene.image.Image getImage(java.lang.String realm, java.lang.String name)Description copied from interface:FxFactoryGets the given image.
Throws IllegalArgumentException if no such image and/or realm.
-
createTableConfiguration
public <S> TableConfiguration<S> createTableConfiguration(S template, java.lang.String name)
Description copied from interface:FxFactoryCreates an empty configuration from a template object.- Specified by:
createTableConfigurationin interfaceFxFactory- Type Parameters:
S- the type of the objects contained within the table's items list- Parameters:
template- a template objectname- the table's name, null if basename from effective class of template- Returns:
- the table configuration
-
createTableConfiguration
public <S> TableConfiguration<S> createTableConfiguration(java.lang.Class<S> objectClass, java.lang.String name)
Description copied from interface:FxFactoryCreates an empty configuration for a PDO class.- Specified by:
createTableConfigurationin interfaceFxFactory- Type Parameters:
S- the type of the objects contained within the table's items list- Parameters:
objectClass- the object classname- the table's name, null if basename of objectclass- Returns:
- the table configuration
-
createBuilderFactory
protected javafx.util.BuilderFactory createBuilderFactory()
Creates the builder factory.- Returns:
- the factory
-
-