Interface TreeDataGrid<E>

Type Parameters:
E - row item type
All Superinterfaces:
ActionsHolder, Component, Component.BelongToFrame, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, DataGrid<E>, HasButtonsPanel, HasContextHelp, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer, HasMinSize, HasPagination, HasSubParts, ListComponent<E>, LookupComponent<E>
All Known Implementing Classes:
TreeDataGridImpl

@StudioComponent(caption="TreeDataGrid", category="Components", xmlElement="treeDataGrid", icon="io/jmix/ui/icon/component/treeDataGrid.svg", canvasBehaviour=TABLE, documentationURL="https://docs.jmix.io/jmix/%VERSION%/ui/vcl/components/tree-data-grid.html") public interface TreeDataGrid<E> extends DataGrid<E>
A DataGrid component for displaying hierarchical tabular data.
  • Field Details

  • Method Details

    • of

      static <T> org.springframework.core.ParameterizedTypeReference<TreeDataGrid<T>> of(Class<T> itemClass)
    • getLevel

      int getLevel(E item)
      Returns the hierarchy level of an item.
      Parameters:
      item - the item to get level
      Returns:
      the level of the given item
    • getItems

      @Nullable TreeDataGridItems<E> getItems()
      Specified by:
      getItems in interface DataGrid<E>
      Specified by:
      getItems in interface ListComponent<E>
      Returns:
      The DataGrid source
    • getHierarchyColumn

      @Nullable DataGrid.Column<E> getHierarchyColumn()
      Get the currently set hierarchy column. The hierarchy column is a column that displays the hierarchy of this DataGrid's data.
      Returns:
      the currently set hierarchy column, or null if no column has been explicitly set
    • setHierarchyColumn

      void setHierarchyColumn(String id)
      Set the column that displays the hierarchy of this DataGrid's data. By default the hierarchy will be displayed in the first column.

      Setting a hierarchy column by calling this method also sets the column to be visible and not hidable.

      Note: Changing the Renderer of the hierarchy column is not supported.

      Parameters:
      id - the column id to use for displaying hierarchy
    • setHierarchyColumn

      void setHierarchyColumn(DataGrid.Column<E> column)
      Set the column that displays the hierarchy of this DataGrid's data. By default the hierarchy will be displayed in the first column.

      Setting a hierarchy column by calling this method also sets the column to be visible and not hidable.

      Note: Changing the Renderer of the hierarchy column is not supported.

      Parameters:
      column - the column to use for displaying hierarchy
    • getItemCollapseAllowedProvider

      Predicate<E> getItemCollapseAllowedProvider()
      Returns:
      the item collapse allowed provider
    • setItemCollapseAllowedProvider

      void setItemCollapseAllowedProvider(Predicate<E> provider)
      Sets the item collapse allowed provider for this TreeDataGrid. The provider should return true for any item that the user can collapse.

      Note: This callback will be accessed often when sending data to the client. The callback should not do any costly operations.

      Parameters:
      provider - the item collapse allowed provider, not null
    • expand

      default void expand(E... items)
      Expands the given items.

      If an item is currently expanded, does nothing. If an item does not have any children, does nothing.

      Parameters:
      items - the items to expand
      See Also:
    • expand

      void expand(Collection<E> items)
      Expands the given items.

      If an item is currently expanded, does nothing. If an item does not have any children, does nothing.

      Parameters:
      items - the items to expand
      See Also:
    • expandRecursively

      default void expandRecursively(Collection<E> items, int depth)
      Expands the given items and their children recursively until the given depth.

      depth describes the maximum distance between a given item and its descendant, meaning that expandRecursively(items, 0) expands only the given items while expandRecursively(items, 2) expands the given items as well as their children and grandchildren.

      This method will not fire events for expanded nodes.

      Parameters:
      items - the items to expand recursively
      depth - the maximum depth of recursion
      See Also:
    • expandAll

      void expandAll()
      Expands all items.

      This method will not fire events for expanded nodes.

    • expandRecursively

      void expandRecursively(Stream<E> items, int depth)
      Expands the given items and their children recursively until the given depth.

      depth describes the maximum distance between a given item and its descendant, meaning that expandRecursively(items, 0) expands only the given items while expandRecursively(items, 2) expands the given items as well as their children and grandchildren.

      This method will not fire events for expanded nodes.

      Parameters:
      items - the items to expand recursively
      depth - the maximum depth of recursion
      See Also:
    • collapse

      default void collapse(E... items)
      Collapse the given items.

      For items that are already collapsed, does nothing.

      Parameters:
      items - the items to collapse
      See Also:
    • collapse

      void collapse(Collection<E> items)
      Collapse the given items.

      For items that are already collapsed, does nothing.

      Parameters:
      items - the items to collapse
      See Also:
    • collapseRecursively

      default void collapseRecursively(Collection<E> items, int depth)
      Collapse the given items and their children recursively until the given depth.

      depth describes the maximum distance between a given item and its descendant, meaning that collapseRecursively(items, 0) collapses only the given items while collapseRecursively(items, 2) collapses the given items as well as their children and grandchildren.

      This method will not fire events for collapsed nodes.

      Parameters:
      items - the items to collapse recursively
      depth - the maximum depth of recursion
      See Also:
    • collapseRecursively

      void collapseRecursively(Stream<E> items, int depth)
      Collapse the given items and their children recursively until the given depth.

      depth describes the maximum distance between a given item and its descendant, meaning that collapseRecursively(items, 0) collapses only the given items while collapseRecursively(items, 2) collapses the given items as well as their children and grandchildren.

      This method will not fire events for collapsed nodes.

      Parameters:
      items - the items to collapse recursively
      depth - the maximum depth of recursion
      See Also:
    • collapseAll

      void collapseAll()
      Collapses all items.

      This method will not fire events for expanded nodes.

    • isExpanded

      boolean isExpanded(E item)
      Returns whether a given item is expanded or collapsed.
      Parameters:
      item - the item to check
      Returns:
      true if the item is expanded, false otherwise
    • addExpandListener

      Subscription addExpandListener(Consumer<TreeDataGrid.ExpandEvent<E>> listener)
      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

      Subscription addCollapseListener(Consumer<TreeDataGrid.CollapseEvent<E>> listener)
      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