public interface Tree<E extends Entity> 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 extends Entity>
An event that is fired when an item is collapsed.
|
static interface |
Tree.DetailsGenerator<E extends Entity>
A callback interface for generating details for a particular item in Tree.
|
static class |
Tree.ExpandEvent<E extends Entity>
An event that is fired when an item is expanded.
|
static class |
Tree.SelectionEvent<E extends Entity>
Event sent when the selection changes.
|
static class |
Tree.SelectionMode |
static interface |
Tree.StyleProvider<E extends Entity>
Deprecated.
|
ListComponent.IconProvider<E extends Entity>
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.OptionsStyleProvider, Component.Wrapper
LookupComponent.LookupSelectionChangeEvent<T extends Entity>, LookupComponent.LookupSelectionChangeNotifier<T extends Entity>
HasContextHelp.ContextHelpIconClickEvent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE, UNITS_PERCENTAGE, UNITS_PIXELS
Modifier and Type | Method and Description |
---|---|
Subscription |
addCollapseListener(java.util.function.Consumer<Tree.CollapseEvent<E>> listener)
Registers a new collapse listener.
|
Subscription |
addExpandListener(java.util.function.Consumer<Tree.ExpandEvent<E>> listener)
Registers a new expand listener.
|
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)
Add a style provider for tree items.
|
void |
collapse(E item) |
void |
collapse(java.lang.Object itemId)
Deprecated.
Use
collapse(Entity) instead |
void |
collapseTree() |
void |
expand(E item) |
void |
expand(java.lang.Object itemId)
Deprecated.
Use
expand(Entity) instead |
void |
expandTree() |
void |
expandUpTo(int level)
Expand tree including specified level
|
ContentMode |
getContentMode() |
default HierarchicalDatasource |
getDatasource()
Deprecated.
|
java.util.function.Function<E,java.lang.String> |
getDescriptionProvider()
Gets the item description generator.
|
Tree.DetailsGenerator<E> |
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) |
static <T extends Entity> |
of(java.lang.Class<T> itemClass) |
void |
refresh()
Deprecated.
refresh datasource instead
|
void |
removeStyleProvider(java.util.function.Function<? super E,java.lang.String> styleProvider)
Removes a previously added style provider.
|
void |
repaint()
Repaint 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.
|
default void |
setDatasource(HierarchicalDatasource datasource)
Deprecated.
|
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(Tree.DetailsGenerator<? super E> 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)
Set action to be executed on Enter key press.
|
void |
setIconProvider(java.util.function.Function<? super E,java.lang.String> iconProvider)
Set the icon provider for the tree.
|
void |
setItemClickAction(Action action)
Assign action to be executed on double click inside a tree node.
|
void |
setItems(TreeItems<E> treeItems) |
void |
setMultiSelect(boolean multiselect)
Deprecated.
Use
setSelectionMode(SelectionMode) instead |
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, getHeightUnits, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, getWidthUnits, isEnabled, isEnabledItself, isEnabledRecursive, isResponsive, isVisible, isVisibleItself, isVisibleRecursive, removeStyleName, requestFocus, 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
getCaptionMode, getCaptionProperty, getItemCaptionProvider, setCaptionMode, setCaptionProperty, setItemCaptionProvider
isCaptionAsHtml, setCaptionAsHtml
getCaption, setCaption
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
static final java.lang.String NAME
static <T extends Entity> com.google.common.reflect.TypeToken<Tree<T>> of(java.lang.Class<T> itemClass)
void expandTree()
@Deprecated void expand(java.lang.Object itemId)
expand(Entity)
insteaditemId
- the id of item to expandvoid expand(E item)
void collapseTree()
@Deprecated void collapse(java.lang.Object itemId)
collapse(Entity)
insteaditemId
- the id of item to collapsevoid collapse(E item)
void 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)
java.lang.String getHierarchyProperty()
@Deprecated default void setDatasource(HierarchicalDatasource datasource)
@Deprecated default HierarchicalDatasource getDatasource()
getDatasource
in interface ListComponent<E extends Entity>
TreeItems<E> getItems()
getItems
in interface ListComponent<E extends Entity>
void setItemClickAction(Action action)
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(java.util.function.Function<? super E,java.lang.String> iconProvider)
void repaint()
void setEnterPressAction(Action action)
Action getEnterPressAction()
@Deprecated void setMultiSelect(boolean multiselect)
setSelectionMode(SelectionMode)
insteadmultiselect
- true
for multiselect, false
otherwise@Deprecated void refresh()
Tree.SelectionMode getSelectionMode()
Tree.SelectionMode
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(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(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 tooltipsjava.util.function.Function<E,java.lang.String> getDescriptionProvider()
@Nullable Tree.DetailsGenerator<E> getDetailsGenerator()
null
if not setvoid setDetailsGenerator(Tree.DetailsGenerator<? super E> 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 themSubscription addExpandListener(java.util.function.Consumer<Tree.ExpandEvent<E>> listener)
listener
- the listener to be addedSubscription addCollapseListener(java.util.function.Consumer<Tree.CollapseEvent<E>> listener)
listener
- the listener to be addedvoid setRowHeight(double rowHeight)
rowHeight
- The height of a row in pixels or -1 for automatic calculationContentMode getContentMode()
void setContentMode(ContentMode contentMode)
contentMode
- the content modeSubscription addSelectionListener(java.util.function.Consumer<Tree.SelectionEvent<E>> listener)
listener
- the listener to register