Alle implementierten Schnittstellen:
InputControl<@Nullable Path>, Styleable, EventTarget, Skinnable

public class FileInput extends CustomControl<HBox> implements InputControl<@Nullable Path>
FileInput is a custom control for selecting files using a FileChooser dialog. It is composed of a TextField that contains the file path and a button that opens a FileChooser to select a file.

The control can operate in different modes: OPEN, SAVE, or DIRECTORY, as specified by the FileDialogMode.

The control also includes properties for error messages and validation status. These properties are updated based on the path selected by the user and the specified validation function.

  • Eigenschaftsdetails

  • Konstruktordetails

    • FileInput

      public FileInput(FileDialogMode mode, boolean existingOnly, Supplier<Path> dflt, Collection<FileChooser.ExtensionFilter> filters, Function<@Nullable Path,Optional<String>> validate)
      Constructs a FileInput instance with specified parameters.
      Parameter:
      mode - the mode of the file dialog, which can be OPEN, SAVE, or DIRECTORY
      existingOnly - boolean indicating whether only existing files or directories should be selectable
      dflt - a supplier providing the default path
      filters - collection of file extension filters to apply in the file chooser
      validate - a function to validate the selected file path, returning an optional error message
  • Methodendetails

    • defaultValidate

      public static Function<@Nullable Path,Optional<String>> defaultValidate(FileDialogMode mode, boolean existingOnly)
      Returns a function object that validates the file selection based on the specified file dialog mode and whether only existing files or directories are allowed.

      The returned function object is for example used in InputBuilder.chooseFile(String, String, Supplier, FileDialogMode, boolean, Collection) to add validation.

      Parameter:
      mode - the mode of the file dialog; can be OPEN, SAVE, or DIRECTORY
      existingOnly - indicates whether only existing files or directories should be selectable
      Gibt zurück:
      a function that takes a Path and returns an Optional containing an error message if validation fails, or an empty Optional if validation succeeds
    • node

      public Node node()
      Beschreibung aus Schnittstelle kopiert: InputControl
      Get the Node for this input element.
      Angegeben von:
      node in Schnittstelle InputControl<@Nullable Path>
      Gibt zurück:
      the node
    • reset

      public void reset()
      Beschreibung aus Schnittstelle kopiert: InputControl
      Reset value to default
      Angegeben von:
      reset in Schnittstelle InputControl<@Nullable Path>
    • valueProperty

      public Property<@Nullable Path> valueProperty()
      Beschreibung aus Schnittstelle kopiert: InputControl
      Provides the property representing the value of this input control.
      Angegeben von:
      valueProperty in Schnittstelle InputControl<@Nullable Path>
      Gibt zurück:
      die Eigenschaft value
    • validProperty

      public ReadOnlyBooleanProperty validProperty()
      Beschreibung aus Schnittstelle kopiert: InputControl
      Provides a read-only property representing the validity of the input.
      Angegeben von:
      validProperty in Schnittstelle InputControl<@Nullable Path>
      Gibt zurück:
      die Eigenschaft valid
    • errorProperty

      public ReadOnlyStringProperty errorProperty()
      Beschreibung aus Schnittstelle kopiert: InputControl
      Provides a read-only property representing the error message for this input control.

      This property contains an error message if the input is invalid, otherwise it is empty.

      Angegeben von:
      errorProperty in Schnittstelle InputControl<@Nullable Path>
      Gibt zurück:
      die Eigenschaft error