Package io.jmix.flowui.data.value
Class BufferedContainerValueSource<E,V>
java.lang.Object
io.jmix.flowui.data.value.ContainerValueSource<E,V>
io.jmix.flowui.data.value.BufferedContainerValueSource<E,V>
- Type Parameters:
E- the type of the entity in the containerV- the type of the property value
- All Implemented Interfaces:
BufferedDataUnit,DataUnit,EntityDataUnit,EntityValueSource<E,,V> HasType<V>,ValueSource<V>,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class BufferedContainerValueSource<E,V>
extends ContainerValueSource<E,V>
implements BufferedDataUnit
Represents a value source that provides buffering capabilities for reading and
writing property values.
This class is useful in scenarios where the property value changes need to be decoupled from the underlying data source, allowing intermediate updates to be managed before committing the changes.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.flowui.data.DataUnit
DataUnit.StateChangeEventNested classes/interfaces inherited from interface io.jmix.flowui.data.EntityValueSource
EntityValueSource.InstanceChangeEvent<E>Nested classes/interfaces inherited from interface io.jmix.flowui.data.ValueSource
ValueSource.ValueChangeEvent<V> -
Field Summary
FieldsFields inherited from class io.jmix.flowui.data.value.ContainerValueSource
container, dataModelSecurityEnabled, events, metaPropertyPath, property, state -
Constructor Summary
ConstructorsConstructorDescriptionBufferedContainerValueSource(InstanceContainer<E> container, String property) BufferedContainerValueSource(InstanceContainer<E> container, String property, boolean buffered) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoiddiscard()Discards all changes since the last timeBufferedDataUnit.write()is invoked.getValue()Returns the current value stored in the value source.booleanbooleanvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) protected voidsetState(BindingState state) voidSets the given value to this value source.protected voidsetValueInternal(V value) voidwrite()Writes all changes since the last time this method is invoked.Methods inherited from class io.jmix.flowui.data.value.ContainerValueSource
addInstanceChangeListener, addStateChangeListener, addValueChangeListener, canUpdateMasterRefs, containerItemChanged, copyPropertyCollection, getContainer, getDataContext, getEntityMetaClass, getInverseProperty, getItem, getMetaPropertyPath, getState, getType, isCollectionPropertyType, isDataModelSecurityEnabled, isEqualCollectionValue, isReadOnly, setDataModelSecurityEnabled, updateMasterRefs
-
Field Details
-
buffered
protected boolean buffered -
internalValue
-
-
Constructor Details
-
BufferedContainerValueSource
-
BufferedContainerValueSource
public BufferedContainerValueSource(InstanceContainer<E> container, String property, boolean buffered)
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Overrides:
setApplicationContextin classContainerValueSource<E,V>
-
containerItemPropertyChanged
- Overrides:
containerItemPropertyChangedin classContainerValueSource<E,V>
-
setState
- Overrides:
setStatein classContainerValueSource<E,V>
-
isBuffered
public boolean isBuffered()- Specified by:
isBufferedin interfaceBufferedDataUnit- Returns:
trueif this data unit in buffered mode,falseotherwise.
-
getValue
Description copied from interface:ValueSourceReturns the current value stored in the value source.- Specified by:
getValuein interfaceValueSource<E>- Overrides:
getValuein classContainerValueSource<E,V> - Returns:
- the current value, or
nullif no value is set
-
setValue
Description copied from interface:ValueSourceSets the given value to this value source.- Specified by:
setValuein interfaceValueSource<E>- Overrides:
setValuein classContainerValueSource<E,V> - Parameters:
value- the value to be set
-
setValueInternal
-
write
public void write()Description copied from interface:BufferedDataUnitWrites all changes since the last time this method is invoked.- Specified by:
writein interfaceBufferedDataUnit
-
discard
public void discard()Description copied from interface:BufferedDataUnitDiscards all changes since the last timeBufferedDataUnit.write()is invoked.- Specified by:
discardin interfaceBufferedDataUnit
-
isModified
public boolean isModified()- Specified by:
isModifiedin interfaceBufferedDataUnit- Returns:
trueif this data unit stores changed data,falseotherwise.
-