protected static class ValueBinder.ValueBindingImpl<V> extends java.lang.Object implements ValueBinding<V>
Modifier and Type | Field and Description |
---|---|
protected boolean |
buffered |
protected HasValue<V> |
component |
protected com.haulmont.bali.events.Subscription |
componentValueChangeSubscription |
protected ValueSource<V> |
source |
protected com.haulmont.bali.events.Subscription |
sourceInstanceChangeSubscription |
protected com.haulmont.bali.events.Subscription |
sourceStateChangeSubscription |
protected com.haulmont.bali.events.Subscription |
sourceValueChangeSubscription |
Constructor and Description |
---|
ValueBindingImpl(HasValue<V> component,
ValueSource<V> source) |
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates value binding - reads value from source to UI component if state is
BindingState.ACTIVE . |
void |
bind() |
protected void |
componentValueChanged(HasValue.ValueChangeEvent event) |
protected void |
disableBeanValidator(Field<?> component) |
void |
discard()
Discards all changes since last write.
|
HasValue<V> |
getComponent() |
ValueSource<V> |
getSource() |
boolean |
isBuffered() |
boolean |
isModified()
Tests if the value stored in the component has been modified since it was
last updated from the value source.
|
void |
setBuffered(boolean buffered)
Sets the buffered mode.
|
protected void |
setValueToSource(V value) |
protected void |
sourceInstanceChanged(EntityValueSource.InstanceChangeEvent<Entity> event) |
protected void |
sourceValueChanged(ValueSource.ValueChangeEvent<V> event) |
void |
unbind()
Destroy data binding.
|
protected void |
valueSourceStateChanged(DataUnit.StateChangeEvent event) |
void |
write()
Updates all changes since the previous write to the value source.
|
protected ValueSource<V> source
protected com.haulmont.bali.events.Subscription componentValueChangeSubscription
protected com.haulmont.bali.events.Subscription sourceValueChangeSubscription
protected com.haulmont.bali.events.Subscription sourceStateChangeSubscription
protected com.haulmont.bali.events.Subscription sourceInstanceChangeSubscription
protected boolean buffered
public ValueBindingImpl(HasValue<V> component, ValueSource<V> source)
public ValueSource<V> getSource()
getSource
in interface ValueBinding<V>
public HasValue<V> getComponent()
getComponent
in interface ValueBinding<V>
public void unbind()
Binding
public void activate()
ValueBinding
BindingState.ACTIVE
.activate
in interface ValueBinding<V>
protected void disableBeanValidator(Field<?> component)
public void bind()
public void write()
ValueBinding
write
in interface ValueBinding<V>
public void discard()
ValueBinding
discard
in interface ValueBinding<V>
public boolean isBuffered()
isBuffered
in interface ValueBinding<V>
true
if the buffered mode is on, false
otherwisepublic void setBuffered(boolean buffered)
ValueBinding
When in buffered mode, the component value changes will not be reflected
in value source until ValueBinding.write()
is called. Calling ValueBinding.discard()
will revert the components value to the value of the value source.
When in non-buffered mode both read and write operations will be done
directly on the value source. In this mode the ValueBinding.write()
and
ValueBinding.discard()
methods serve no purpose.
If the value in the component has been modified since the last value source update and the buffered mode is switched off at runtime, then the component will update its value from the value source.
setBuffered
in interface ValueBinding<V>
buffered
- true
if the buffered mode should be turned on, false
otherwisepublic boolean isModified()
ValueBinding
isModified
in interface ValueBinding<V>
true
if the value in the component has been modified
since the last value source update, false
if not.protected void valueSourceStateChanged(DataUnit.StateChangeEvent event)
protected void componentValueChanged(HasValue.ValueChangeEvent event)
protected void setValueToSource(V value)
protected void sourceValueChanged(ValueSource.ValueChangeEvent<V> event)
protected void sourceInstanceChanged(EntityValueSource.InstanceChangeEvent<Entity> event)