Class FxFor

java.lang.Object
org.fulib.fx.constructs.forloop.FxFor

@Singleton public class FxFor extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    FxFor(ControllerManager controllerManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <Node extends javafx.scene.Node, Item>
    For<Node,Item>
    of(@NotNull javafx.scene.Parent container, @NotNull javafx.collections.ObservableList<@NotNull Item> items, @NotNull javax.inject.Provider<@NotNull Node> nodeProvider)
    Creates a new For loop for use in code and initializes it.
    <Node extends javafx.scene.Node, Item>
    For<Node,Item>
    of(@NotNull javafx.scene.Parent container, @NotNull javafx.collections.ObservableList<@NotNull Item> items, @NotNull javax.inject.Provider<@NotNull Node> nodeProvider, @NotNull BiConsumer<@NotNull Node,@Nullable Item> beforeInit)
    Creates a new For loop for use in code and initializes it.
    <Node extends javafx.scene.Node, Item>
    For<Node,Item>
    of(@NotNull javafx.scene.Parent container, @NotNull javafx.collections.ObservableList<@NotNull Item> items, @NotNull javax.inject.Provider<@NotNull Node> nodeProvider, @NotNull Map<@NotNull String,@Nullable Object> params, @NotNull BiConsumer<@NotNull Node,@Nullable Item> beforeInit)
    Creates a new For loop for use in code and initializes it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • of

      public <Node extends javafx.scene.Node, Item> For<Node,Item> of(@NotNull @NotNull javafx.scene.Parent container, @NotNull @NotNull javafx.collections.ObservableList<@NotNull Item> items, @NotNull @NotNull javax.inject.Provider<@NotNull Node> nodeProvider, @NotNull @NotNull Map<@NotNull String,@Nullable Object> params, @NotNull @NotNull BiConsumer<@NotNull Node,@Nullable Item> beforeInit)
      Creates a new For loop for use in code and initializes it.

      This factory will use the provider to create a new node for each item in the list. The nodes will be added to the children of the container. If the provided type is a Component, it will be initialized and rendered.

      Example: For.of(myVbox, myListOfItems, myControllerProvider, Map.of("argument", value), (controller, item) -> controller.setItem(item));

      Parameters:
      container - The container to add the nodes to
      items - The list of items to display
      nodeProvider - The provider to create the controller for each item
      beforeInit - The method to call when the controller is created (useful for setting the item)
      params - The parameters to pass to the created controller
      Returns:
      The For loop
    • of

      public <Node extends javafx.scene.Node, Item> For<Node,Item> of(@NotNull @NotNull javafx.scene.Parent container, @NotNull @NotNull javafx.collections.ObservableList<@NotNull Item> items, @NotNull @NotNull javax.inject.Provider<@NotNull Node> nodeProvider, @NotNull @NotNull BiConsumer<@NotNull Node,@Nullable Item> beforeInit)
      Creates a new For loop for use in code and initializes it.

      This factory will use the provider to create a new node for each item in the list. The nodes will be added to the children of the container. If the provided type is a Component, the controller will be initialized and rendered.

      Example: For.of(myVbox, myListOfItems, myControllerProvider, (controller, item) -> controller.setItem(item));

      Parameters:
      container - The container to add the nodes to
      items - The list of items to display
      nodeProvider - The provider to create the controller for each item
      beforeInit - The method to call when the controller is created (useful for setting the item)
      Returns:
      The For loop
    • of

      public <Node extends javafx.scene.Node, Item> For<Node,Item> of(@NotNull @NotNull javafx.scene.Parent container, @NotNull @NotNull javafx.collections.ObservableList<@NotNull Item> items, @NotNull @NotNull javax.inject.Provider<@NotNull Node> nodeProvider)
      Creates a new For loop for use in code and initializes it.

      This factory will use the provider to create a new node for each item in the list. The nodes will be added to the children of the container. If the provided type is a Component, the controller will be initialized and rendered.

      Example: For.of(myVbox, myListOfItems, () -> new Button());

      Example: For.of(myVbox, myListOfItems, myControllerProvider);

      Parameters:
      container - The container to add the nodes to
      items - The list of items to display
      nodeProvider - The provider to create the controller for each item
      Returns:
      The For loop