Package com.storedobject.ui
Class DataGrid<T>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.grid.Grid<T>
com.storedobject.vaadin.DataGrid<T>
com.storedobject.vaadin.ListGrid<T>
com.storedobject.ui.DataGrid<T>
- All Implemented Interfaces:
Executable,Reentrant,HasLogic,Transactional,ViewFilterSupport<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>> Serializable,Iterable<T>,Runnable,Collection<T>,EventListener,List<T>,SequencedCollection<T>
- Direct Known Subclasses:
AbstractEditableGrid,LocateItem,ManageSalutation,ManageSuffix,ObjectHistoryGrid,ObjectListGrid,StatusGrid,XGrid
- 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanactionAllowed(String action) Check whether a specific action is allowed or not.voidInform the grid that we have appended an item.final booleancanAllowAction(String action) Same asactionAllowed(String)except that this shows a message to the user about it if the action is not allowed.protected com.vaadin.flow.data.provider.ListDataProvider<T> createListDataProvider(DataList<T> data) Create an instance ofListDataProviderfor the given data.protected voiddoAppendAction(T object) Carry out the append action for the object.protected voiddoDeleteAction(T object) Carry out the delete action for the object.protected voiddoInsertAction(T object) Carry out the insert action for the object.protected voiddoReloadAction(T object) Carry out the reload action for the object.protected voidCarry out the "reload all" action.protected voiddoUndeleteAction(T object) Carry out the undelete action for the object.protected voiddoUpdateAction(T object) Carry out the update action for the object.protected StringPrefix string that is added to the "action" string to determine the actualUIActionto be checked.protected booleanfinal voiditemAppended(T object) Inform the grid that we have appended an item.final voiditemDeleted(T object) Inform the grid that we have deleted an item.final voiditemInserted(T object) Inform the grid that we have inserted a new item.final voiditemReloaded(T object) Inform the grid that we have reloaded an item.final voiditemUndeleted(T object) Inform the grid that we have undeleted an item.final voiditemUpdated(T object) Inform the grid that we have updated an item.voidload(Collection<T> items) voidselected()Get the currently selected instance.protected Tfinal com.vaadin.flow.component.grid.dataview.GridLazyDataView<T> final com.vaadin.flow.component.grid.dataview.GridLazyDataView<T> final com.vaadin.flow.component.grid.dataview.GridLazyDataView<T> setItems(com.vaadin.flow.data.provider.CallbackDataProvider.FetchCallback<T, Void> fetchCallback, com.vaadin.flow.data.provider.CallbackDataProvider.CountCallback<T, Void> countCallback) final com.vaadin.flow.component.grid.dataview.GridDataView<T> final com.vaadin.flow.component.grid.dataview.GridDataView<T> final com.vaadin.flow.component.grid.dataview.GridListDataView<T> final com.vaadin.flow.component.grid.dataview.GridListDataView<T> setItems(Collection<T> items) final com.vaadin.flow.component.grid.dataview.GridListDataView<T> final voidsort(Comparator<? super T> comparator) final voidprotected voidvalidateAppend(T object) This is invoked when an item is being appended.protected voidvalidateDelete(T object) This is invoked when an item is being deleted.protected voidvalidateInsert(T object) This is invoked when a newly created item is being inserted.protected voidvalidateReload(T object) This is invoked when an item is being undeleted.protected voidvalidateUndelete(T object) This is invoked when an item is being undeleted.protected voidvalidateUpdate(T object) This is invoked when an item is being updated.Methods inherited from class com.storedobject.vaadin.ListGrid
add, add, addAll, addAll, addViewFilter, clear, clearViewFilters, contains, containsAll, get, getData, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, onAttach, onDetach, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, setData, setViewFilter, size, subList, toArray, toArrayMethods inherited from class com.storedobject.vaadin.DataGrid
addConstructedListener, appendFooter, clearConstructedListeners, getColumnByKey, getColumns, getSOGrid, isColumnReorderingAllowed, setColumnReorderingAllowed, streamConstructedListenersMethods 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, createDefaultArrayUpdater, createEditor, createSortingComparator, deselect, deselectAll, getAriaLabel, getArrayUpdater, getBeanType, getClassNameGenerator, getColumnByInternalId, getColumnLayers, getColumnRendering, getDataCommunicator, getDefaultColumnFactory, getDefaultHeaderRow, getDragFilter, getDropFilter, getDropMode, getEditor, getEmptyStateComponent, getEmptyStateText, getFooterRows, getGenericDataView, getHeaderRows, getLazyDataView, getListDataView, getNestedNullBehavior, getPageSize, getPartNameGenerator, getPropertySet, getSelectedItems, getSelectionMode, getSelectionModel, getSelectionPreservationMode, getSortOrder, getTooltipPosition, getUniqueKeyProperty, getUniqueKeyProvider, initConnector, insertColumnLayer, isAllRowsVisible, isDetailsVisible, isDetailsVisibleOnClick, isMultiSort, isRowsDraggable, onDataProviderChange, onEnabledStateChanged, prependFooterRow, prependHeaderRow, recalculateColumnWidths, removeAllColumns, removeAllFooterRows, removeAllHeaderRows, removeColumn, removeColumnByKey, removeColumnLayer, removeColumns, removeFooterRow, removeHeaderRow, removeThemeVariants, scrollToEnd, scrollToIndex, scrollToItem, scrollToStart, select, setAllRowsVisible, setAriaLabel, setClassNameGenerator, setColumnKey, setColumnOrder, setColumnOrder, setColumnRendering, setColumns, setDataProvider, setDefaultMultiSortPriority, setDetailsVisible, setDetailsVisibleOnClick, setDragDataGenerator, setDragFilter, setDropFilter, setDropMode, setEmptyStateComponent, setEmptyStateText, setItemDetailsRenderer, setItemSelectableProvider, setItemsPageable, setItemsPageable, setMultiSort, setMultiSort, setMultiSort, setMultiSort, setNestedNullBehavior, setPageSize, setPartNameGenerator, setRowsDraggable, setSelectionDragDetails, setSelectionMode, setSelectionModel, setSelectionPreservationMode, setSortableColumns, setTooltipGenerator, setTooltipPosition, setUniqueKeyProperty, setUniqueKeyProvider, 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 java.util.Collection
parallelStream, stream, toArrayMethods 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.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, createHierarchyColumn, createHTMLColumn, createHTMLHierarchyColumn, 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, isColumnSortable, 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.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 java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, reversed, spliteratorMethods 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, getLogic, getTransactionManager, run, setLogic, transact, transact, transactControl, transactControl, transactControl, transactControlMethods inherited from interface com.storedobject.vaadin.ValueChangeHandler
valueChangedMethods inherited from interface com.storedobject.ui.util.ViewFilterSupport
configure, configure, configure, configureMatch, filterView, getViewFilter
-
Constructor Details
-
DataGrid
-
DataGrid
-
DataGrid
-
-
Method Details
-
isValid
-
createListDataProvider
protected com.vaadin.flow.data.provider.ListDataProvider<T> createListDataProvider(DataList<T> data) Description copied from class:ListGridCreate an instance ofListDataProviderfor the given data. The default implementation creates an instance of Vaadin's implementation. However, a modified implementation can be provided instead.- Overrides:
createListDataProviderin classListGrid<T>- Parameters:
data- Data for which data provider needs to be created.- Returns:
- An instance of the
ListDataProvider.
-
getDataProvider
- Specified by:
getDataProviderin interfaceViewFilterSupport<T>- Overrides:
getDataProviderin classListGrid<T>
-
setItems
-
setItems
-
setItems
-
setItems
-
setItems
-
setItems
-
setItems
@SafeVarargs public final com.vaadin.flow.component.grid.dataview.GridListDataView<T> setItems(T... items) -
setItems
public final com.vaadin.flow.component.grid.dataview.GridListDataView<T> setItems(Collection<T> items) -
load
-
load
-
selected
-
selected
Get the currently selected instance. If nothing is selected, a warning message is displayed andnullis returned. (If you simply want to a find the selected instance without displaying a warning message, you may useHasColumns.getSelected()).- Returns:
- Selected instance or
null.
-
sort
-
sort
-
getObjectClass
- Specified by:
getObjectClassin interfaceViewFilterSupport<T>
-
itemAppended
Inform the grid that we have appended an item. It will append the item to the grid only ifvalidateAppend(Object)doesn't raise any exception. For appending the item, it invokesdoAppendAction(Object)method.- Parameters:
object- Item that is newly added.
-
doAppendAction
Carry out the append action for the object. The object is already validated.- Parameters:
object- Item that is appended.
-
validateAppend
This is invoked when an item is being appended. The item is appended only if this method doesn't raise any exception.- Parameters:
object- Item that is appended.- Throws:
Exception- The exception should be a user-friendly one because it will be displayed on the screen.
-
itemInserted
Inform the grid that we have inserted a new item. It will add the item to the grid only ifvalidateInsert(Object)doesn't raise any exception. For adding the item, it invokesdoInsertAction(Object)method.- Parameters:
object- Item that is newly added.
-
append
Inform the grid that we have appended an item. It will append the item to the grid only ifvalidateAppend(Object)doesn't raise any exception. For appending the item, it invokesdoAppendAction(Object)method.Note: This method is an alias to
itemAppended(Object)method.- Parameters:
object- Item that is newly added.
-
doInsertAction
Carry out the insert action for the object. The object is already validated.- Parameters:
object- Item that is newly added.
-
validateInsert
This is invoked when a newly created item is being inserted. The item is added only if this method doesn't raise any exception.- Parameters:
object- Item that is newly added.- Throws:
Exception- The exception should be a user-friendly one because it will be displayed on the screen.
-
itemUpdated
Inform the grid that we have updated an item. It will update the item on the grid only ifvalidateUpdate(Object)doesn't raise any exception. For updating the item, it invokesdoUpdateAction(Object)method.- Parameters:
object- Item that is updated.
-
doUpdateAction
Carry out the update action for the object. The object is already validated.- Parameters:
object- Item that is updated.
-
validateUpdate
This is invoked when an item is being updated. The item is updated only if this method doesn't raise any exception.- Parameters:
object- Item that is updated.- Throws:
Exception- The exception should be a user-friendly one because it will be displayed on the screen.
-
itemDeleted
Inform the grid that we have deleted an item. It will delete the item from the grid only ifvalidateDelete(Object)doesn't raise any exception. For deleting the item, it invokesdoDeleteAction(Object)method.- Parameters:
object- Item that is deleted.
-
doDeleteAction
Carry out the delete action for the object. The object is already validated.- Parameters:
object- Item that is deleted.
-
validateDelete
This is invoked when an item is being deleted. The item is deleted only if this method doesn't raise any exception.- Parameters:
object- Item that is deleted.- Throws:
Exception- The exception should have a user-friendly message because it will be displayed on the screen.
-
itemUndeleted
Inform the grid that we have undeleted an item. It will undelete the item from the grid only ifvalidateUndelete(Object)doesn't raise any exception. For undeleting the item, it invokesdoUndeleteAction(Object)method.- Parameters:
object- Item that is deleted.
-
doUndeleteAction
Carry out the undelete action for the object. The object is already validated.- Parameters:
object- Item that is undeleted.
-
validateUndelete
This is invoked when an item is being undeleted. The item is undeleted only if this method doesn't raise any exception.- Parameters:
object- Item that is undeleted.- Throws:
Exception- The exception should be a user-friendly one because it will be displayed on the screen.
-
itemReloaded
Inform the grid that we have reloaded an item. It will reload the item from the grid only ifvalidateReload(Object)doesn't raise any exception. For reloading the item, it invokesdoReloadAction(Object)method.- Parameters:
object- Item that is deleted.
-
doReloadAction
Carry out the reload action for the object. The object is already validated.- Parameters:
object- Item that is undeleted.
-
doReloadAllAction
protected void doReloadAllAction()Carry out the "reload all" action. All validation are already done before invoking this. -
validateReload
This is invoked when an item is being undeleted. The item is undeleted only if this method doesn't raise any exception.- Parameters:
object- Item that is undeleted.- Throws:
Exception- The exception should be a user-friendly one because it will be displayed on the screen.
-
getActionPrefix
Prefix string that is 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. Default implementation returns null unless a static public method named "actionPrefixForUI" exists in the object class. If the method exists, its return value is returned. Returning a null 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 in order 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.
-