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.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 TypeMethodDescriptionboolean
actionAllowed
(String action) Check whether a specific action is allowed or not.void
Inform the grid that we have appended an item.final boolean
canAllowAction
(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 ofListDataProvider
for the given data.protected void
doAppendAction
(T object) Carry out the append action for the object.protected void
doDeleteAction
(T object) Carry out the delete action for the object.protected void
doInsertAction
(T object) Carry out the insert action for the object.protected void
doReloadAction
(T object) Carry out the reload action for the object.protected void
Carry out the "reload all" action.protected void
doUndeleteAction
(T object) Carry out the undelete action for the object.protected void
doUpdateAction
(T object) Carry out the update action for the object.protected String
Prefix string that is added to the "action" string to determine the actualUIAction
to be checked.protected boolean
final void
itemAppended
(T object) Inform the grid that we have appended an item.final void
itemDeleted
(T object) Inform the grid that we have deleted an item.final void
itemInserted
(T object) Inform the grid that we have inserted a new item.final void
itemReloaded
(T object) Inform the grid that we have reloaded an item.final void
itemUndeleted
(T object) Inform the grid that we have undeleted an item.final void
itemUpdated
(T object) Inform the grid that we have updated an item.void
load
(Collection<T> items) void
selected()
Get the currently selected instance.protected T
final 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 void
sort
(Comparator<? super T> comparator) final void
protected void
validateAppend
(T object) This is invoked when an item is being appended.protected void
validateDelete
(T object) This is invoked when an item is being deleted.protected void
validateInsert
(T object) This is invoked when a newly created item is being inserted.protected void
validateReload
(T object) This is invoked when an item is being undeleted.protected void
validateUndelete
(T object) This is invoked when an item is being undeleted.protected void
validateUpdate
(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, toArray
Methods inherited from class com.storedobject.vaadin.DataGrid
addConstructedListener, appendFooter, clearConstructedListeners, getColumnByKey, getColumns, getSOGrid, isColumnReorderingAllowed, setColumnReorderingAllowed, streamConstructedListeners
Methods 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, 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, 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, setMultiSort, setMultiSort, setMultiSort, setMultiSort, setNestedNullBehavior, setPageSize, setPartNameGenerator, setRowsDraggable, setSelectionDragDetails, setSelectionMode, setSelectionModel, setSelectionPreservationMode, setSortableColumns, setTooltipGenerator, setUniqueKeyProperty, setUniqueKeyProvider, updateSelectionModeOnClient
Methods 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, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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.storedobject.vaadin.ClickHandler
clicked, doubleClicked, onComponentEvent, rightClicked
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.storedobject.common.Executable
act
Methods 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, warning
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.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, 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, unwrap
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.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
Methods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, reversed, spliterator
Methods inherited from interface com.storedobject.common.Reentrant
isReentrant
Methods inherited from interface com.storedobject.vaadin.util.SupportWindowMode
createWindow
Methods inherited from interface com.storedobject.ui.Transactional
commit, execute, getLogic, getTransactionManager, run, setLogic, transact, transact, transactControl, transactControl
Methods inherited from interface com.storedobject.vaadin.ValueChangeHandler
valueChanged
Methods 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:ListGrid
Create an instance ofListDataProvider
for the given data. The default implementation creates an instance of Vaadin's implementation. However, a modified implementation can be provided instead.- Overrides:
createListDataProvider
in classListGrid<T>
- Parameters:
data
- Data for which data provider needs to be created.- Returns:
- An instance of the
ListDataProvider
.
-
getDataProvider
- Specified by:
getDataProvider
in interfaceViewFilterSupport<T>
- Overrides:
getDataProvider
in 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 andnull
is 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:
getObjectClass
in 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 actualUIAction
to be checked. SeeactionAllowed(String)
. For example,POBrowser
returns 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/false
to 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
. EachUIAction
represents 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
true
ifgetActionPrefix()
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.
-