Package io.jmix.flowui.model.impl
Class InstanceContainerImpl<E>
java.lang.Object
io.jmix.flowui.model.impl.InstanceContainerImpl<E>
- Type Parameters:
E- the type of the entity contained in the instance container
- All Implemented Interfaces:
HasLoader,ItemPropertyChangeNotifier,InstanceContainer<E>
- Direct Known Subclasses:
CollectionContainerImpl,InstancePropertyContainerImpl,KeyValueContainerImpl
public class InstanceContainerImpl<E>
extends Object
implements InstanceContainer<E>, HasLoader, ItemPropertyChangeNotifier
Implementation of the
InstanceContainer interface.
This class represents a container for a single instance of an entity and provides methods
to manage its state, fetch plans, and property change events.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.flowui.model.InstanceContainer
InstanceContainer.ItemChangeEvent<T>, InstanceContainer.ItemPropertyChangeEvent<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MetaClassprotected EventHubprotected FetchPlanprotected Eprotected EntityPropertyChangeListenerprotected booleanprotected DataLoaderprotected Metadata -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds listener toInstanceContainer.ItemChangeEvents.Adds listener toInstanceContainer.ItemPropertyChangeEvents.protected voidattachListener(Object entity) protected voiddetachListener(Object entity) protected voidfireItemChanged(E prevItem) Returns the meta-class of entities that can be stored in the container.Returns the view which was set by previous call toInstanceContainer.setFetchPlan(FetchPlan).getItem()Returns the contained entity instance.Returns the contained entity instance or null if there is no entity in the container.Returns the loader of this container.voidHandles changes to a specific property of an item.voidmute()Disables all event listeners on container data change.voidsetFetchPlan(FetchPlan fetchPlan) Sets theFetchPlanfor the instance container.voidSets the given entity instance to the container.voidsetLoader(DataLoader loader) Sets the loader for this container.voidsetMetadata(Metadata metadata) toString()voidunmute()Enables all event listeners.
-
Field Details
-
metadata
-
item
-
entityMetaClass
-
fetchPlan
-
events
-
listener
-
loader
-
listenersEnabled
protected boolean listenersEnabled
-
-
Constructor Details
-
InstanceContainerImpl
-
-
Method Details
-
setMetadata
-
getItemOrNull
Description copied from interface:InstanceContainerReturns the contained entity instance or null if there is no entity in the container.- Specified by:
getItemOrNullin interfaceInstanceContainer<E>
-
getItem
Description copied from interface:InstanceContainerReturns the contained entity instance.- Specified by:
getItemin interfaceInstanceContainer<E>
-
setItem
Description copied from interface:InstanceContainerSets the given entity instance to the container.- Specified by:
setItemin interfaceInstanceContainer<E>
-
getEntityMetaClass
Description copied from interface:InstanceContainerReturns the meta-class of entities that can be stored in the container.- Specified by:
getEntityMetaClassin interfaceInstanceContainer<E>
-
getFetchPlan
Description copied from interface:InstanceContainerReturns the view which was set by previous call toInstanceContainer.setFetchPlan(FetchPlan). The view is normally used when loading entities for this container.- Specified by:
getFetchPlanin interfaceInstanceContainer<E>
-
setFetchPlan
Sets theFetchPlanfor the instance container.- Specified by:
setFetchPlanin interfaceInstanceContainer<E>- Parameters:
fetchPlan- theFetchPlaninstance to be set
-
addItemPropertyChangeListener
public Subscription addItemPropertyChangeListener(Consumer<InstanceContainer.ItemPropertyChangeEvent<E>> listener) Description copied from interface:InstanceContainerAdds listener toInstanceContainer.ItemPropertyChangeEvents.- Specified by:
addItemPropertyChangeListenerin interfaceInstanceContainer<E>
-
addItemChangeListener
Description copied from interface:InstanceContainerAdds listener toInstanceContainer.ItemChangeEvents.- Specified by:
addItemChangeListenerin interfaceInstanceContainer<E>
-
attachListener
-
detachListener
-
toString
-
getLoader
Description copied from interface:HasLoaderReturns the loader of this container. -
setLoader
Description copied from interface:HasLoaderSets the loader for this container. -
fireItemChanged
-
itemPropertyChanged
Description copied from interface:ItemPropertyChangeNotifierHandles changes to a specific property of an item. This method is called whenever a property of an item changes, providing details about the item, the property, and its old and new values.- Specified by:
itemPropertyChangedin interfaceItemPropertyChangeNotifier- Parameters:
e- anEntityPropertyChangeEventobject containing information about the changed property
-
mute
public void mute()Description copied from interface:InstanceContainerDisables all event listeners on container data change.
Can be used withInstanceContainer.unmute()for bulk data modification as a perfomance optimization.- Specified by:
mutein interfaceInstanceContainer<E>
-
unmute
public void unmute()Description copied from interface:InstanceContainerEnables all event listeners. No events are fired on this call.- Specified by:
unmutein interfaceInstanceContainer<E>
-