Class 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
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 Details

    • 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 Details

    • 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 the custom 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 the custom 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 by getValue() and setValue(Object) to ensure that the value is always valid.
      Parameters:
      value - The value to coerce.
      Returns:
      The coerced value.