Package io.jmix.ui.model.impl
Class InstanceContainerImpl<E>
java.lang.Object
io.jmix.ui.model.impl.InstanceContainerImpl<E>
- All Implemented Interfaces:
HasLoader
,ItemPropertyChangeNotifier
,InstanceContainer<E>
- Direct Known Subclasses:
CollectionContainerImpl
,InstancePropertyContainerImpl
,KeyValueContainerImpl
public class InstanceContainerImpl<E>
extends Object
implements InstanceContainer<E>, HasLoader, ItemPropertyChangeNotifier
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.model.InstanceContainer
InstanceContainer.ItemChangeEvent<T>, InstanceContainer.ItemPropertyChangeEvent<T>
-
Field Summary
Modifier and TypeFieldDescriptionprotected MetaClass
protected EventHub
protected FetchPlan
protected E
protected EntityPropertyChangeListener
protected boolean
protected DataLoader
protected Metadata
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds listener toInstanceContainer.ItemChangeEvent
s.Adds listener toInstanceContainer.ItemPropertyChangeEvent
s.protected void
attachListener
(Object entity) protected void
detachListener
(Object entity) protected void
fireItemChanged
(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.void
void
mute()
Disables all event listeners on container data change.void
setFetchPlan
(FetchPlan fetchPlan) Sets a view to be used when loading entities for this container.void
Sets the given entity instance to the container.void
setLoader
(DataLoader loader) Sets the loader for this container.toString()
void
unmute()
Enables all event listeners.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.jmix.ui.model.InstanceContainer
getView, setView
-
Field Details
-
metadata
-
item
-
entityMetaClass
-
fetchPlan
-
events
-
listener
-
loader
-
listenersEnabled
protected boolean listenersEnabled
-
-
Constructor Details
-
InstanceContainerImpl
-
-
Method Details
-
getItemOrNull
Description copied from interface:InstanceContainer
Returns the contained entity instance or null if there is no entity in the container.- Specified by:
getItemOrNull
in interfaceInstanceContainer<E>
-
getItem
Description copied from interface:InstanceContainer
Returns the contained entity instance.- Specified by:
getItem
in interfaceInstanceContainer<E>
-
setItem
Description copied from interface:InstanceContainer
Sets the given entity instance to the container.- Specified by:
setItem
in interfaceInstanceContainer<E>
-
getEntityMetaClass
Description copied from interface:InstanceContainer
Returns the meta-class of entities that can be stored in the container.- Specified by:
getEntityMetaClass
in interfaceInstanceContainer<E>
-
getFetchPlan
Description copied from interface:InstanceContainer
Returns the view which was set by previous call toInstanceContainer.setFetchPlan(FetchPlan)
. The view is normally used when loading entities for this container.- Specified by:
getFetchPlan
in interfaceInstanceContainer<E>
-
setFetchPlan
Description copied from interface:InstanceContainer
Sets a view to be used when loading entities for this container.- Specified by:
setFetchPlan
in interfaceInstanceContainer<E>
-
addItemPropertyChangeListener
public Subscription addItemPropertyChangeListener(Consumer<InstanceContainer.ItemPropertyChangeEvent<E>> listener) Description copied from interface:InstanceContainer
Adds listener toInstanceContainer.ItemPropertyChangeEvent
s.- Specified by:
addItemPropertyChangeListener
in interfaceInstanceContainer<E>
-
addItemChangeListener
Description copied from interface:InstanceContainer
Adds listener toInstanceContainer.ItemChangeEvent
s.- Specified by:
addItemChangeListener
in interfaceInstanceContainer<E>
-
attachListener
-
detachListener
-
toString
-
getLoader
Description copied from interface:HasLoader
Returns the loader of this container. -
setLoader
Description copied from interface:HasLoader
Sets the loader for this container. -
fireItemChanged
-
itemPropertyChanged
- Specified by:
itemPropertyChanged
in interfaceItemPropertyChangeNotifier
-
mute
public void mute()Description copied from interface:InstanceContainer
Disables all event listeners on container data change.
Can be used withInstanceContainer.unmute()
for bulk data modification as a perfomance optimization.- Specified by:
mute
in interfaceInstanceContainer<E>
-
unmute
public void unmute()Description copied from interface:InstanceContainer
Enables all event listeners. No events are fired on this call.- Specified by:
unmute
in interfaceInstanceContainer<E>
-