E
- an entity type@StudioComponent(caption="Tree", category="Components", xmlElement="tree", icon="io/jmix/ui/icon/component/tree.svg", canvasBehaviour=TREE, documentationURL="https://docs.jmix.io/jmix/%VERSION%/backoffice-ui/vcl/components/tree.html") public interface Tree<E> extends ListComponent<E>, HasButtonsPanel, Component.HasCaption, Component.HasIcon, LookupComponent<E>, Component.Focusable, HasContextHelp, HasItemCaptionProvider<E>, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer
Modifier and Type | Interface and Description |
---|---|
static class |
Tree.CollapseEvent<E>
An event that is fired when an item is collapsed.
|
static class |
Tree.ExpandEvent<E>
An event that is fired when an item is expanded.
|
static class |
Tree.SelectionEvent<E>
Event sent when the selection changes.
|
static class |
Tree.SelectionMode |
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
LookupComponent.LookupSelectionChangeEvent<T>, LookupComponent.LookupSelectionChangeNotifier<T>
HasContextHelp.ContextHelpIconClickEvent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addCollapseListener(java.util.function.Consumer<Tree.CollapseEvent<E>> listener)
Registers a new collapse listener.
|
io.jmix.core.common.event.Subscription |
addExpandListener(java.util.function.Consumer<Tree.ExpandEvent<E>> listener)
Registers a new expand listener.
|
io.jmix.core.common.event.Subscription |
addSelectionListener(java.util.function.Consumer<Tree.SelectionEvent<E>> listener)
Registers a new selection listener.
|
void |
addStyleProvider(java.util.function.Function<? super E,java.lang.String> styleProvider)
Adds a style provider for tree items.
|
void |
collapse(E item)
Collapses all tree nodes that are lower in level than a given item.
|
void |
collapseTree()
Collapses tree nodes.
|
void |
expand(E item)
Expands all tree nodes that are higher in level that a given item.
|
void |
expandTree()
Expands all tree nodes.
|
void |
expandUpTo(int level)
Expands tree including specified level
|
ContentMode |
getContentMode() |
java.util.function.Function<E,java.lang.String> |
getDescriptionProvider()
Gets the item description generator.
|
java.util.function.Function<E,Component> |
getDetailsGenerator() |
Action |
getEnterPressAction() |
java.lang.String |
getHierarchyProperty() |
Action |
getItemClickAction() |
TreeItems<E> |
getItems() |
Tree.SelectionMode |
getSelectionMode() |
boolean |
isContextMenuEnabled() |
boolean |
isDetailsVisible(E entity)
Checks whether details are visible for the given item.
|
boolean |
isExpanded(java.lang.Object itemId)
Returns whether an item with given itemId is expanded or collapsed.
|
static <T> org.springframework.core.ParameterizedTypeReference<Tree<T>> |
of(java.lang.Class<T> itemClass) |
void |
removeStyleProvider(java.util.function.Function<? super E,java.lang.String> styleProvider)
Removes a previously added style provider.
|
void |
repaint()
Repaints UI representation of the tree including style providers and icon providers without refreshing
the tree data.
|
void |
setContentMode(ContentMode contentMode)
Sets the content mode of the item captions.
|
void |
setContextMenuEnabled(boolean contextMenuEnabled)
Sets whether or not context menu is enabled.
|
void |
setDescriptionProvider(java.util.function.Function<? super E,java.lang.String> provider)
Sets the description generator that is used for generating tooltip descriptions for items.
|
void |
setDescriptionProvider(java.util.function.Function<? super E,java.lang.String> provider,
ContentMode contentMode)
Sets the description generator that is used for generating HTML tooltip descriptions for items.
|
void |
setDetailsGenerator(java.util.function.Function<E,Component> generator)
Sets a new details generator for item details.
|
void |
setDetailsVisible(E entity,
boolean visible)
Shows or hides the details for a specific item.
|
void |
setEnterPressAction(Action action)
Sets the action to be executed on Enter key press.
|
void |
setIconProvider(java.util.function.Function<? super E,java.lang.String> iconProvider)
Sets the icon provider for the tree.
|
void |
setItemClickAction(Action action)
Sets the action to be executed when double-clicking inside a tree node.
|
void |
setItems(TreeItems<E> treeItems)
Sets a
DataUnit supported by the Tree. |
void |
setRowHeight(double rowHeight)
Sets the height of a row.
|
void |
setSelectionMode(Tree.SelectionMode selectionMode)
Sets the Tree's selection mode.
|
void |
setStyleProvider(java.util.function.Function<? super E,java.lang.String> styleProvider)
Sets a single style provider for tree items.
|
getSelected, getSingleSelected, isMultiSelect, setSelected, setSelected
getFrame, setFrame
addAction, addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAction, removeAllActions
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
getButtonsPanel, setButtonsPanel
getIcon, setIcon, setIconFromSet
getLookupSelectedItems, setLookupSelectHandler
focus, getTabIndex, isFocusable, setFocusable, setTabIndex
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
getItemCaptionProvider, setItemCaptionProvider
isCaptionAsHtml, setCaptionAsHtml
getCaption, setCaption
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
static final java.lang.String NAME
static <T> org.springframework.core.ParameterizedTypeReference<Tree<T>> of(java.lang.Class<T> itemClass)
void expandTree()
void expand(E item)
item
- an itemvoid collapseTree()
void collapse(E item)
item
- an itemvoid expandUpTo(int level)
level
- level of Tree nodes to expand, if passed level = 1 then root items will be expandedjava.lang.IllegalArgumentException
- if level < 1boolean isExpanded(java.lang.Object itemId)
itemId
- item id to checkjava.lang.String getHierarchyProperty()
@Nullable TreeItems<E> getItems()
getItems
in interface ListComponent<E>
DataUnit
supported by the Treevoid setItems(@Nullable TreeItems<E> treeItems)
DataUnit
supported by the Tree.treeItems
- DataUnit
supported by the Treevoid setItemClickAction(@Nullable Action action)
action
- a new action@Nullable Action getItemClickAction()
void setStyleProvider(@Nullable java.util.function.Function<? super E,java.lang.String> styleProvider)
styleProvider
- a style provider to setvoid addStyleProvider(java.util.function.Function<? super E,java.lang.String> styleProvider)
styleProvider
- a style provider to addvoid removeStyleProvider(java.util.function.Function<? super E,java.lang.String> styleProvider)
styleProvider
- a style provider to removevoid setIconProvider(@Nullable java.util.function.Function<? super E,java.lang.String> iconProvider)
iconProvider
- an icon provider to setvoid repaint()
void setEnterPressAction(@Nullable Action action)
action
- a new action@Nullable Action getEnterPressAction()
Tree.SelectionMode getSelectionMode()
Tree.SelectionMode
@StudioProperty(type=ENUMERATION, defaultValue="SINGLE", options={"SINGLE","MULTI","NONE"}) void setSelectionMode(Tree.SelectionMode selectionMode)
selectionMode
- the selection mode to useboolean isContextMenuEnabled()
true
if context menu is enabled, false
otherwisevoid setContextMenuEnabled(boolean contextMenuEnabled)
true
.contextMenuEnabled
- specifies whether context menu is enabledvoid setDescriptionProvider(@Nullable java.util.function.Function<? super E,java.lang.String> provider)
provider
- the description generator to use or null
to remove a
previously set provider if anyvoid setDescriptionProvider(@Nullable java.util.function.Function<? super E,java.lang.String> provider, ContentMode contentMode)
provider
- the description generator to use or null
to remove a
previously set provider if anycontentMode
- the content mode for row tooltips@Nullable java.util.function.Function<E,java.lang.String> getDescriptionProvider()
@Nullable java.util.function.Function<E,Component> getDetailsGenerator()
null
if not setvoid setDetailsGenerator(@Nullable java.util.function.Function<E,Component> generator)
The currently opened item details will be re-rendered.
generator
- the details generator to setboolean isDetailsVisible(E entity)
entity
- the item for which to check details visibilitytrue
if the details are visiblevoid setDetailsVisible(E entity, boolean visible)
entity
- the item for which to set details visibilityvisible
- true
to show the details, or false
to hide themio.jmix.core.common.event.Subscription addExpandListener(java.util.function.Consumer<Tree.ExpandEvent<E>> listener)
listener
- the listener to be addedio.jmix.core.common.event.Subscription addCollapseListener(java.util.function.Consumer<Tree.CollapseEvent<E>> listener)
listener
- the listener to be added@StudioProperty(defaultValue="-1.0") @Min(value=-1L) void setRowHeight(double rowHeight)
rowHeight
- The height of a row in pixels or -1 for automatic calculationContentMode getContentMode()
@StudioProperty(type=ENUMERATION, defaultValue="TEXT", options={"TEXT","PREFORMATTED","HTML"}) void setContentMode(ContentMode contentMode)
contentMode
- the content modeio.jmix.core.common.event.Subscription addSelectionListener(java.util.function.Consumer<Tree.SelectionEvent<E>> listener)
listener
- the listener to register