Class EditableControl<Value>
java.lang.Object
de.xima.fc.gui.model.value_descriptor_form.Control
de.xima.fc.gui.model.value_descriptor_form.ValueReferencingControl
de.xima.fc.gui.model.value_descriptor_form.EditableControl<Value>
- Type Parameters:
Value- The type of the value being edited.
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DescriptorEditableControl, DiscriminatorControl, FloatControl, IntegerControl, StringControl
A
Control that allows editing a value via some input mechanism. Adds additional properties for the field,
such as the field's label or whether the field is required.- Since:
- 8.5.0
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEditableControl(String type, IValueAccessor<?> root, String path) Creates a new editable control. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ValuecoerceValue(Object value) Coerces the given value to conform to the restrictions imposed by the value descriptor.Gets the description of the field.final StringgetLabel()Gets the localized label of the field.final ValuegetValue()Gets the field's current value.final booleanWhether the field allows entering formcycle placeholders.final booleanGets whether the field is required.voidsetDescription(String description) Sets the description of the field.final voidsetFcPlaceholders(boolean fcPlaceholders) Sets whether the field allows entering formcycle placeholders.final voidSets the localized label of the field.final voidsetRequired(boolean required) Sets whether the field is required.final voidSets the field's value.Methods inherited from class ValueReferencingControl
readValue, writeValue
-
Constructor Details
-
EditableControl
Creates a new editable control.- Parameters:
type- The type of the control that determines how it is rendered.root- The root object against which the path is evaluated.path- The JSON path expression that references the value.
-
-
Method Details
-
getDescription
Gets the description of the field. The description is typically displayed as a tooltip, title, or help text. Provides additional information about the field, in addition to the label.- Returns:
- The description of the field.
-
setDescription
Sets the description of the field. The description is typically displayed as a tooltip, title, or help text. Provides additional information about the field, in addition to the label.- Parameters:
description- The description of the field.
-
getLabel
Gets the localized label of the field. The label is typically displayed next to the field.- Returns:
- The localized label of the field.
-
setLabel
Sets the localized label of the field. The label is typically displayed next to the field.- Parameters:
label- The localized label of the field.
-
getValue
Gets the field's current value. This first evaluates the JSON path expression against the root object. Next, coerces the value so that it conforms to the restrictions imposed thecustom logic, updating the value if needed. Finally, returns the coerced value.- Returns:
- The field's current value.
-
setValue
Sets the field's value. This first coerces the given value to conform to the restrictions imposed by thecustom logic. Then, sets the coerced value via the JSON path expression against the root object.- Parameters:
value- The new value to set.
-
isFcPlaceholders
public final boolean isFcPlaceholders()Whether the field allows entering formcycle placeholders. A formcycle placeholder is a special pattern that will be replaced with a dynamic value later, such as[%tf1%].- Returns:
- true if the field allows entering formcycle placeholders, false otherwise.
-
setFcPlaceholders
public final void setFcPlaceholders(boolean fcPlaceholders) Sets whether the field allows entering formcycle placeholders. A formcycle placeholder is a special pattern that will be replaced with a dynamic value later, such as[%tf1%].- Parameters:
fcPlaceholders- true if the field allows entering formcycle placeholders, false otherwise.
-
isRequired
public final boolean isRequired()Gets whether the field is required. A required field is indicated visually, e.g. by a red border or by an asterisk. If required, a value must be provided.- Returns:
- true if the field is required, false otherwise.
-
setRequired
public final void setRequired(boolean required) Sets whether the field is required. A required field is indicated visually, e.g. by a red border or by an asterisk. If required, a value must be provided.- Parameters:
required- true if the field is required, false otherwise.
-
coerceValue
Coerces the given value to conform to the restrictions imposed by the value descriptor. This method is called bygetValue()andsetValue(Object)to ensure that the value is always valid.- Parameters:
value- The value to coerce.- Returns:
- The coerced value.
-