Class NavTreeGrid<T extends AbstractNode>

  • Type Parameters:
    T - an abstract node
    All Implemented Interfaces:
    com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.grid.Grid<T>>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.grid.Grid<T>>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.grid.Grid<T>>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.data.binder.HasDataProvider<T>, com.vaadin.flow.data.binder.HasItems<T>, com.vaadin.flow.data.event.SortEvent.SortNotifier<com.vaadin.flow.component.grid.Grid<T>,​com.vaadin.flow.component.grid.GridSortOrder<T>>, com.vaadin.flow.data.provider.HasDataGenerators<T>, com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<T>, Serializable

    public abstract class NavTreeGrid<T extends AbstractNode>
    extends com.vaadin.flow.component.treegrid.TreeGrid<T>
    A tree grid that extends the features of the Tree Grid and makes use of the Nodes API also allows a custom data provider (with treeData) to facilitate the single node refreshing and lazy loading per level, Warning: still has no pagination!
    Author:
    Adrian Martinez Molina <adrian.martinez@kuwaiba.org>
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  NavTreeGrid.TreeDataProvider
      Custom data provider to be used with as a lazy Tree Data
      • Nested classes/interfaces inherited from class com.vaadin.flow.component.grid.Grid

        com.vaadin.flow.component.grid.Grid.AbstractGridExtension<T extends Object>, com.vaadin.flow.component.grid.Grid.Column<T extends Object>, com.vaadin.flow.component.grid.Grid.DataCommunicatorBuilder<T extends Object,​U extends com.vaadin.flow.data.provider.ArrayUpdater>, com.vaadin.flow.component.grid.Grid.NestedNullBehavior, com.vaadin.flow.component.grid.Grid.SelectionMode, com.vaadin.flow.component.grid.Grid.UpdateQueue
      • Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier

        com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>
      • Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier

        com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>
    • Constructor Summary

      Constructors 
      Constructor Description
      NavTreeGrid()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(T node)  
      void copyNode​(T newParentNode)
      Copies a node from a parent to another
      void createDataProvider​(T node)
      Populates the navigation tree
      void expand_​(T node)
      If we are expanding a node that is deeper than the two first levels loaded
      abstract List<T> fetchData​(T node)
      Retrieves data form the data base
      Optional<T> findNodeById​(String id)  
      List<T> getAllNodesAsList()  
      void moveNode​(T newParentNode, T node)
      Moves a node from one parent to another
      void refreshNode​(T node)  
      void remove​(T node)
      Removes a node from the nav tree it will search the parent of the node to be remove in order to update it or if has no parent (is null) will refresh the all the nav tree because there is no other way to refresh the first level/root nodes
      void update​(T node)
      When a node is added we update its father
      • Methods inherited from class com.vaadin.flow.component.treegrid.TreeGrid

        addCollapseListener, addComponentHierarchyColumn, addExpandListener, addHierarchyColumn, collapse, collapse, collapse, collapseRecursively, collapseRecursively, createDefaultArrayUpdater, expand, expand, expand, expandRecursively, expandRecursively, getDataCommunicator, getDataProvider, getItemsWithChildrenRecursively, isExpanded, setColumns, setDataProvider, setHierarchyColumn, setHierarchyColumn, setUniqueKeyDataGenerator
      • Methods inherited from class com.vaadin.flow.component.grid.Grid

        addCellFocusListener, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumn, addColumnReorderListener, addColumnResizeListener, addColumns, addComponentColumn, addContextMenu, addDataGenerator, addDragEndListener, addDragStartListener, addDropListener, addFirstHeaderRow, addItemClickListener, addItemDoubleClickListener, addSelectionListener, addSortListener, addThemeVariants, addValueProvider, appendFooterRow, appendHeaderRow, asMultiSelect, asSingleSelect, compareMaybeComparables, createColumn, createColumnId, createEditor, createSortingComparator, deselect, deselectAll, getArrayUpdater, getBeanType, getClassNameGenerator, getColumnByKey, getColumnLayers, getColumns, getDefaultColumnFactory, getDefaultHeaderRow, getDragFilter, getDropFilter, getDropMode, getEditor, getFooterRows, getHeaderRows, getNestedNullBehavior, getPageSize, getPropertySet, getSelectedItems, getSelectionModel, getSortOrder, getUniqueKeyProperty, getUniqueKeyProvider, initConnector, insertColumnLayer, isAllRowsVisible, isColumnReorderingAllowed, isDetailsVisible, isDetailsVisibleOnClick, isHeightByRows, isMultiSort, isRowsDraggable, isVerticalScrollingEnabled, onAttach, onDataProviderChange, onDetach, onEnabledStateChanged, prependFooterRow, prependHeaderRow, recalculateColumnWidths, removeAllColumns, removeColumn, removeColumnByKey, removeColumnLayer, removeColumns, removeDataGenerator, removeThemeVariants, scrollToEnd, scrollToIndex, scrollToStart, select, setAllRowsVisible, setClassNameGenerator, setColumnKey, setColumnOrder, setColumnOrder, setColumnReorderingAllowed, setColumns, setDetailsVisible, setDetailsVisibleOnClick, setDragDataGenerator, setDragFilter, setDropFilter, setDropMode, setHeightByRows, setItemDetailsRenderer, setMultiSort, setNestedNullBehavior, setPageSize, setRowsDraggable, setSelectionDragDetails, setSelectionMode, setSelectionModel, setSortableColumns, setUniqueKeyProperty, setUniqueKeyProvider, setVerticalScrollingEnabled, sort, updateSelectionModeOnClient
      • Methods inherited from class com.vaadin.flow.component.Component

        addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, set, setElement, setId, setVisible
      • Methods inherited from interface com.vaadin.flow.component.AttachNotifier

        addAttachListener
      • Methods inherited from interface com.vaadin.flow.component.BlurNotifier

        addBlurListener
      • Methods inherited from interface com.vaadin.flow.component.DetachNotifier

        addDetachListener
      • Methods inherited from interface com.vaadin.flow.component.Focusable

        addFocusShortcut, blur, focus, getTabIndex, setTabIndex
      • Methods inherited from interface com.vaadin.flow.component.FocusNotifier

        addFocusListener
      • Methods inherited from interface com.vaadin.flow.component.HasElement

        getElement
      • Methods inherited from interface com.vaadin.flow.component.HasEnabled

        isEnabled, setEnabled
      • Methods inherited from interface com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider

        getTreeData, setItems, setItems, setItems, setItems, setItems, setTreeData
      • Methods inherited from interface com.vaadin.flow.component.HasSize

        getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
      • Methods inherited from interface com.vaadin.flow.component.HasStyle

        addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
      • Methods inherited from interface com.vaadin.flow.component.HasTheme

        addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
    • Constructor Detail

      • NavTreeGrid

        public NavTreeGrid()
    • Method Detail

      • getAllNodesAsList

        public List<T> getAllNodesAsList()
      • contains

        public boolean contains​(T node)
      • refreshNode

        public void refreshNode​(T node)
      • fetchData

        public abstract List<T> fetchData​(T node)
        Retrieves data form the data base
        Parameters:
        node - the root node
        Returns:
        the list of children
      • createDataProvider

        public void createDataProvider​(T node)
        Populates the navigation tree
        Parameters:
        node - the root node of the tree grid
      • update

        public void update​(T node)
        When a node is added we update its father
        Parameters:
        node - the parent node where the new node is been added
      • remove

        public void remove​(T node)
        Removes a node from the nav tree it will search the parent of the node to be remove in order to update it or if has no parent (is null) will refresh the all the nav tree because there is no other way to refresh the first level/root nodes
        Parameters:
        node - the node to be remove
      • moveNode

        public void moveNode​(T newParentNode,
                             T node)
        Moves a node from one parent to another
        Parameters:
        newParentNode - of the moved node
        node - the moved node
      • copyNode

        public void copyNode​(T newParentNode)
        Copies a node from a parent to another
        Parameters:
        newParentNode - the new parent of the copied node
      • expand_

        public void expand_​(T node)
        If we are expanding a node that is deeper than the two first levels loaded
        Parameters:
        node - the node to loadChildrenOf