Class InputBuilder
java.lang.Object
io.openems.edge.core.appmanager.formly.builder.FormlyBuilder<InputBuilder>
io.openems.edge.core.appmanager.formly.builder.InputBuilder
- All Implemented Interfaces:
OnlyIf<InputBuilder>
,Self<InputBuilder>
A Builder for a Formly Input.
{ "key": "key", "type": "input", "templateOptions": { "type": "number", "label": "label", "placeholder": "placeholder", "required": true, "min": 0, "max": 100, "minLenght": 6, "maxLenght": 18, "pattern": /(\d{1,3}\.){3}\d{1,3}/ }, "validation": { "messages": { "pattern": "Input is not a valid IP Address!", }, }, "expressionProperties": { "templateOptions.required": "model.PROPERTY" }, "hideExpression": "!model.PROPERTY", "defaultValue": "defaultValue" }
-
Field Summary
Fields inherited from class io.openems.edge.core.appmanager.formly.builder.FormlyBuilder
jsonObject, templateOptions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonObject
build()
protected String
getType()
protected final com.google.gson.JsonObject
Only allows positive number as a input.setInputType
(InputType type) Sets the type of the input.setMax
(int max) Sets the max value of the input.setMaxLenght
(int maxLength) Sets the minLength of the input.setMin
(int min) Sets the min value of the input.setMinLenght
(int minLength) Sets the minLength of the input.setPlaceholder
(String placeholder) setValidation
(Validation validation) Sets the validation of the Input.Methods inherited from class io.openems.edge.core.appmanager.formly.builder.FormlyBuilder
addWrapper, disabled, getDefaultValue, getExpressionProperties, getValidators, hide, hideKey, isRequired, onlyShowIf, readonly, self, setCustomValidation, setCustomValidation, setCustomValidation, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValueCases, setDefaultValueWithBooleanSupplier, setDefaultValueWithStringSupplier, setDescription, setKey, setLabel, setLabelExpression
-
Constructor Details
-
InputBuilder
-
-
Method Details
-
setInputType
Sets the type of the input.Default:
InputType.TEXT
- Parameters:
type
- to be set- Returns:
- this
-
setPlaceholder
-
setMin
Sets the min value of the input.- Parameters:
min
- the min number that can be set- Returns:
- this
- Throws:
IllegalArgumentException
- if the type is not set to number
-
setMax
Sets the max value of the input.- Parameters:
max
- the max number that can be set- Returns:
- this
- Throws:
IllegalArgumentException
- if the type is not set to number
-
setMinLenght
Sets the minLength of the input.- Parameters:
minLength
- the min length the input needs- Returns:
- this
- Throws:
IllegalArgumentException
- if the type is not set to password or text
-
setMaxLenght
Sets the minLength of the input.- Parameters:
maxLength
- the max length the input needs- Returns:
- this
- Throws:
IllegalArgumentException
- if the type is not set to password or text
-
setValidation
Sets the validation of the Input.e. g. to set the validation of an IP use
Validation.IP
- Parameters:
validation
- the validation to be set- Returns:
- this
-
onlyPositiveNumbers
Only allows positive number as a input.- Returns:
- this
- Throws:
IllegalArgumentException
- if thisInputBuilder
has not been set to aInputType.NUMBER
input via theInputBuilder
setInputType(InputType)
method.
-
setUnit
-
getType
- Specified by:
getType
in classFormlyBuilder<InputBuilder>
-
build
public com.google.gson.JsonObject build()- Overrides:
build
in classFormlyBuilder<InputBuilder>
-
getValidation
protected final com.google.gson.JsonObject getValidation()
-