Package io.jmix.ui.component.data.tree
Class ContainerTreeItems<E>
java.lang.Object
io.jmix.ui.component.data.tree.ContainerTreeItems<E>
- All Implemented Interfaces:
DataUnit
,ContainerDataUnit<E>
,EntityDataUnit
,EntityTreeItems<E>
,TreeItems<E>
public class ContainerTreeItems<E>
extends Object
implements EntityTreeItems<E>, ContainerDataUnit<E>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.component.data.DataUnit
DataUnit.StateChangeEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.data.TreeItems
TreeItems.ItemSetChangeEvent<T>, TreeItems.SelectedItemChangeEvent<T>, TreeItems.ValueChangeEvent<T>
-
Field Summary
Modifier and TypeFieldDescriptionprotected final CollectionContainer<E>
protected EventHub
protected final String
protected final boolean
-
Constructor Summary
ConstructorDescriptionContainerTreeItems
(CollectionContainer<E> container, String hierarchyProperty) ContainerTreeItems
(CollectionContainer<E> container, String hierarchyProperty, boolean showOrphans) -
Method Summary
Modifier and TypeMethodDescriptionRegisters a new item set change listener.Registers a new selected item change listener.Registers a new state change listener.addValueChangeListener
(Consumer<TreeItems.ValueChangeEvent<E>> listener) Registers a new value change listener.protected void
protected void
protected void
boolean
containsItem
(E item) int
getChildCount
(E parent) getChildren
(E item) getItems()
getState()
boolean
hasChildren
(E item) void
setSelectedItem
(E item) Set current item in the source.int
size()
-
Field Details
-
container
-
hierarchyProperty
-
showOrphans
protected final boolean showOrphans -
events
-
-
Constructor Details
-
ContainerTreeItems
public ContainerTreeItems(CollectionContainer<E> container, String hierarchyProperty, boolean showOrphans) -
ContainerTreeItems
-
-
Method Details
-
containerItemChanged
-
containerCollectionChanged
-
containerItemPropertyChanged
-
getEntityMetaClass
- Specified by:
getEntityMetaClass
in interfaceEntityDataUnit
- Returns:
MetaClass
of an entity contained in the source
-
getSelectedItem
- Specified by:
getSelectedItem
in interfaceEntityTreeItems<E>
- Returns:
- the current item contained in the source
-
setSelectedItem
Description copied from interface:EntityTreeItems
Set current item in the source.- Specified by:
setSelectedItem
in interfaceEntityTreeItems<E>
- Parameters:
item
- the item to set
-
getState
-
getItemId
-
getItem
-
getItems
-
containsItem
- Specified by:
containsItem
in interfaceTreeItems<E>
- Parameters:
item
- an item to check- Returns:
true
if the underlying collection contains an item,false
otherwise
-
size
public int size() -
getChildCount
- Specified by:
getChildCount
in interfaceTreeItems<E>
- Parameters:
parent
- the parent item- Returns:
- child count of the given parent item
-
getChildren
- Specified by:
getChildren
in interfaceTreeItems<E>
- Parameters:
item
- the item to obtain children ornull
to get root items- Returns:
- children of the given item
-
hasChildren
- Specified by:
hasChildren
in interfaceTreeItems<E>
- Parameters:
item
- the item to check- Returns:
true
if the item has children,false
otherwise
-
getParent
-
getHierarchyPropertyName
- Specified by:
getHierarchyPropertyName
in interfaceTreeItems<E>
- Returns:
- the name of the property which forms the hierarchy
-
addStateChangeListener
Description copied from interface:DataUnit
Registers a new state change listener.- Specified by:
addStateChangeListener
in interfaceDataUnit
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addValueChangeListener
Description copied from interface:TreeItems
Registers a new value change listener.- Specified by:
addValueChangeListener
in interfaceTreeItems<E>
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addItemSetChangeListener
Description copied from interface:TreeItems
Registers a new item set change listener.- Specified by:
addItemSetChangeListener
in interfaceTreeItems<E>
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addSelectedItemChangeListener
public Subscription addSelectedItemChangeListener(Consumer<TreeItems.SelectedItemChangeEvent<E>> listener) Description copied from interface:TreeItems
Registers a new selected item change listener.- Specified by:
addSelectedItemChangeListener
in interfaceTreeItems<E>
- Parameters:
listener
- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
getContainer
- Specified by:
getContainer
in interfaceContainerDataUnit<E>
-