Class FileInputBuilder


public final class FileInputBuilder extends InputControlBuilder<FileInputBuilder,Path>
Builder for creating instances of FileInput with customizable options. The builder provides methods to configure the file dialog mode, initial path, extension filters, validation, and disabled state.
  • Method Details

    • disabled

      public FileInputBuilder disabled(javafx.beans.value.ObservableValue<Boolean> disabled)
      Sets the 'disabled' property for the FileInput control.
      Parameters:
      disabled - an ObservableValue object representing the disabled state of the FileInput control
      Returns:
      the current instance of FileInputBuilder with the 'disabled' property set
    • validate

      public FileInputBuilder validate(Function<Path,Optional<String>> validate)
      Sets the validation function for the file input.
      Parameters:
      validate - a function that takes a Path and returns an Optional containing an error message if validation fails, or an empty Optional if validation succeeds
      Returns:
      the updated FileInputBuilder instance
    • filter

      public FileInputBuilder filter(javafx.stage.FileChooser.ExtensionFilter... filter)
      Adds the specified file extension filters to the FileChooser.
      Parameters:
      filter - One or more FileChooser.ExtensionFilter objects representing the file extension filters to be added.
      Returns:
      The current instance of FileInputBuilder, allowing for method chaining.
    • existingOnly

      public FileInputBuilder existingOnly(boolean flag)
      Sets the flag indicating whether only existing files or directories should be selectable.
      Parameters:
      flag - a boolean flag; if true, only existing files or directories can be selected, otherwise new ones can also be selected
      Returns:
      the current instance of FileInputBuilder for method chaining
    • build

      public FileInput build()
      Builds a FileInput object using the properties specified in the FileInputBuilder.
      Specified by:
      build in class InputControlBuilder<FileInputBuilder,Path>
      Returns:
      a constructed FileInput control based on the current configuration.