public interface InstanceContainer<E extends Entity>
InstanceContainer holds a single entity instance.
CollectionContainer| Modifier and Type | Interface and Description |
|---|---|
static class |
InstanceContainer.ItemChangeEvent<T extends Entity>
Event sent when the entity instance selected in the container is replaced with another instance or null.
|
static class |
InstanceContainer.ItemPropertyChangeEvent<T extends Entity>
Event sent on changing a property value of the contained entity instance.
|
| Modifier and Type | Method and Description |
|---|---|
Subscription |
addItemChangeListener(java.util.function.Consumer<InstanceContainer.ItemChangeEvent<E>> listener)
Adds listener to
InstanceContainer.ItemChangeEvents. |
Subscription |
addItemPropertyChangeListener(java.util.function.Consumer<InstanceContainer.ItemPropertyChangeEvent<E>> listener)
Adds listener to
InstanceContainer.ItemPropertyChangeEvents. |
MetaClass |
getEntityMetaClass()
Returns the meta-class of entities that can be stored in the container.
|
E |
getItem()
Returns the contained entity instance.
|
E |
getItemOrNull()
Returns the contained entity instance or null if there is no entity in the container.
|
View |
getView()
Returns the view which was set by previous call to
setView(View). |
void |
mute()
Disables all event listeners on container data change.
|
void |
setItem(E entity)
Sets the given entity instance to the container.
|
void |
setView(View view)
Sets a view to be used when loading entities for this container.
|
void |
unmute()
Enables all event listeners.
|
@Nonnull E getItem()
java.lang.IllegalStateException - if there is no entity in the containervoid setItem(@Nullable
E entity)
@Nullable E getItemOrNull()
MetaClass getEntityMetaClass()
@Nullable View getView()
setView(View).
The view is normally used when loading entities for this container.void setView(View view)
Subscription addItemPropertyChangeListener(java.util.function.Consumer<InstanceContainer.ItemPropertyChangeEvent<E>> listener)
InstanceContainer.ItemPropertyChangeEvents.Subscription addItemChangeListener(java.util.function.Consumer<InstanceContainer.ItemChangeEvent<E>> listener)
InstanceContainer.ItemChangeEvents.void mute()
unmute() for bulk data modification as a perfomance optimization.void unmute()