Class DefaultFxFactory

java.lang.Object
org.tentackle.fx.DefaultFxFactory
All Implemented Interfaces:
FxFactory

@Service(FxFactory.class) public class DefaultFxFactory extends Object implements FxFactory
Default implementation of FxFactory.
Author:
harald
  • Constructor Details

    • DefaultFxFactory

      public DefaultFxFactory()
      Creates the default factory.
  • Method Details

    • getBuilderFactory

      public javafx.util.BuilderFactory getBuilderFactory()
      Description copied from interface: FxFactory
      Gets the builder factory.
      Specified by:
      getBuilderFactory in interface FxFactory
      Returns:
      the FX builder factory
    • getConfigurator

      public <T> Configurator<T> getConfigurator(Class<T> clazz)
      Description copied from interface: FxFactory
      Gets the configurator for a given class.
      Specified by:
      getConfigurator in interface FxFactory
      Type Parameters:
      T - the node type
      Parameters:
      clazz - the class
      Returns:
      the configurator, null if none
    • createValueTranslator

      public <M,V> ValueTranslator<V,M> createValueTranslator(Class<M> modelClass, Class<V> viewClass, FxComponent component)
      Description copied from interface: FxFactory
      Creates a value translator.
      Specified by:
      createValueTranslator in interface FxFactory
      Type Parameters:
      M - the model type
      V - the view type
      Parameters:
      modelClass - the model's value class
      viewClass - the view's value class
      component - 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, Object owner)
      Description copied from interface: FxFactory
      Creates a configured stage.
      Specified by:
      createStage in interface FxFactory
      Parameters:
      stageStyle - the style
      modality - the modality
      owner - the owner window or a node of it, null if none
      Returns:
      the stage
    • createScene

      public javafx.scene.Scene createScene(javafx.scene.Parent root)
      Description copied from interface: FxFactory
      Creates a scene.
      Specified by:
      createScene in interface FxFactory
      Parameters:
      root - the parent node
      Returns:
      the scene
    • createNotificationPopup

      public javafx.stage.Popup createNotificationPopup()
      Description copied from interface: FxFactory
      Creates a notification popup.
      Swallows accidental events to prevent being hidden before becoming visible to the user and enables auto-hide.
      Specified by:
      createNotificationPopup in interface FxFactory
      Returns:
      the popup
    • createNotificationBuilder

      public NotificationBuilder createNotificationBuilder()
      Description copied from interface: FxFactory
      Creates a notification builder.
      Notifications are a lightweight alternative to Alerts.
      Specified by:
      createNotificationBuilder in interface FxFactory
      Returns:
      the builder
    • createController

      public <T extends FxController> T createController(Class<T> controllerClass, URL fxmlUrl, ResourceBundle resources, URL cssUrl)
      Description copied from interface: FxFactory
      Creates a controller together with its FXML-based view.
      The controller class must be annotated with FxControllerService.
      Specified by:
      createController in interface FxFactory
      Type Parameters:
      T - the controller type
      Parameters:
      controllerClass - the controller class
      fxmlUrl - the URL to load the FXML from, null if derived from controllerClass or the FxControllerService annotation
      resources - the resource bundle, null if derived from controllerClass or the FxControllerService annotation
      cssUrl - the URL to load the CSS from, null if derived from controllerClass or the FxControllerService annotation
      Returns:
      the initialized controller
    • getControllerClasses

      public Collection<Class<FxController>> getControllerClasses()
      Description copied from interface: FxFactory
      Gets all classes annotated with FxControllerService.
      Specified by:
      getControllerClasses in interface FxFactory
      Returns:
      the classes
    • createGraphic

      public javafx.scene.Node createGraphic(String realm, String name)
      Description copied from interface: FxFactory
      Creates the graphic node for a given realm and name.
      Specified by:
      createGraphic in interface FxFactory
      Parameters:
      realm - the realm, null or empty for the framework's default realm
      name - the graphic name
      Returns:
      the graphic node
    • createImage

      public javafx.scene.image.Image createImage(javafx.scene.Node node, javafx.scene.paint.Paint fill)
      Description copied from interface: FxFactory
      Creates an image from the given node.
      The node is temporarily added to an internal scene to render its snapshot.
      Specified by:
      createImage in interface FxFactory
      Parameters:
      node - the node
      fill - the background color
      Returns:
      the image
    • createButton

      public javafx.scene.layout.StackPane createButton(String styleClass, String graphicName, String bundleKey, Runnable action)
      Description copied from interface: FxFactory
      Creates an icon button as a stack pane.
      Used to decorate an existing component with a button-like node.
      Specified by:
      createButton in interface FxFactory
      Parameters:
      styleClass - the style class
      graphicName - the symbolic graphic name
      bundleKey - the bundle key for the tooltip
      action - the action to run when the button is clicked
      Returns:
      the button
    • createTableConfiguration

      public <S> TableConfiguration<S> createTableConfiguration(S template, String name)
      Description copied from interface: FxFactory
      Creates an empty configuration from a template object.
      Specified by:
      createTableConfiguration in interface FxFactory
      Type Parameters:
      S - the type of the objects contained within the table's item list
      Parameters:
      template - a template object
      name - the table's name, null to use the basename from the effective class of the template
      Returns:
      the table configuration
    • createTableConfiguration

      public <S> TableConfiguration<S> createTableConfiguration(Class<S> objectClass, String name)
      Description copied from interface: FxFactory
      Creates an empty configuration for a class.
      Specified by:
      createTableConfiguration in interface FxFactory
      Type Parameters:
      S - the type of the objects contained within the table's item list
      Parameters:
      objectClass - the object class
      name - the table's name, null to use the basename of the object class
      Returns:
      the table configuration
    • simpleTableEditHandler

      public <S> SimpleEditHandler<S> simpleTableEditHandler()
      Description copied from interface: FxFactory
      Creates a table edit handler that ends editing when a value is committed.
      Specified by:
      simpleTableEditHandler in interface FxFactory
      Type Parameters:
      S - type of the objects contained within the table's item list
      Returns:
      the handler
    • rowWiseTableEditHandler

      public <S> RowWiseEditHandler<S> rowWiseTableEditHandler()
      Description copied from interface: FxFactory
      Creates a table edit handler that continues with the next or previous editable cell in the row, wrapping to the next or previous row.
      Specified by:
      rowWiseTableEditHandler in interface FxFactory
      Type Parameters:
      S - type of the objects contained within the table's item list
      Returns:
      the handler
    • columnWiseTableEditHandler

      public <S> ColumnWiseEditHandler<S> columnWiseTableEditHandler()
      Description copied from interface: FxFactory
      Creates a table edit handler that continues with the editable cell below or above in the same column.
      Specified by:
      columnWiseTableEditHandler in interface FxFactory
      Type Parameters:
      S - type of the objects contained within the table's item list
      Returns:
      the handler
    • ruleBasedTableEditHandler

      public <S> RuleBasedEditHandler<S> ruleBasedTableEditHandler()
      Description copied from interface: FxFactory
      Creates a table edit handler that is configured by rules per column and navigates row-wise.
      Specified by:
      ruleBasedTableEditHandler in interface FxFactory
      Type Parameters:
      S - type of the objects contained within the table's item list
      Returns:
      the handler
    • createBuilderFactory

      protected javafx.util.BuilderFactory createBuilderFactory()
      Creates the builder factory.
      Returns:
      the factory