Package com.storedobject.vaadin
Class DataTreeGrid<T>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.grid.Grid<T>
com.vaadin.flow.component.treegrid.TreeGrid<T>
com.storedobject.vaadin.DataTreeGrid<T>
- Type Parameters:
T- Bean type
- All Implemented Interfaces:
ClickHandler,ExecutableView,HasColumns<T>,SupportWindowMode,ValueChangeHandler,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.grid.Grid<T>>,com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<? extends com.vaadin.flow.component.Component>>,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.component.HasValue.ValueChangeListener,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.HasDataView<T,,Void, com.vaadin.flow.component.grid.dataview.GridDataView<T>> com.vaadin.flow.data.provider.HasLazyDataView<T,,Void, com.vaadin.flow.component.grid.dataview.GridLazyDataView<T>> com.vaadin.flow.data.provider.HasListDataView<T,,com.vaadin.flow.component.grid.dataview.GridListDataView<T>> com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<T>,Serializable,Runnable,EventListener
- Direct Known Subclasses:
DataTreeGrid
@CssImport("./so/grid/styles.css")
public class DataTreeGrid<T>
extends com.vaadin.flow.component.treegrid.TreeGrid<T>
implements HasColumns<T>
Enhancement to Vaadin's TreeGrid to handle Java Beans in a specialized way. Please note that this is not supporting the functionality supported
by Vaadin's Bean TreeGrid but has similar functionality. The main difference in use is that instead of addColumn methods, one should use the
createColumn methods. createColumn methods just return whether column can be created or not but, columns are created at a later stage
when all columns are defined and the ordinal of columns is determined. If you want to customize any Column, it can be done in
customizeColumn(String, Column) method or by invoking methods provided in this claas
(See the implementation of the interface
HasColumns).
Each column has a "column name" and it gets mapped to the Bean's getXXX
method just like in Vaadin's Bean Grid. However, if a getXXX method is available in the DataGrid itself, that will be used for sourcing the
data for the respective column. Each column uses its respective column name as the key.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.grid.Grid
com.vaadin.flow.component.grid.Grid.AbstractGridExtension<T>, com.vaadin.flow.component.grid.Grid.Column<T>, com.vaadin.flow.component.grid.Grid.DataCommunicatorBuilder<T,U extends com.vaadin.flow.data.provider.ArrayUpdater>, com.vaadin.flow.component.grid.Grid.MultiSortPriority, com.vaadin.flow.component.grid.Grid.NestedNullBehavior, com.vaadin.flow.component.grid.Grid.SelectionMode, com.vaadin.flow.component.grid.Grid.SpringData, 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.storedobject.vaadin.ClickHandler
ClickHandler.ModifiedClickEvent<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>Nested classes/interfaces inherited from interface com.storedobject.vaadin.HasColumns
HasColumns.SOGrid<T> -
Constructor Summary
ConstructorsConstructorDescriptionDataTreeGrid(Class<T> objectClass) Constructor that will generate columns from the Bean's properties.DataTreeGrid(Class<T> objectClass, Iterable<String> columns) Constructor that will generate columns from the column names passed. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddConstructedListener(ConstructedListener constructedListener) Add aConstructedListenerso that we will be informed about when the columns are constructed.com.vaadin.flow.component.grid.Grid.Column<T> addHierarchyColumn(com.vaadin.flow.function.ValueProvider<T, ?> valueProvider) This method always returnnull.Append a footer row.voidClear allConstructedListeners.com.vaadin.flow.component.grid.Grid.Column<T> createHierarchyColumn(String columnName, com.vaadin.flow.function.ValueProvider<T, ?> valueProvider) Add the hierarchy column.com.vaadin.flow.component.grid.Grid.Column<T> createHTMLHierarchyColumn(String columnName, Function<T, ?> htmlFunction) Add an HTML hierarchy column.final com.vaadin.flow.component.grid.Grid.Column<T> getColumnByKey(String columnKey) final HasColumns.SOGrid<T> For internal use only.booleanbooleanisColumnSortable(String columnName) Check if a particular column is sortable or not.voidsetColumnReorderingAllowed(boolean allowColumnReordering) Get the stream ofConstructedListeners what were added to this.Methods inherited from class com.vaadin.flow.component.treegrid.TreeGrid
addCollapseListener, addComponentHierarchyColumn, addExpandListener, collapse, collapse, collapse, collapseRecursively, collapseRecursively, createDefaultArrayUpdater, expand, expand, expand, expandRecursively, expandRecursively, getDataCommunicator, getDataProvider, getGenericDataView, getItemsWithChildrenRecursively, getLazyDataView, getListDataView, isExpanded, scrollToEnd, scrollToIndex, scrollToIndex, scrollToItem, setColumns, setDataProvider, setDataProvider, setHierarchyColumn, setHierarchyColumn, setItems, setItems, setItems, setItems, setItems, setUniqueKeyDataGeneratorMethods inherited from class com.vaadin.flow.component.grid.Grid
addCellFocusListener, 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, configureBeanType, createColumn, createColumnId, createEditor, createSortingComparator, deselect, deselectAll, getAriaLabel, getArrayUpdater, getBeanType, getClassNameGenerator, getColumnByInternalId, getColumnLayers, getColumnRendering, getDefaultColumnFactory, getDefaultHeaderRow, getDragFilter, getDropFilter, getDropMode, getEditor, getEmptyStateComponent, getEmptyStateText, getFooterRows, getHeaderRows, getNestedNullBehavior, getPageSize, getPartNameGenerator, getPropertySet, getSelectedItems, getSelectionMode, getSelectionModel, getSelectionPreservationMode, getSortOrder, getTooltipPosition, getUniqueKeyProperty, getUniqueKeyProvider, initConnector, insertColumnLayer, isAllRowsVisible, isDetailsVisible, isDetailsVisibleOnClick, isMultiSort, isRowsDraggable, onAttach, onDataProviderChange, onDetach, onEnabledStateChanged, prependFooterRow, prependHeaderRow, recalculateColumnWidths, removeAllColumns, removeAllFooterRows, removeAllHeaderRows, removeColumn, removeColumnByKey, removeColumnLayer, removeColumns, removeFooterRow, removeHeaderRow, removeThemeVariants, scrollToStart, select, setAllRowsVisible, setAriaLabel, setClassNameGenerator, setColumnKey, setColumnOrder, setColumnOrder, setColumnRendering, setColumns, setDefaultMultiSortPriority, setDetailsVisible, setDetailsVisibleOnClick, setDragDataGenerator, setDragFilter, setDropFilter, setDropMode, setEmptyStateComponent, setEmptyStateText, setItemDetailsRenderer, setItems, setItems, setItemSelectableProvider, setItemsPageable, setItemsPageable, setMultiSort, setMultiSort, setMultiSort, setMultiSort, setNestedNullBehavior, setPageSize, setPartNameGenerator, setRowsDraggable, setSelectionDragDetails, setSelectionMode, setSelectionModel, setSelectionPreservationMode, setSortableColumns, setTooltipGenerator, setTooltipPosition, setUniqueKeyProperty, setUniqueKeyProvider, sort, updateSelectionModeOnClientMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.storedobject.vaadin.ClickHandler
clicked, doubleClicked, onComponentEvent, rightClickedMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.storedobject.vaadin.ExecutableView
abort, clean, clicked, close, createMenuItem, error, execute, execute, getMenuIconName, getMenuItem, getView, invoke, isCloseable, isFullScreen, isHomeView, log, log, message, returnedFrom, run, setClickable, speak, trackValueChange, tray, valueChanged, warningMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.storedobject.vaadin.HasColumns
addItemSelectedListener, addItemsSelectedListener, appendHeader, clearAlerts, compact, configure, constructed, createColumn, createColumn, createColumn, createColumn, createColumn, createComponentColumn, createDecoratedWindow, createFooters, createHeader, createHeaders, createHTMLColumn, createView, customizeColumn, customizeRenderer, deselect, deselect, executing, getApplication, getCaption, getColumn, getColumnCaption, getColumnCount, getColumnDetail, getColumnFunction, getColumnHeaderComponent, getColumnMethodName, getColumnNames, getColumnOrder, getColumnSorter, getColumnTemplate, getConfigureButton, getDataClass, getDefinedColumnCount, getFixedColumnWidth, getMenuItem, getObjectRendered, getObjectUnwrapped, getRelativeColumnWidth, getRenderedColumnNames, getSelected, getTextAlign, getView, getViewComponent, ignoreCaseForColumnSorting, includeColumn, isColumnFrozen, isColumnResizable, isColumnVisible, prependFooter, prependHeader, refresh, refresh, refresh, removeItemSelectedListener, render, select, select, setCaption, setColumnFrozen, setColumnResizable, setColumnVisible, setMethodHandlerHost, sort, sort, sortOrder, sortOrder, unwrapMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider
getTreeData, setItems, setItems, setTreeDataMethods inherited from interface com.vaadin.flow.data.provider.HasLazyDataView
setItemsMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.storedobject.vaadin.util.SupportWindowMode
createWindowMethods inherited from interface com.storedobject.vaadin.ValueChangeHandler
valueChanged
-
Constructor Details
-
DataTreeGrid
-
DataTreeGrid
-
-
Method Details
-
isColumnSortable
Check if a particular column is sortable or not. (By default, sorting is off.)- Specified by:
isColumnSortablein interfaceHasColumns<T>- Parameters:
columnName- Column name- Returns:
- True or false.
-
getSOGrid
For internal use only.- Specified by:
getSOGridin interfaceHasColumns<T>- Returns:
- SO grid.
-
addConstructedListener
public com.vaadin.flow.shared.Registration addConstructedListener(ConstructedListener constructedListener) Description copied from interface:HasColumnsAdd aConstructedListenerso that we will be informed about when the columns are constructed.- Specified by:
addConstructedListenerin interfaceHasColumns<T>- Parameters:
constructedListener- Listener.- Returns:
- Registration.
-
streamConstructedListeners
Description copied from interface:HasColumnsGet the stream ofConstructedListeners what were added to this.- Specified by:
streamConstructedListenersin interfaceHasColumns<T>- Returns:
- Stream of
ConstructedListeners.
-
clearConstructedListeners
public void clearConstructedListeners()Description copied from interface:HasColumnsClear allConstructedListeners.- Specified by:
clearConstructedListenersin interfaceHasColumns<T>
-
isColumnReorderingAllowed
public boolean isColumnReorderingAllowed()- Overrides:
isColumnReorderingAllowedin classcom.vaadin.flow.component.grid.Grid<T>
-
setColumnReorderingAllowed
public void setColumnReorderingAllowed(boolean allowColumnReordering) - Overrides:
setColumnReorderingAllowedin classcom.vaadin.flow.component.grid.Grid<T>
-
getColumns
-
getColumnByKey
-
addHierarchyColumn
public com.vaadin.flow.component.grid.Grid.Column<T> addHierarchyColumn(com.vaadin.flow.function.ValueProvider<T, ?> valueProvider) This method always returnnull. Instead of this method, usecreateHierarchyColumn(String, ValueProvider).- Overrides:
addHierarchyColumnin classcom.vaadin.flow.component.treegrid.TreeGrid<T>- Parameters:
valueProvider- Value provider for column values- Returns:
null
-
createHierarchyColumn
public com.vaadin.flow.component.grid.Grid.Column<T> createHierarchyColumn(String columnName, com.vaadin.flow.function.ValueProvider<T, ?> valueProvider) Add the hierarchy column. If this or any of its cousin method is never called, the first column created will be made the hierarchy column.- Specified by:
createHierarchyColumnin interfaceHasColumns<T>- Parameters:
columnName- Name of the columnvalueProvider- Value provider for the column- Returns:
- Column created.
-
createHTMLHierarchyColumn
public com.vaadin.flow.component.grid.Grid.Column<T> createHTMLHierarchyColumn(String columnName, Function<T, ?> htmlFunction) Add an HTML hierarchy column. If this or any of its cousin method is never called, the first column created will be made the hierarchy column.- Specified by:
createHTMLHierarchyColumnin interfaceHasColumns<T>- Parameters:
columnName- Name of the columnhtmlFunction- Function that returns HTML content- Returns:
- Column created.
-