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
public abstract class EditableControl<Value> extends ValueReferencingControl
AControlthat 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:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEditableControl(String type, IValueAccessor<?> root, String path)Creates a new editable control.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ValuecoerceValue(Object value)Coerces the given value to conform to the restrictions imposed by the value descriptor.StringgetDescription()Gets the description of the field.StringgetLabel()Gets the localized label of the field.ValuegetValue()Gets the field's current value.booleanisFcPlaceholders()Whether the field allows entering formcycle placeholders.booleanisRequired()Gets whether the field is required.voidsetDescription(String description)Sets the description of the field.voidsetFcPlaceholders(boolean fcPlaceholders)Sets whether the field allows entering formcycle placeholders.voidsetLabel(String label)Sets the localized label of the field.voidsetRequired(boolean required)Sets whether the field is required.voidsetValue(Value value)Sets the field's value.-
Methods inherited from class de.xima.fc.gui.model.value_descriptor_form.ValueReferencingControl
readValue, writeValue
-
-
-
-
Constructor Detail
-
EditableControl
protected EditableControl(String type, IValueAccessor<?> root, String path)
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 Detail
-
getDescription
public String 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
public void setDescription(String description)
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
public final String 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
public final void setLabel(String label)
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
public final Value 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
public final void setValue(Value value)
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
protected abstract Value coerceValue(Object value)
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.
-
-