Package io.jmix.ui.component
Interface Tree<E>
- Type Parameters:
E- an entity type
- All Superinterfaces:
ActionsHolder,Component,Component.BelongToFrame,Component.Focusable,Component.HasCaption,Component.HasDescription,Component.HasIcon,HasButtonsPanel,HasContextHelp,HasHtmlCaption,HasHtmlDescription,HasHtmlSanitizer,HasItemCaptionProvider<E>,HasSubParts,ListComponent<E>,LookupComponent<E>
- All Known Implementing Classes:
TreeImpl
@StudioComponent(caption="Tree",
category="Components",
xmlElement="tree",
icon="io/jmix/ui/icon/component/tree.svg",
canvasBehaviour=TREE,
documentationURL="https://docs.jmix.io/jmix/%VERSION%/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
A component is intended to display hierarchical structures represented by entities referencing themselves.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classAn event that is fired when an item is collapsed.static classAn event that is fired when an item is expanded.static classEvent sent when the selection changes.static enumNested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.WrapperNested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEventNested classes/interfaces inherited from interface io.jmix.ui.component.LookupComponent
LookupComponent.LookupSelectionChangeEvent<T>, LookupComponent.LookupSelectionChangeNotifier<T> -
Field Summary
FieldsFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Method Summary
Modifier and TypeMethodDescriptionaddCollapseListener(Consumer<Tree.CollapseEvent<E>> listener) Registers a new collapse listener.addExpandListener(Consumer<Tree.ExpandEvent<E>> listener) Registers a new expand listener.addSelectionListener(Consumer<Tree.SelectionEvent<E>> listener) Registers a new selection listener.voidaddStyleProvider(Function<? super E, String> styleProvider) Adds a style provider for tree items.voidCollapses all tree nodes that are lower in level than a given item.voidCollapses tree nodes.voidExpands all tree nodes that are higher in level that a given item.voidExpands all tree nodes.voidexpandUpTo(int level) Expands tree including specified levelGets the item description generator.getItems()booleanbooleanisDetailsVisible(E entity) Checks whether details are visible for the given item.booleanisExpanded(Object itemId) Returns whether an item with given itemId is expanded or collapsed.static <T> org.springframework.core.ParameterizedTypeReference<Tree<T>>voidremoveStyleProvider(Function<? super E, String> styleProvider) Removes a previously added style provider.voidrepaint()Repaints UI representation of the tree including style providers and icon providers without refreshing the tree data.voidsetContentMode(ContentMode contentMode) Sets the content mode of the item captions.voidsetContextMenuEnabled(boolean contextMenuEnabled) Sets whether or not context menu is enabled.voidsetDescriptionProvider(Function<? super E, String> provider) Sets the description generator that is used for generating tooltip descriptions for items.voidsetDescriptionProvider(Function<? super E, String> provider, ContentMode contentMode) Sets the description generator that is used for generating HTML tooltip descriptions for items.voidsetDetailsGenerator(Function<E, Component> generator) Sets a new details generator for item details.voidsetDetailsVisible(E entity, boolean visible) Shows or hides the details for a specific item.voidsetEnterPressAction(Action action) Sets the action to be executed on Enter key press.voidsetIconProvider(Function<? super E, String> iconProvider) Sets the icon provider for the tree.voidsetItemClickAction(Action action) Sets the action to be executed when double-clicking inside a tree node.voidSets aDataUnitsupported by the Tree.voidsetRowHeight(double rowHeight) Sets the height of a row.voidsetSelectionMode(Tree.SelectionMode selectionMode) Sets the Tree's selection mode.voidsetStyleProvider(Function<? super E, String> styleProvider) Sets a single style provider for tree items.Methods inherited from interface io.jmix.ui.component.ActionsHolder
addAction, addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAction, removeAllActionsMethods inherited from interface io.jmix.ui.component.Component
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, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.Focusable
focus, getTabIndex, isFocusable, setFocusable, setTabIndexMethods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaptionMethods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSetMethods inherited from interface io.jmix.ui.component.HasButtonsPanel
getButtonsPanel, setButtonsPanelMethods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledMethods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabledMethods inherited from interface io.jmix.ui.component.HasItemCaptionProvider
getItemCaptionProvider, setItemCaptionProviderMethods inherited from interface io.jmix.ui.component.ListComponent
getSelected, getSingleSelected, isMultiSelect, setSelected, setSelectedMethods inherited from interface io.jmix.ui.component.LookupComponent
getLookupSelectedItems, setLookupSelectHandler
-
Field Details
-
NAME
- See Also:
-
-
Method Details
-
of
-
expandTree
void expandTree()Expands all tree nodes. -
expand
Expands all tree nodes that are higher in level that a given item.- Parameters:
item- an item
-
collapseTree
void collapseTree()Collapses tree nodes. -
collapse
Collapses all tree nodes that are lower in level than a given item.- Parameters:
item- an item
-
expandUpTo
void expandUpTo(int level) Expands tree including specified level- Parameters:
level- level of Tree nodes to expand, if passed level = 1 then root items will be expanded- Throws:
IllegalArgumentException- if level < 1
-
isExpanded
Returns whether an item with given itemId is expanded or collapsed.- Parameters:
itemId- item id to check- Returns:
- true if the item with itemId is expanded, false if collapsed
-
getHierarchyProperty
String getHierarchyProperty()- Returns:
- the name of the property which forms the hierarchy
-
getItems
- Specified by:
getItemsin interfaceListComponent<E>- Returns:
- a
DataUnitsupported by the Tree
-
setItems
Sets aDataUnitsupported by the Tree.- Parameters:
treeItems-DataUnitsupported by the Tree
-
setItemClickAction
Sets the action to be executed when double-clicking inside a tree node.- Parameters:
action- a new action
-
getItemClickAction
- Returns:
- an item double-click action
-
setStyleProvider
Sets a single style provider for tree items.- Parameters:
styleProvider- a style provider to set
-
addStyleProvider
Adds a style provider for tree items.- Parameters:
styleProvider- a style provider to add
-
removeStyleProvider
Removes a previously added style provider.- Parameters:
styleProvider- a style provider to remove
-
setIconProvider
Sets the icon provider for the tree.- Parameters:
iconProvider- an icon provider to set
-
repaint
void repaint()Repaints UI representation of the tree including style providers and icon providers without refreshing the tree data. -
setEnterPressAction
Sets the action to be executed on Enter key press.- Parameters:
action- a new action
-
getEnterPressAction
- Returns:
- an Enter key press action
-
getSelectionMode
Tree.SelectionMode getSelectionMode()- Returns:
- the currently used
Tree.SelectionMode
-
setSelectionMode
@StudioProperty(type=ENUMERATION, defaultValue="SINGLE", options={"SINGLE","MULTI","NONE"}) void setSelectionMode(Tree.SelectionMode selectionMode) Sets the Tree's selection mode.- Parameters:
selectionMode- the selection mode to use
-
isContextMenuEnabled
boolean isContextMenuEnabled()- Returns:
trueif context menu is enabled,falseotherwise
-
setContextMenuEnabled
void setContextMenuEnabled(boolean contextMenuEnabled) Sets whether or not context menu is enabled. Default value istrue.- Parameters:
contextMenuEnabled- specifies whether context menu is enabled
-
setDescriptionProvider
Sets the description generator that is used for generating tooltip descriptions for items.- Parameters:
provider- the description generator to use ornullto remove a previously set provider if any
-
setDescriptionProvider
Sets the description generator that is used for generating HTML tooltip descriptions for items.- Parameters:
provider- the description generator to use ornullto remove a previously set provider if anycontentMode- the content mode for row tooltips
-
getDescriptionProvider
Gets the item description generator.- Returns:
- the item description generator
-
getDetailsGenerator
- Returns:
- the current details generator for item details or
nullif not set
-
setDetailsGenerator
Sets a new details generator for item details.The currently opened item details will be re-rendered.
- Parameters:
generator- the details generator to set
-
isDetailsVisible
Checks whether details are visible for the given item.- Parameters:
entity- the item for which to check details visibility- Returns:
trueif the details are visible
-
setDetailsVisible
Shows or hides the details for a specific item.- Parameters:
entity- the item for which to set details visibilityvisible-trueto show the details, orfalseto hide them
-
addExpandListener
Registers a new expand listener.- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
addCollapseListener
Registers a new collapse listener.- Parameters:
listener- the listener to be added- Returns:
- a registration object for removing an event listener added to a source
-
setRowHeight
Sets the height of a row. If -1 (default), the row height is calculated based on the theme for an empty row before the Tree is displayed.- Parameters:
rowHeight- The height of a row in pixels or -1 for automatic calculation
-
getContentMode
ContentMode getContentMode()- Returns:
- the content mode of the item captions
-
setContentMode
@StudioProperty(type=ENUMERATION, defaultValue="TEXT", options={"TEXT","PREFORMATTED","HTML"}) void setContentMode(ContentMode contentMode) Sets the content mode of the item captions.- Parameters:
contentMode- the content mode
-
addSelectionListener
Registers a new selection listener.- Parameters:
listener- the listener to register
-