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
public abstract class StringControl extends EditableControl<String>
A base class forControls used to edit string values that must conform to aIValueDescriptor.- Since:
- 8.5.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStringControl(String type, IValueAccessor<?> root, String path, IStringValueDescriptor descriptor, boolean allowNull)Creates a new string control.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringcoerceValue(Object value)Coerces the given value to conform to the restrictions imposed by the value descriptor.intgetMaxLength()Gets the maximum allowed length of the string.intgetMinLength()Gets the minimum required length of the string.-
Methods inherited from class de.xima.fc.gui.model.value_descriptor_form.EditableControl
getDescription, getLabel, getValue, isFcPlaceholders, isRequired, setDescription, setFcPlaceholders, setLabel, setRequired, setValue
-
Methods inherited from class de.xima.fc.gui.model.value_descriptor_form.ValueReferencingControl
readValue, writeValue
-
-
-
-
Constructor Detail
-
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 Detail
-
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
protected String coerceValue(Object value)
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.
-
-