public class FormEditableLayout extends BaseFormComponent<EditLayout,CharSequence>
BaseFormComponent implementation which wraps form EditLayout into component that
can be validated by FormValidator when validating a form in which is such a layout presented.FormEditable| Constructor and Description |
|---|
FormEditableLayout(EditLayout editable)
Same as
FormEditableLayout(EditLayout, String) with FormEditable.NOT_EMPTY_REG_EXP
for regExp parameter. |
FormEditableLayout(EditLayout editable,
int regExpResId)
Same as
FormEditableLayout(EditLayout, String) for regular expression resource id. |
FormEditableLayout(EditLayout editable,
String regExp)
Creates a new instance of FormEditable component for the given editable view with
the specified regular expression.
|
FormEditableLayout(int id)
Same as
FormEditableLayout(int, String) with FormEditable.NOT_EMPTY_REG_EXP
for regExp parameter. |
FormEditableLayout(int id,
int regExpResId)
Creates a new instance of FormEditableLayout component for an an editable input layout with
the specified id.
|
FormEditableLayout(int id,
String regExp)
Creates a new instance of FormEditableLayout component for an editable input layout with the
specified id and the specified regular expression.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearError()
Clears the current error (if any) of this form component specified via
FormComponent.setError(CharSequence). |
Editable |
getEditableInput()
Returns the current editable value of the attached text field view.
|
CharSequence |
getInput()
Returns the current input presented by an attached view of this form component.
|
boolean |
hasInputChanged()
Checks whether the current value of this form component has changed since its last validation.
|
protected void |
onAttachedToValidator(FormValidator validator)
Invoked whenever this form component is assigned to the passed validator.
|
protected boolean |
onValidate(CharSequence input)
Invoked whenever
BaseFormComponent.validate() is called. |
void |
setError(CharSequence errorMessage)
Sets an error for this form component.
|
attachToValidator, findComponent, findComponentTraversal, getId, getLastValidatedInput, getResources, getValidator, getView, hasError, isAttachedToValidator, obtainString, obtainText, onComponentViewAttached, resetCurrentState, setHasError, validatepublic FormEditableLayout(@IdRes int id)
FormEditableLayout(int, String) with FormEditable.NOT_EMPTY_REG_EXP
for regExp parameter.public FormEditableLayout(@IdRes int id, @NonNull String regExp)
id - Id used to find the editable layout within the form view hierarchy of
the associated FormValidator via FormValidator.findViewById(int).regExp - The desired regular expression that is used to validate editable
value obtained from the editable view during the validation process.public FormEditableLayout(@IdRes int id, @StringRes int regExpResId)
id - Id used to find the editable layout within the form view hierarchy of
the associated FormValidator via FormValidator.findViewById(int).regExpResId - Resource id of the desired regular expression that is used to validate editable
value obtained from the editable view during the validation process.public FormEditableLayout(@NonNull EditLayout editable)
FormEditableLayout(EditLayout, String) with FormEditable.NOT_EMPTY_REG_EXP
for regExp parameter.public FormEditableLayout(@NonNull EditLayout editable, @StringRes int regExpResId)
FormEditableLayout(EditLayout, String) for regular expression resource id.regExpResId - Resource id of the desired regular expression.public FormEditableLayout(@NonNull EditLayout editable, @NonNull String regExp)
editable - Editable input layout, which should be validated.regExp - The desired regular expression used to validate editable value obtained from
the editable view during the validation process.BaseFormComponent.BaseFormComponent(int, View)public boolean hasInputChanged()
FormComponent
Basically, whenever this returns true this component should be validated, otherwise
there is no need given the fact that its value did not change.
hasInputChanged in interface FormComponent<EditLayout,CharSequence>hasInputChanged in class BaseFormComponent<EditLayout,CharSequence>True if the current value is different from the one that has been last time
validated via FormComponent.validate(), false otherwise.protected boolean onValidate(@NonNull CharSequence input)
BaseFormComponentBaseFormComponent.validate() is called. Note, that there will be BaseFormComponent.resetCurrentState()
always called before this.onValidate in class BaseFormComponent<EditLayout,CharSequence>input - Current input of this form component to be validated.true if the current form component's view state passed
validation requirements, false otherwise.FormComponent.getInput()@NonNull public CharSequence getInput()
FormComponent@Nullable public Editable getEditableInput()
null if view of this component is null.public void setError(@NonNull CharSequence errorMessage)
FormComponentNote, that a specific implementations can ignore this call and also depends on the specific implementation how the requested error parameter will be shown.
errorMessage - The desired error message.FormComponent.clearError()public void clearError()
FormComponentFormComponent.setError(CharSequence).clearError in interface FormComponent<EditLayout,CharSequence>clearError in class BaseFormComponent<EditLayout,CharSequence>protected void onAttachedToValidator(@NonNull FormValidator validator)
BaseFormComponentonAttachedToValidator in class BaseFormComponent<EditLayout,CharSequence>validator - An instance of FormValidator to which was this form component newly assigned.