Interface Binding
- All Known Subinterfaces:
NotifiableBinding
Binders.bind. Lets the caller refresh the components
from the model (e.g. after the model was mutated outside the form),
re-read the model from the components (e.g. before a save), tear down
the listeners installed for two-way bindings, or reach into the
Validator the binder configured from the model's @Required /
@Length / @Regex / @Email / @Url / @Numeric / @ExistIn /
@Validate annotations.-
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()Pulls current component values back into the model.voidRemoves every listener the binder added so the form can be garbage- collected without keeping the model alive.TheValidatorpopulated from the model's validation annotations.voidrefresh()Pushes the current model values into every bound component.
-
Method Details
-
refresh
void refresh()Pushes the current model values into every bound component. -
commit
void commit()Pulls current component values back into the model. Useful before validating / submitting a form when none of the bindings is two-way. -
disconnect
void disconnect()Removes every listener the binder added so the form can be garbage- collected without keeping the model alive. -
getValidator
Validator getValidator()The
Validatorpopulated from the model's validation annotations.Each
@Bindfield that carries one or more of@Required,@Length,@Regex,@Email,@Url,@Numeric,@ExistIn,@Validatecontributes acom.codename1.ui.validation.Constraintagainst the matching component. Multiple annotations on the same field are combined under aGroupConstraint(first failure wins), matching the behaviour ofValidator.addConstraint(Component, Constraint...).The returned validator is never null -- call
addSubmitButtonsto gate a submitButtonuntil every constraint passes, setsetValidateOnEveryKeyfor live feedback, or callisValid()to gate an action programmatically. When the model has no validation annotations the validator is empty andisValid()returns true.
-