Package io.jmix.flowui.model
Interface InstanceContainer<E>
- All Known Subinterfaces:
CollectionContainer<E>,CollectionPropertyContainer<E>,InstancePropertyContainer<E>,KeyValueCollectionContainer,KeyValueContainer
- All Known Implementing Classes:
CollectionContainerImpl,CollectionPropertyContainerImpl,InstanceContainerImpl,InstancePropertyContainerImpl,KeyValueCollectionContainerImpl,KeyValueContainerImpl
@NullMarked
public interface InstanceContainer<E>
The root interface in the data containers hierarchy. Data containers represent a thin layer between
visual components and entity instances and collections.
InstanceContainer holds a single entity instance.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classEvent sent when the entity instance selected in the container is replaced with another instance or null.static classEvent sent on changing a property value of the contained entity instance. -
Method Summary
Modifier and TypeMethodDescriptionAdds listener toInstanceContainer.ItemChangeEvents.Adds listener toInstanceContainer.ItemPropertyChangeEvents.Returns the meta-class of entities that can be stored in the container.@Nullable FetchPlanReturns the view which was set by previous call tosetFetchPlan(FetchPlan).getItem()Returns the contained entity instance.@Nullable EReturns the contained entity instance or null if there is no entity in the container.voidmute()Disables all event listeners on container data change.voidsetFetchPlan(FetchPlan fetchPlan) Sets a view to be used when loading entities for this container.voidSets the given entity instance to the container.voidunmute()Enables all event listeners.
-
Method Details
-
getItem
E getItem()Returns the contained entity instance.- Throws:
IllegalStateException- if there is no entity in the container
-
setItem
Sets the given entity instance to the container. -
getItemOrNull
@Nullable E getItemOrNull()Returns the contained entity instance or null if there is no entity in the container. -
getEntityMetaClass
MetaClass getEntityMetaClass()Returns the meta-class of entities that can be stored in the container. -
getFetchPlan
@Nullable FetchPlan getFetchPlan()Returns the view which was set by previous call tosetFetchPlan(FetchPlan). The view is normally used when loading entities for this container. -
setFetchPlan
Sets a view to be used when loading entities for this container. -
addItemPropertyChangeListener
Subscription addItemPropertyChangeListener(Consumer<InstanceContainer.ItemPropertyChangeEvent<E>> listener) Adds listener toInstanceContainer.ItemPropertyChangeEvents. -
addItemChangeListener
Adds listener toInstanceContainer.ItemChangeEvents. -
mute
void mute()Disables all event listeners on container data change.
Can be used withunmute()for bulk data modification as a perfomance optimization. -
unmute
void unmute()Enables all event listeners. No events are fired on this call.
-