Class StringControl
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<String>
de.xima.fc.gui.model.value_descriptor_form.StringControl
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MultiLineStringControl, SingleLineStringControl
A base class for
Controls used to edit string values that must conform to a IValueDescriptor.- Since:
- 8.5.0
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStringControl(String type, IValueAccessor<?> root, String path, IStringValueDescriptor descriptor, boolean allowNull) Creates a new string control. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcoerceValue(Object value) Coerces the given value to conform to the restrictions imposed by the value descriptor.intGets the maximum allowed length of the string.intGets the minimum required length of the string.Methods inherited from class EditableControl
getDescription, getLabel, getValue, isFcPlaceholders, isRequired, setDescription, setFcPlaceholders, setLabel, setRequired, setValueMethods inherited from class ValueReferencingControl
readValue, writeValue
-
Constructor Details
-
StringControl
protected StringControl(String type, IValueAccessor<?> root, String path, IStringValueDescriptor descriptor, boolean allowNull) Creates a new string 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.descriptor- The descriptor that describes the string value being edited.allowNull- Whether null values are allowed.
-
-
Method Details
-
getMaxLength
public int getMaxLength()Gets the maximum allowed length of the string. This value is read from the given value descriptor.- Returns:
- The maximum allowed length of the string, or
Integer.MAX_VALUEif no maximum is specified.
-
getMinLength
public int getMinLength()Gets the minimum required length of the string. This value is read from the given value descriptor.- Returns:
- The minimum required length of the string, or 0 if no minimum is specified.
-
coerceValue
Description copied from class:EditableControlCoerces the given value to conform to the restrictions imposed by the value descriptor. This method is called byEditableControl.getValue()andEditableControl.setValue(Object)to ensure that the value is always valid.- Specified by:
coerceValuein classEditableControl<String>- Parameters:
value- The value to coerce.- Returns:
- The coerced value.
-