Package io.jmix.flowui.data.binding.impl
Class AbstractValueBinding<V>
java.lang.Object
io.jmix.flowui.data.binding.impl.AbstractValueBinding<V>
- Type Parameters:
V- the type of value managed by this binding
- All Implemented Interfaces:
JmixBinding,SuspendableBinding,ValueBinding<V>
- Direct Known Subclasses:
CheckboxValueBinding,FieldValueBinding
public abstract class AbstractValueBinding<V>
extends Object
implements ValueBinding<V>, SuspendableBinding
Abstract implementation of
ValueBinding. Provides basic mechanisms to bind
a UI component to a ValueSource and manage their interactions, such as value
changes and state changes.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AccessManagerprotected org.springframework.context.ApplicationContextprotected com.vaadin.flow.component.HasValue<?,V> protected com.vaadin.flow.shared.Registrationprotected MessageToolsprotected MetadataToolsprotected booleanprotected jakarta.validation.Validatorprotected ValueSource<V>protected com.vaadin.flow.shared.Registrationprotected com.vaadin.flow.shared.Registrationprotected com.vaadin.flow.shared.Registration -
Constructor Summary
ConstructorsConstructorDescriptionAbstractValueBinding(ValueSource<V> valueSource, com.vaadin.flow.component.HasValue<?, V> component) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates binding between a UI component and aValueSource.protected com.vaadin.flow.shared.RegistrationaddComponentValueChangeListener(Runnable listener) voidbind()Processes the binding operation.com.vaadin.flow.component.HasValue<?,V> Returns the component associated with this binding.protected abstract VReturns theValueSourceassociated with this binding.protected voidinitBeanValidator(SupportsValidation<V> component, MetaPropertyPath mpp) protected voidinitRequired(com.vaadin.flow.component.HasValue<?, V> component, MetaPropertyPath metaPropertyPath) protected voidprotected voidprotected voidprotected voidprotected voidresetRequiredIfAttributeFiltered(com.vaadin.flow.component.HasValue<?, V> field, EntityValueSource<?, V> valueSource, MetaPropertyPath metaPropertyPath) Set field's "required" flag to false if the value has been filtered by Row Level Security.voidresume()Resumes the operation of the binding mechanism, restoring it to its active state after being previously suspended.voidsetAccessManager(AccessManager accessManager) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) protected abstract voidsetComponentValue(V value) voidsetMessageTools(MessageTools messageTools) voidsetMetadataTools(MetadataTools metadataTools) voidsetValidator(jakarta.validation.Validator validator) protected voidsetValueToSource(V value) voidsuspend()Suspends the current binding, temporarily pausing its operation.booleanIndicates whether the current binding is in a suspended state.voidunbind()Processes the unbinding operation.
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
messageTools
-
metadataTools
-
validator
protected jakarta.validation.Validator validator -
accessManager
-
valueSource
-
component
-
componentValueChangeRegistration
protected com.vaadin.flow.shared.Registration componentValueChangeRegistration -
valueSourceValueChangeRegistration
protected com.vaadin.flow.shared.Registration valueSourceValueChangeRegistration -
valueSourceStateChangeRegistration
protected com.vaadin.flow.shared.Registration valueSourceStateChangeRegistration -
valueSourceInstanceChangeRegistration
protected com.vaadin.flow.shared.Registration valueSourceInstanceChangeRegistration -
suspended
protected boolean suspended
-
-
Constructor Details
-
AbstractValueBinding
public AbstractValueBinding(ValueSource<V> valueSource, com.vaadin.flow.component.HasValue<?, V> component)
-
-
Method Details
-
setApplicationContext
@Autowired public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) -
setMessageTools
-
setMetadataTools
-
setValidator
@Autowired public void setValidator(jakarta.validation.Validator validator) -
setAccessManager
-
getValueSource
Description copied from interface:ValueBindingReturns theValueSourceassociated with this binding.- Specified by:
getValueSourcein interfaceValueBinding<V>- Returns:
- the value source used for this binding
-
getComponent
Description copied from interface:ValueBindingReturns the component associated with this binding.- Specified by:
getComponentin interfaceValueBinding<V>- Returns:
- the component associated with this binding
-
bind
public void bind()Description copied from interface:JmixBindingProcesses the binding operation.- Specified by:
bindin interfaceJmixBinding
-
onValueSourceInstanceChanged
-
onValueSourceStateChanged
-
onValueSourceValueChange
-
onComponentValueChange
protected void onComponentValueChange() -
unbind
public void unbind()Description copied from interface:JmixBindingProcesses the unbinding operation.- Specified by:
unbindin interfaceJmixBinding
-
activate
public void activate()Description copied from interface:ValueBindingActivates binding between a UI component and aValueSource.- Specified by:
activatein interfaceValueBinding<V>
-
suspend
public void suspend()Description copied from interface:SuspendableBindingSuspends the current binding, temporarily pausing its operation.- Specified by:
suspendin interfaceSuspendableBinding
-
resume
public void resume()Description copied from interface:SuspendableBindingResumes the operation of the binding mechanism, restoring it to its active state after being previously suspended.- Specified by:
resumein interfaceSuspendableBinding
-
suspended
public boolean suspended()Description copied from interface:SuspendableBindingIndicates whether the current binding is in a suspended state.- Specified by:
suspendedin interfaceSuspendableBinding- Returns:
trueif the binding is currently suspended,falseotherwise
-
setValueToSource
-
initRequired
protected void initRequired(com.vaadin.flow.component.HasValue<?, V> component, MetaPropertyPath metaPropertyPath) -
resetRequiredIfAttributeFiltered
protected void resetRequiredIfAttributeFiltered(com.vaadin.flow.component.HasValue<?, V> field, EntityValueSource<?, V> valueSource, MetaPropertyPath metaPropertyPath) Set field's "required" flag to false if the value has been filtered by Row Level Security. This is necessary to allow user to submit form with filtered attribute even if attribute is required. -
initBeanValidator
-
getComponentValue
-
setComponentValue
-
addComponentValueChangeListener
-