Class IntegerControl
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<Number>
de.xima.fc.gui.model.value_descriptor_form.IntegerControl
- All Implemented Interfaces:
Serializable
A
Control for integer values that must conform to a IIntegerValueDescriptor.- Since:
- 8.5.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIntegerControl(IValueAccessor<?> root, String path, IIntegerValueDescriptor descriptor) Creates a new integer control. -
Method Summary
Modifier and TypeMethodDescriptionprotected NumbercoerceValue(Object value) Coerces the given value to conform to the restrictions imposed by the value descriptor.Gets the field's current value as a long.longgetMax()Gets the maximum allowed value, if any.longgetMin()Gets the minimum allowed value, if any.booleanisHasMax()Checks whether a maximum value is set.booleanisHasMin()Checks whether a minimum value is set.voidsetLongValue(Long value) Sets the field's value as a long.voidSets the allowed range of values.Methods inherited from class EditableControl
getDescription, getLabel, getValue, isFcPlaceholders, isRequired, setDescription, setFcPlaceholders, setLabel, setRequired, setValueMethods inherited from class ValueReferencingControl
readValue, writeValue
-
Constructor Details
-
IntegerControl
Creates a new integer control.- Parameters:
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 integer value being edited.
-
-
Method Details
-
getLongValue
Gets the field's current value as a long. If the value is null, returns 0.- Returns:
- The field's current value as a long.
-
setLongValue
Sets the field's value as a long.- Parameters:
value- The new value to set.
-
getMax
public long getMax()Gets the maximum allowed value, if any. If no maximum is set, returnsLong.MAX_VALUE.- Returns:
- The maximum allowed value, or
Long.MAX_VALUEif no maximum is set.
-
getMin
public long getMin()Gets the minimum allowed value, if any. If no minimum is set, returnsLong.MIN_VALUE.- Returns:
- The minimum allowed value, or
Long.MIN_VALUEif no minimum is set.
-
isHasMax
public boolean isHasMax()Checks whether a maximum value is set.- Returns:
- true if a maximum value is set, false otherwise.
-
isHasMin
public boolean isHasMin()Checks whether a minimum value is set.- Returns:
- true if a minimum value is set, false otherwise.
-
setRange
Sets the allowed range of values. If the range has no lower bound, the minimum is set toLong.MIN_VALUE. If the range has no upper bound, the maximum is set toLong.MAX_VALUE.- Parameters:
range- The allowed range of values, or null to allow all values.
-
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<Number>- Parameters:
value- The value to coerce.- Returns:
- The coerced value.
-