Package com.storedobject.ui
Class ObjectTree<T extends StoredObject>
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>
com.storedobject.ui.DataTreeGrid<T>
com.storedobject.ui.ObjectTree<T>
- All Implemented Interfaces:
Executable,Reentrant,FilterMethods<T>,HasLogic,ObjectLoader<T>,ObjectSearcher<T>,ObjectSetter<T>,ObjectsSetter<T>,ObjectGridData<T,,T> ObjectLoader<T>,Transactional,ChildVisitor<T,,T> 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,Consumer<T>
- Direct Known Subclasses:
ObjectTreeBrowser
public class ObjectTree<T extends StoredObject>
extends DataTreeGrid<T>
implements ObjectGridData<T,T>, ChildVisitor<T,T>
- 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
ConstructorsConstructorDescriptionObjectTree(boolean large, Class<T> objectClass, Iterable<String> columns, boolean any, int linkType) ObjectTree(Class<T> objectClass) ObjectTree(Class<T> objectClass, boolean any) ObjectTree(Class<T> objectClass, boolean any, int linkType) ObjectTree(Class<T> objectClass, int linkType) ObjectTree(Class<T> objectClass, Iterable<String> columns) ObjectTree(Class<T> objectClass, Iterable<String> columns, boolean any) ObjectTree(Class<T> objectClass, Iterable<String> columns, boolean any, int linkType) ObjectTree(Class<T> objectClass, Iterable<String> columns, int linkType) -
Method Summary
Modifier and TypeMethodDescriptionbooleanactionAllowed(String action) Check whether a specific action is allowed or not.com.vaadin.flow.shared.RegistrationbooleancanAllowAction(String action) Same asactionAllowed(String)except that this shows a message to the user about it if the action is not allowed.voidclear()Clear - remove all entries.protected ObjectEditor<T> voiddeselectChildren(T parent, boolean includeGrandChildren) Deselect all children of the parent item.voiddraggedAndDropped(T droppedItem) Handles the drag-and-drop operation for moving an item within a data tree structure.voidEnables drag-and-drop functionality within the grid.protected StringPrefix string added to the "action" string to determine the actualUIActionto be checked.Get the current Application.final ObjectTreeProvider<T> Retrieves the data tree structured as an ObjectTree for the current context.final ObjectTreeProvider<T> final TRetrieves the currently dragged item.final LogicgetLogic()Get the logic.Class of the object accepted.final ObjectEditor<T> getRoot()com.vaadin.flow.component.ComponentGet the component for creating the view - SeeHasColumns.getView(boolean)andExecutableView.getView().Retrieves a list of root elements in the hierarchical structure.voidloaded()voidselectChildren(T parent, boolean includeGrandChildren) Select all children of the parent item.voidsetDropAction(BiFunction<ObjectTree<T>, T, Boolean> dropAction) Sets the drop action to be executed during a drop operation.voidsetItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) final voidSet the logic.voidsetNewObjectGenerator(NewObject<T> newObject) voidSet the object.voidsetObjectEditor(ObjectEditor<T> editor) voidsetObjectSetter(ObjectSetter<T> setter) final voidsetRoots(ObjectIterator<T> roots) final voidvoidstreamChildren(T parent) Produces a stream of child elements for the given parent element.Methods inherited from class com.storedobject.vaadin.DataTreeGrid
addConstructedListener, addHierarchyColumn, appendFooter, clearConstructedListeners, createHierarchyColumn, createHTMLHierarchyColumn, getColumnByKey, getColumns, getSOGrid, isColumnReorderingAllowed, isColumnSortable, setColumnReorderingAllowed, streamConstructedListenersMethods inherited from class com.vaadin.flow.component.treegrid.TreeGrid
addCollapseListener, addComponentHierarchyColumn, addExpandListener, collapse, collapse, collapse, collapseRecursively, collapseRecursively, createDefaultArrayUpdater, expand, expand, expand, expandRecursively, expandRecursively, getDataCommunicator, 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.ui.util.ChildVisitor
listChildren, streamRoots, visitAll, visitAll, visitAll, visitAll, visitChildren, visitChildren, visitChildren, visitChildrenMethods 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.common.Executable
actMethods 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.storedobject.core.FilterMethods
getFilterCondition, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setLoadFilter, setViewFilter, setViewFilterMethods 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
addConstructedListener, addItemSelectedListener, addItemsSelectedListener, appendFooter, appendHeader, clearAlerts, clearConstructedListeners, compact, configure, constructed, createColumn, createColumn, createColumn, createColumn, createColumn, createComponentColumn, createDecoratedWindow, createFooters, createHeader, createHeaders, createHierarchyColumn, createHTMLColumn, createHTMLHierarchyColumn, createView, customizeColumn, customizeRenderer, deselect, deselect, executing, getCaption, getColumn, getColumnCaption, getColumnCount, getColumnDetail, getColumnFunction, getColumnHeaderComponent, getColumnMethodName, getColumnNames, getColumnOrder, getColumnSorter, getColumnTemplate, getConfigureButton, getDataClass, getDefinedColumnCount, getFixedColumnWidth, getMenuItem, getObjectRendered, getObjectUnwrapped, getRelativeColumnWidth, getRenderedColumnNames, getSelected, getSOGrid, getTextAlign, getView, ignoreCaseForColumnSorting, includeColumn, isColumnFrozen, isColumnResizable, isColumnSortable, isColumnVisible, prependFooter, prependHeader, refresh, refresh, refresh, removeItemSelectedListener, render, select, select, setCaption, setColumnFrozen, setColumnResizable, setColumnVisible, setMethodHandlerHost, sort, sort, sortOrder, sortOrder, streamConstructedListeners, 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.ui.ObjectGridData
canSearch, convert, createSearchBuilder, deselect, deselectAll, doLoad, getEntityFilter, getItem, getLoadFilter, getObjectCount, getSearchBuilder, getSelectionModel, isAllowAny, isSearchMode, populate, populate, populate, resetSearch, scrollTo, search, search, search, select, setLoadFilter, setObjectConsumer, setObjectConsumer, setObjects, setSelectionMode, validateFilterConditionMethods inherited from interface com.storedobject.core.ObjectLoader
applyFilter, canContain, getAllowAny, getLinkType, getMaster, getOrderBy, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, reload, setLinkType, setLinkType, setMaster, setMaster, setOrderBy, setOrderByMethods inherited from interface com.storedobject.ui.ObjectLoader
addDataLoadedListener, applyFilterPredicate, clear, get, getCacheLevel, getEffectiveCondition, getFixedFilter, indexOf, load, setExtraFilter, setExtraFilter, setFilter, setFilter, setFixedFilter, setFixedFilter, setFixedFilter, setFixedFilter, size, streamAll, streamFilteredMethods inherited from interface com.storedobject.core.ObjectSetter
accept, setObjectMethods inherited from interface com.storedobject.common.Reentrant
isReentrantMethods inherited from interface com.storedobject.vaadin.util.SupportWindowMode
createWindowMethods inherited from interface com.storedobject.ui.Transactional
commit, execute, getTransactionManager, run, transact, transact, transactControl, transactControl, transactControl, transactControlMethods inherited from interface com.storedobject.vaadin.ValueChangeHandler
valueChanged
-
Constructor Details
-
ObjectTree
-
ObjectTree
-
ObjectTree
-
ObjectTree
-
ObjectTree
-
ObjectTree
-
ObjectTree
-
ObjectTree
-
ObjectTree
-
-
Method Details
-
getDelegatedLoader
- Specified by:
getDelegatedLoaderin interfaceObjectLoader<T extends StoredObject>
-
getDataProvider
- Specified by:
getDataProviderin interfacecom.vaadin.flow.data.provider.hierarchy.HasHierarchicalDataProvider<T extends StoredObject>- Overrides:
getDataProviderin classcom.vaadin.flow.component.treegrid.TreeGrid<T extends StoredObject>
-
getObjectClass
Description copied from interface:ObjectSetterClass of the object accepted. The default implementation returnsnull.- Specified by:
getObjectClassin interfaceObjectGridData<T extends StoredObject,T extends StoredObject> - Specified by:
getObjectClassin interfaceObjectLoader<T extends StoredObject>- Specified by:
getObjectClassin interfaceObjectSetter<T extends StoredObject>- Returns:
- Class of the object.
-
addObjectDataLoadedListener
-
setItemLabelGenerator
public void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) -
setLogic
Description copied from interface:HasLogicSet the logic. This will be invoked by theApplicationServerwhen theLogicis executed.- Specified by:
setLogicin interfaceHasLogic- Specified by:
setLogicin interfaceTransactional- Parameters:
logic- Logic to set
-
getLogic
-
loaded
public void loaded() -
getViewComponent
public com.vaadin.flow.component.Component getViewComponent()Description copied from interface:HasColumnsGet the component for creating the view - SeeHasColumns.getView(boolean)andExecutableView.getView().- Specified by:
getViewComponentin interfaceHasColumns<T extends StoredObject>- Returns:
- The component for the view. By default, the grid itself is returned.
-
setSplitView
public void setSplitView() -
clear
public void clear()Description copied from interface:ObjectLoaderClear - remove all entries.- Specified by:
clearin interfaceObjectLoader<T extends StoredObject>
-
setObject
Description copied from interface:ObjectSetterSet the object.- Specified by:
setObjectin interfaceObjectGridData<T extends StoredObject,T extends StoredObject> - Specified by:
setObjectin interfaceObjectSetter<T extends StoredObject>- Parameters:
object- Object to set.
-
setObjectSetter
- Specified by:
setObjectSetterin interfaceObjectGridData<T extends StoredObject,T extends StoredObject>
-
getRoot
-
listRoots
Description copied from interface:ChildVisitorRetrieves a list of root elements in the hierarchical structure. This method provides a collection of elements that serve as entry points or origins in the structure.- Specified by:
listRootsin interfaceChildVisitor<T extends StoredObject,T extends StoredObject> - Returns:
- a List of elements of type P representing the root elements
-
streamChildren
Description copied from interface:ChildVisitorProduces a stream of child elements for the given parent element. This allows traversal or processing of direct child elements in a hierarchical structure.- Specified by:
streamChildrenin interfaceChildVisitor<T extends StoredObject,T extends StoredObject> - Parameters:
parent- the parent element whose children are to be streamed- Returns:
- a stream of child elements directly associated with the specified parent
-
setRoots
-
setRoots
-
getApplication
Description copied from interface:HasColumnsGet the current Application.- Specified by:
getApplicationin interfaceExecutableView- Specified by:
getApplicationin interfaceHasColumns<T extends StoredObject>- Returns:
- Current Application.
-
setObjectEditor
-
getObjectEditor
-
createObjectEditor
-
setNewObjectGenerator
-
selectChildren
Select all children of the parent item.- Parameters:
parent- Parent item.includeGrandChildren- Whether recursively include grand-children or not.
-
deselectChildren
Deselect all children of the parent item.- Parameters:
parent- Parent item.includeGrandChildren- Whether recursively include grand-children or not.
-
getActionPrefix
Prefix string added to the "action" string to determine the actualUIActionto be checked. SeeactionAllowed(String). For example,POBrowserreturns the value "PO" for this method.- Returns:
- Prefix string. The default implementation returns null. That means that all the actions are allowed.
-
actionAllowed
Check whether a specific action is allowed or not. An action is defined in the UI logic as a keyword like "SEND-ITEMS", "PLACE-ORDER", "RECEIVE-ITEMS", "PRINT-VOUCHER", etc. and there could be corresponding access control applicable within the logic. The user's groups determine whether that user can carry out that action or not. This method returnstrue/falseto denote that the user can carry out the action or not. However, it is up to the logic to decide the course of action.The user's groups can be configured to allow various UI actions (
UIAction. EachUIActionrepresents a unique "action" string (UIAction.getAction()) and that value should be equal togetActionPrefix()+ "-" + action to allow that action.- Parameters:
action- Action string.- Returns:
- True/false. Please note that it will always return
trueifgetActionPrefix()returnsnull.
-
canAllowAction
Same asactionAllowed(String)except that this shows a message to the user about it if the action is not allowed.- Parameters:
action- Action string.- Returns:
- True/false.
-
getDataTree
Retrieves the data tree structured as an ObjectTree for the current context.- Returns:
- an ObjectTree instance representing the hierarchical data structure.
-
setDropAction
Sets the drop action to be executed during a drop operation.- Parameters:
dropAction- a BiFunction that takes an ObjectTree and an object of type T as parameters and returns a Boolean indicating whether the drop operation is allowed or not
-
getDraggedItem
Retrieves the currently dragged item.- Returns:
- the dragged item of type T, or null if no item is being dragged
-
draggedAndDropped
Handles the drag-and-drop operation for moving an item within a data tree structure. This method performs validation on the dropped item, checks the drop action callback, and modifies the tree structure based on the movement of the dragged item.- Parameters:
droppedItem- The item on which the dragged item is being dropped. This represents the target node in the tree structure where the dragged item will be linked.
-
enableDragAndDrop
public void enableDragAndDrop()Enables drag-and-drop functionality within the grid. When invoked, it ensures that rows can be dragged and dropped. It sets the drag event listeners to manage the behavior during drag and drop operations: - Configures rows to be draggable, preventing multiple re-initializations. - Sets up a drag start listener that captures the dragged item and applies a drop filter to prevent dropping onto itself. - Configures a drop listener to handle actions when an item is dropped onto a valid target. - Sets up a drag end listener to clear the dragged item once the operation is complete.
-