Package com.dua3.utility.fx.controls
Schnittstelle InputControl<T>
- Typparameter:
T- the input result type
- Alle bekannten Implementierungsklassen:
ChoiceInputControl,ComboBoxEx,FileInput,OptionsPane,RadioPane,SimpleInputControl
public interface InputControl<T>
Interface for an input field.
-
Eigenschaftsübersicht
EigenschaftenTypEigenschaftBeschreibungProvides a read-only property representing the error message for this input control.Provides a read-only property representing the validity of the input.Provides the property representing the value of this input control. -
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypSchnittstelleBeschreibungstatic classState class encapsulates a value, validation logic, error message, and validity state. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic SimpleInputControl<CheckBox, Boolean> checkBoxInput(Supplier<@Nullable Boolean> dflt, String text, Function<@Nullable Boolean, Optional<String>> validate) Creates aSimpleInputControlfor aCheckBoxwith a default value, text, and validation function.static InputControl<Path> chooseFile(Supplier<Path> dflt, FileDialogMode mode, boolean existingOnly, Collection<FileChooser.ExtensionFilter> filters, Function<Path, Optional<String>> validate) Provides a file chooser input control.static <T> SimpleInputControl<ComboBoxEx<T>, T> comboBoxExInput(Collection<T> choices, Supplier<T> dflt, @Nullable UnaryOperator<T> edit, @Nullable Supplier<T> add, @Nullable BiPredicate<ComboBoxEx<T>, T> remove, Function<T, String> format, Function<T, Optional<String>> validate) Creates a newSimpleInputControlfor aComboBoxExwith the specified parameters.static <T> SimpleInputControl<ComboBox<T>, T> comboBoxInput(Collection<? extends T> choices, Supplier<T> dflt, Function<T, Optional<String>> validate) static SimpleInputControl<TextField, Double> Creates aSimpleInputControlfor decimal input using aTextField.Provides a read-only property representing the error message for this input control.default @Nullable Tget()Get value.default voidinit()Set/update control state.static SimpleInputControl<TextField, Integer> integerInput(Supplier<@Nullable Integer> dflt, Function<@Nullable Integer, Optional<String>> validate) Creates aSimpleInputControlfor integer values.default booleanisValid()Test if content is valid.node()Get theNodefor this input element.voidreset()Reset value to defaultdefault voidSet value.static SimpleInputControl<TextField, String> Creates aSimpleInputControlfor a TextField with String input.static <T> SimpleInputControl<TextField, T> stringInput(Supplier<T> dflt, Function<@Nullable T, Optional<String>> validate, StringConverter<@Nullable T> converter) Creates a newSimpleInputControlfor aTextFieldwith bidirectional binding.Provides a read-only property representing the validity of the input.Provides the property representing the value of this input control.
-
Eigenschaftsdetails
-
value
Provides the property representing the value of this input control.- Siehe auch:
-
valid
ReadOnlyBooleanProperty validPropertyProvides a read-only property representing the validity of the input.- Siehe auch:
-
error
ReadOnlyStringProperty errorPropertyProvides 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.
- Siehe auch:
-
-
Methodendetails
-
stringInput
static SimpleInputControl<TextField,String> stringInput(Supplier<String> dflt, Function<String, Optional<String>> validate) Creates aSimpleInputControlfor a TextField with String input.- Parameter:
dflt- aSupplierproviding the default value for the TextFieldvalidate- aFunctionthat takes a String and returns an Optional containing a validation error message, if any- Gibt zurück:
- a
SimpleInputControlcontaining the TextField and associated properties
-
stringInput
static <T> SimpleInputControl<TextField,T> stringInput(Supplier<T> dflt, Function<@Nullable T, Optional<String>> validate, StringConverter<@Nullable T> converter) Creates a newSimpleInputControlfor aTextFieldwith bidirectional binding.- Typparameter:
T- The type of the value.- Parameter:
dflt- The supplier providing the default value.validate- A function to validate the value, returning an optional error message.converter- The StringConverter to convert between the value and its string representation.- Gibt zurück:
- A
SimpleInputControlcontaining theTextFieldand associated properties.
-
integerInput
static SimpleInputControl<TextField,Integer> integerInput(Supplier<@Nullable Integer> dflt, Function<@Nullable Integer, Optional<String>> validate) Creates aSimpleInputControlfor integer values.- Parameter:
dflt- the default valueSuppliervalidate- theFunctionto validate the integer input- Gibt zurück:
- a
SimpleInputControlfor integer input
-
decimalInput
static SimpleInputControl<TextField,Double> decimalInput(Supplier<@Nullable Double> dflt, Function<@Nullable Double, Optional<String>> validate) Creates aSimpleInputControlfor decimal input using aTextField.- Parameter:
dflt- theSupplierproviding the default value for the inputvalidate- theFunctionto validate the input value- Gibt zurück:
- a
SimpleInputControlthat manages a TextField for Decimal input
-
checkBoxInput
static SimpleInputControl<CheckBox,Boolean> checkBoxInput(Supplier<@Nullable Boolean> dflt, String text, Function<@Nullable Boolean, Optional<String>> validate) Creates aSimpleInputControlfor aCheckBoxwith a default value, text, and validation function.- Parameter:
dflt- aSupplierproviding the default Boolean valuetext- the text to be displayed with theCheckBoxvalidate- aFunctionthat takes a Boolean value and returns anOptionalcontaining an error message if validation fails- Gibt zurück:
- a new instance of
SimpleInputControlconfigured with aCheckBoxand the provided parameters
-
comboBoxInput
static <T> SimpleInputControl<ComboBox<T>,T> comboBoxInput(Collection<? extends T> choices, Supplier<T> dflt, Function<T, Optional<String>> validate) Creates aComboBoxinput control with specified choices, default valueSupplier, and validationFunction.- Typparameter:
T- the type of the items in theComboBox- Parameter:
choices- the collection of available choices for theComboBoxdflt- aSupplierproviding the default valuevalidate- aFunctionto validate the selected item which returns an optional error message- Gibt zurück:
- a
SimpleInputControlcontaining the ComboBox and its value property
-
comboBoxExInput
static <T> SimpleInputControl<ComboBoxEx<T>,T> comboBoxExInput(Collection<T> choices, Supplier<T> dflt, @Nullable UnaryOperator<T> edit, @Nullable Supplier<T> add, @Nullable BiPredicate<ComboBoxEx<T>, T> remove, Function<T, String> format, Function<T, Optional<String>> validate) Creates a newSimpleInputControlfor aComboBoxExwith the specified parameters.- Typparameter:
T- the type of items contained in theComboBoxEx- Parameter:
choices- the collection of choices to populate theComboBoxExdflt- aSupplierfor the default valueedit- aUnaryOperatorto perform editing on the selected item (nullable)add- aSupplierto provide a new item to add (nullable)remove- aBiPredicateto determine if an item should be removed (nullable)format- aFunctionto format the items as stringsvalidate- aFunctionto validate the current value- Gibt zurück:
- a new instance of
SimpleInputControlconfigured with aComboBoxExand its value property
-
chooseFile
static InputControl<Path> chooseFile(Supplier<Path> dflt, FileDialogMode mode, boolean existingOnly, Collection<FileChooser.ExtensionFilter> filters, Function<Path, Optional<String>> validate) Provides a file chooser input control.- Parameter:
dflt- aSupplierproviding the default file path.mode- theFileDialogModeof the dialog (e.g., OPEN, SAVE, DIRECTORY).existingOnly- specifies if only existing files can be chosen.filters- aCollectionofFileChooser.ExtensionFilterto apply.validate- aFunctionthat validates the selected file path.- Gibt zurück:
- An
InputControlinstance for file selection.
-
node
Node node()Get theNodefor this input element.- Gibt zurück:
- the node
-
get
Get value.- Gibt zurück:
- the current value
-
valueProperty
Provides the property representing the value of this input control.- Gibt zurück:
- the property containing the current value
-
set
Set value.- Parameter:
arg- the value to set
-
isValid
default boolean isValid()Test if content is valid.- Gibt zurück:
- true, if content is valid
-
init
default void init()Set/update control state. -
reset
void reset()Reset value to default -
validProperty
ReadOnlyBooleanProperty validProperty()Provides a read-only property representing the validity of the input.- Gibt zurück:
- a ReadOnlyBooleanProperty that is true if the input is valid and false otherwise
- Siehe auch:
-
errorProperty
ReadOnlyStringProperty errorProperty()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.
- Gibt zurück:
- a ReadOnlyStringProperty containing the error message if there is a validation error, otherwise empty
-