Class CheckBoxTreeItemBuilder<T>

java.lang.Object
io.github.sosuisen.jfxbuilder.controls.CheckBoxTreeItemBuilder<T>

public class CheckBoxTreeItemBuilder<T> extends Object
The CheckBoxTreeItemBuilder class constructs instances of the CheckBoxTreeItem class and offers a fluent interface for creating and configuring it.

This class includes a static create method that accepts the same arguments as the original CheckBoxTreeItem constructor and returns an instance of the CheckBoxTreeItemBuilder.

You can use method chaining to call the builder methods for configuring the CheckBoxTreeItem. Finally, invoke the build method to generate an instance of the CheckBoxTreeItem class.

Note that intermediate builder methods are not evaluated until the build method is called, meaning they are evaluated lazily.

Author:
Hidekazu Kubota <hidekazu.kubota@gmail.com>
  • Method Details

    • create

      public static <T> CheckBoxTreeItemBuilder<T> create()
      Returns an instance of the CheckBoxTreeItemBuilder<T>.
      Returns:
      an instance of the CheckBoxTreeItemBuilder<T>.
    • create

      public static <T> CheckBoxTreeItemBuilder<T> create(T value)
      Accepts the constructor arguments of CheckBoxTreeItem(T) and returns an instance of CheckBoxTreeItemBuilder<T>.
      Returns:
      an instance of the CheckBoxTreeItemBuilder<T>.
    • create

      public static <T> CheckBoxTreeItemBuilder<T> create(T value, Node graphic)
      Accepts the constructor arguments of CheckBoxTreeItem(T, Node) and returns an instance of CheckBoxTreeItemBuilder<T>.
      Returns:
      an instance of the CheckBoxTreeItemBuilder<T>.
    • create

      public static <T> CheckBoxTreeItemBuilder<T> create(T value, Node graphic, boolean selected)
      Accepts the constructor arguments of CheckBoxTreeItem(T, Node, boolean) and returns an instance of CheckBoxTreeItemBuilder<T>.
      Returns:
      an instance of the CheckBoxTreeItemBuilder<T>.
    • create

      public static <T> CheckBoxTreeItemBuilder<T> create(T value, Node graphic, boolean selected, boolean independent)
      Accepts the constructor arguments of CheckBoxTreeItem(T, Node, boolean, boolean) and returns an instance of CheckBoxTreeItemBuilder<T>.
      Returns:
      an instance of the CheckBoxTreeItemBuilder<T>.
    • build

      public CheckBoxTreeItem<T> build()
      Builds and returns an instance of the CheckBoxTreeItem class.

      Intermediate builder methods are not evaluated until the build method is called; in other words, they are evaluated lazily.

      Returns:
      new instance of the CheckBoxTreeItem class
    • apply

      Applies a function to the CheckBoxTreeItem instance being constructed. Most operations on the instance can be performed using this method.
      Returns:
      builder instance
    • expanded

      public CheckBoxTreeItemBuilder<T> expanded(boolean value)
      A builder method that invokes the setExpanded method on the instance being constructed.
      Returns:
      builder instance
    • graphic

      public CheckBoxTreeItemBuilder<T> graphic(Node value)
      A builder method that invokes the setGraphic method on the instance being constructed.
      Returns:
      builder instance
    • independent

      public CheckBoxTreeItemBuilder<T> independent(boolean value)
      A builder method that invokes the setIndependent method on the instance being constructed.
      Returns:
      builder instance
    • indeterminate

      public CheckBoxTreeItemBuilder<T> indeterminate(boolean value)
      A builder method that invokes the setIndeterminate method on the instance being constructed.
      Returns:
      builder instance
    • selected

      public CheckBoxTreeItemBuilder<T> selected(boolean value)
      A builder method that invokes the setSelected method on the instance being constructed.
      Returns:
      builder instance
    • value

      public CheckBoxTreeItemBuilder<T> value(T value)
      A builder method that invokes the setValue method on the instance being constructed.
      Returns:
      builder instance
    • addChildren

      @SafeVarargs public final CheckBoxTreeItemBuilder<T> addChildren(TreeItem<T>... elements)
      Calls the addAll method on the ObservableList returned by the CheckBoxTreeItem#getChildren() method.
      Returns:
      builder instance
    • addChildren

      public final CheckBoxTreeItemBuilder<T> addChildren(Collection<? extends TreeItem<T>> col)
      Calls the addAll method on the ObservableList returned by the CheckBoxTreeItem#getChildren() method.
      Returns:
      builder instance
    • withChildren

      @SafeVarargs public static <T> CheckBoxTreeItemBuilder<T> withChildren(TreeItem<T>... elements)
      Creates an instance of the builder, then calls the addAll method on the ObservableList returned by the CheckBoxTreeItem#getChildren() method.
      Returns:
      builder instance
    • withChildren

      public static <T> CheckBoxTreeItemBuilder<T> withChildren(Collection<? extends TreeItem<T>> col)
      Creates an instance of the builder, then calls the addAll method on the ObservableList returned by the CheckBoxTreeItem#getChildren() method.
      Returns:
      builder instance
    • expandedPropertyApply

      public CheckBoxTreeItemBuilder<T> expandedPropertyApply(Consumer<BooleanProperty> op)
      Applies a function to the expandedProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.expandedProperty().bind(anotherProperty))
      
      // Use shorthand form
      .expandedPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • graphicPropertyApply

      public CheckBoxTreeItemBuilder<T> graphicPropertyApply(Consumer<ObjectProperty<Node>> op)
      Applies a function to the graphicProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.graphicProperty().bind(anotherProperty))
      
      // Use shorthand form
      .graphicPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • independentPropertyApply

      public CheckBoxTreeItemBuilder<T> independentPropertyApply(Consumer<BooleanProperty> op)
      Applies a function to the independentProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.independentProperty().bind(anotherProperty))
      
      // Use shorthand form
      .independentPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • indeterminatePropertyApply

      public CheckBoxTreeItemBuilder<T> indeterminatePropertyApply(Consumer<BooleanProperty> op)
      Applies a function to the indeterminateProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.indeterminateProperty().bind(anotherProperty))
      
      // Use shorthand form
      .indeterminatePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • leafPropertyApply

      public CheckBoxTreeItemBuilder<T> leafPropertyApply(Consumer<ReadOnlyBooleanProperty> op)
      Applies a function to the leafProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.leafProperty().bind(anotherProperty))
      
      // Use shorthand form
      .leafPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • parentPropertyApply

      public CheckBoxTreeItemBuilder<T> parentPropertyApply(Consumer<ReadOnlyObjectProperty<TreeItem<T>>> op)
      Applies a function to the parentProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.parentProperty().bind(anotherProperty))
      
      // Use shorthand form
      .parentPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • selectedPropertyApply

      public CheckBoxTreeItemBuilder<T> selectedPropertyApply(Consumer<BooleanProperty> op)
      Applies a function to the selectedProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.selectedProperty().bind(anotherProperty))
      
      // Use shorthand form
      .selectedPropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance
    • valuePropertyApply

      public CheckBoxTreeItemBuilder<T> valuePropertyApply(Consumer<ObjectProperty<T>> op)
      Applies a function to the valueProperty of the instance being constructed. This serves as a shorthand form of the apply method.

      Example:

      // Use apply
      .apply(obj -> obj.valueProperty().bind(anotherProperty))
      
      // Use shorthand form
      .valuePropertyApply(prop -> prop.bind(anotherProperty))
      
      Returns:
      builder instance