Package com.storedobject.ui
Class ObjectListEditor<T extends StoredObject>
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>
com.storedobject.ui.AbstractEditableGrid<T>
com.storedobject.ui.EditableObjectGrid<T>
com.storedobject.ui.ObjectListEditor<T>
- Type Parameters:
T- Type of objects to edit.
- All Implemented Interfaces:
Executable,Reentrant,FilterMethods<T>,HasLogic,ObjectLoader<T>,ObjectSearcher<T>,ObjectSetter<T>,ObjectsSetter<T>,EditableDataGrid<T>,ObjectEditorListener,ObjectGridData<T,,T> ObjectLoader<T>,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,Consumer<T>,List<T>,SequencedCollection<T>
This class can be used to edit a list of
StoredObjects. This may be used directly as a
View (since it is a DataGrid) or
it can be embedded in other layouts.- 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> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Button"Add" button.protected final ButtonLayoutButton panel.protected final Button"Delete" button.protected final Button"Edit" button.protected final Button"Reload" button.protected final Button"Reload All" button.protected final Button"Save All" button.protected final Button"View" button. -
Constructor Summary
ConstructorsConstructorDescriptionObjectListEditor(Class<T> objectClass) Constructor.ObjectListEditor(Class<T> objectClass, Iterable<String> columns) Constructor.ObjectListEditor(Class<T> objectClass, Iterable<String> columns, boolean any) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaboutToSave(Transaction transaction) This method is invoked fromsave(Transaction)when changes are about to be saved to the database.voidadd()Add a new instance via the UI.voidclear()This method doesn't clear the items.voidCreate extra header rows if required here by invokingHasColumns.prependHeader()orHasColumns.appendHeader()(typically useful for creating column grouping etc.).protected voidCustomize the editor that will be used for editing the instances.voiddelete()Delete a selected instance.protected voiddeleted(Transaction transaction, T object) This is invoked when an instance is deleted while saving.protected voiddeletedNow(T object) This will be invoked once an item is deleted.voidedit()Edit a selected instance via the UI.protected com.vaadin.flow.component.HasValue<?, ?> getColumnField(String columnName) Get the field for the column.Get the viewer for this grid.voidHide the Save/Cancel buttons when row editing is active.protected voidinsertedNow(T object) This will be invoked once an item is inserted.final booleanCan add new instances?final booleanCan delete instances?final booleanCan edit instances?final booleanCan reload/restore instances?final booleanCan reload/restore all instances?booleanCan save all changes?final booleanCan view instances?booleanCheck if this editor is in an invalid state or not.voidreload()Reload a selected instance.protected voidThis will be invoked once all items are reloaded.voidsave()Save the currently accumulated changes to the database.voidsave(Transaction transaction) Save the currently accumulated changes to the database.protected voidThis method is invoked after the changes are completely saved to the database.protected voidsaved(Transaction transaction, T object) This is invoked when an instance is saved.selected()Get the currently selected instance.voidsetAllowAdd(boolean allowAdd) Enable/disable adding of new instances.voidsetAllowDelete(boolean allowDelete) Enable/disable deleting of instances.voidsetAllowEdit(boolean allowEdit) Enable/disable editing of instances.voidsetAllowReload(boolean allowReload) Enable/disable reloading/restoring of instances.voidsetAllowReloadAll(boolean allowReloadAll) Enable/disable reloading/restoring of all instances.voidsetAllowSaveAll(boolean allowSaveAll) Enable/disable saving of all changes made.voidsetAllowView(boolean allowView) Enable/disable viewing of instances.voidThis method should be overridden to control the visibility of various buttons.voidsetExternalEditor(ObjectEditor<T> editor) Set an external editor to edit objects of this list editor.voidsetReadOnly(boolean readOnly) Set read only.voidsetSaver(Function<EditableList<T>, Boolean> saver) Set a saver so that thesave()method can be customized.protected booleanskipDelete(Transaction transaction, T object) This method is invoked fromsave(Transaction)when the item is about to delete in the database.protected booleanskipSave(Transaction transaction, T object) This method is invoked fromsave(Transaction)when the item is about to save to the database.protected voidupdatedNow(T object) This will be invoked once an item is updated.voidThis method is invoked by thesave()method and if any exception is thrown, it will not carry out the real "save action".voidview()View the currently selected instance.Methods inherited from class com.storedobject.ui.EditableObjectGrid
add, addAll, addAll, addObjectChangedListener, addValueChangeTracker, append, cancelEdit, canChange, constructObjectEditor, createListDataProvider, createObjectEditor, doDeleteAction, doInsertAction, doReloadAction, doReloadAllAction, doUndeleteAction, doUpdateAction, editItem, getDelegatedLoader, getEditingItem, getField, getObjectEditor, getRowEditor, isColumnEditable, isReadOnly, isValid, reloadedNow, removeObjectChangedListener, saveEdited, setAutoSaveOnMove, setObjectSetter, setViewFilter, streamEditableFields, undeletedNow, validateDataMethods inherited from class com.storedobject.ui.AbstractEditableGrid
changed, createEditableList, createEditor, customizeColumn, delete, getColumnOrder, getEditableList, isAdded, isColumnSortable, isDeleted, isEdited, isFromClient, isSavePending, reload, reloadAll, setEditOnSingleClick, setFromClient, streamAdded, streamAll, streamDeleted, streamEdited, updateMethods inherited from class com.storedobject.ui.DataGrid
actionAllowed, canAllowAction, doAppendAction, getActionPrefix, getDataProvider, getObjectClass, itemAppended, itemDeleted, itemInserted, itemReloaded, itemUndeleted, itemUpdated, load, load, selected, setItems, setItems, setItems, setItems, setItems, setItems, setItems, setItems, sort, sort, validateAppend, validateDelete, validateInsert, validateReload, validateUndelete, validateUpdateMethods inherited from class com.storedobject.vaadin.ListGrid
add, addViewFilter, clearViewFilters, contains, containsAll, get, getData, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, onAttach, onDetach, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, setData, 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, 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.ui.EditableDataGrid
canDelete, canEdit, canPostLedger, canViewLedgerMethods 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, 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, 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, getSOGrid, 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, 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.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.ui.ObjectEditorListener
editingCancelled, editingEnded, editingStartedMethods inherited from interface com.storedobject.ui.ObjectGridData
canSearch, convert, createSearchBuilder, deselect, deselectAll, doLoad, getEntityFilter, getItem, getLoadFilter, getObjectClass, getObjectCount, getSearchBuilder, getSelectionModel, isAllowAny, isSearchMode, populate, populate, populate, resetSearch, scrollTo, search, search, search, select, setLoadFilter, setObject, 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, 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, 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
-
Field Details
-
buttonPanel
Button panel. -
add
"Add" button. -
edit
"Edit" button. -
delete
"Delete" button. -
reload
"Reload" button. -
reloadAll
"Reload All" button. -
view
"View" button. -
saveAll
"Save All" button.
-
-
Constructor Details
-
ObjectListEditor
-
ObjectListEditor
-
ObjectListEditor
-
-
Method Details
-
createHeaders
public void createHeaders()Description copied from interface:HasColumnsCreate extra header rows if required here by invokingHasColumns.prependHeader()orHasColumns.appendHeader()(typically useful for creating column grouping etc.). The default implementation does nothing. This is invoked beforeHasColumns.createHeader(). -
getColumnField
Description copied from class:EditableObjectGridGet the field for the column. (Used while editing the row). In general, it is not required to override this. If this method returnsnull, field will be created from the respective Object Editor.- Overrides:
getColumnFieldin classEditableObjectGrid<T extends StoredObject>- Parameters:
columnName- Column name for which field needs to be obtained.- Returns:
- Default implementation returns
null.
-
hideRowEditorButtons
public void hideRowEditorButtons()Hide the Save/Cancel buttons when row editing is active. -
add
public void add()Add a new instance via the UI. -
edit
public void edit()Edit a selected instance via the UI. -
delete
public void delete()Delete a selected instance. -
reload
public void reload()Reload a selected instance. This will abandon all the changes already made to the instance. If the instance was a newly added one, it will be removed. -
setReadOnly
public void setReadOnly(boolean readOnly) Description copied from class:EditableObjectGridSet read only.- Overrides:
setReadOnlyin classEditableObjectGrid<T extends StoredObject>- Parameters:
readOnly- If true, rows will not be editable.
-
clear
public void clear()Description copied from class:AbstractEditableGridThis method doesn't clear the items. Instead, it just invokes theAbstractEditableGrid.fireChanged(Object, int)method withnullas the item value andEditorAction.ALLas the "change action". Subclasses should implement the real "clear" functionality.- Specified by:
clearin interfaceCollection<T extends StoredObject>- Specified by:
clearin interfaceList<T extends StoredObject>- Specified by:
clearin interfaceObjectLoader<T extends StoredObject>- Overrides:
clearin classEditableObjectGrid<T extends StoredObject>
-
getObjectViewer
Get the viewer for this grid. Ifnullis returned by this method a viewer will be automatically crated by creating an instance of theObjectEditor.- Returns:
- Default implementation returns
null.
-
selected
Description copied from class:DataGridGet 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()).- Overrides:
selectedin classDataGrid<T extends StoredObject>- Returns:
- Selected instance or
null.
-
isInvalid
public boolean isInvalid()Check if this editor is in an invalid state or not. (It will be in invalid state if the current row editor can not be closed because the data is invalid).- Returns:
- True or false.
-
isAllowAdd
public final boolean isAllowAdd()Can add new instances? (This will not affect the programmatic invocation of the methodadd()).- Returns:
- True/false.
-
setAllowAdd
public void setAllowAdd(boolean allowAdd) Enable/disable adding of new instances.- Parameters:
allowAdd- True/false
-
isAllowEdit
public final boolean isAllowEdit()Can edit instances? (This will not affect the programmatic invocation of the methodedit()).- Returns:
- True/false.
-
setAllowEdit
public void setAllowEdit(boolean allowEdit) Enable/disable editing of instances.- Parameters:
allowEdit- True/false.
-
isAllowDelete
public final boolean isAllowDelete()Can delete instances?- Returns:
- True/false.
-
setAllowDelete
public void setAllowDelete(boolean allowDelete) Enable/disable deleting of instances. (This will not affect the programmatic invocation of the methoddelete()).- Parameters:
allowDelete- True/false.
-
isAllowReload
public final boolean isAllowReload()Can reload/restore instances?- Returns:
- True/false.
-
setAllowReload
public void setAllowReload(boolean allowReload) Enable/disable reloading/restoring of instances. (This will not affect the programmatic invocation of the methodreload()).- Parameters:
allowReload- True/false.
-
isAllowReloadAll
public final boolean isAllowReloadAll()Can reload/restore all instances?- Returns:
- True/false.
-
setAllowReloadAll
public void setAllowReloadAll(boolean allowReloadAll) Enable/disable reloading/restoring of all instances. (This will not affect the programmatic invocation of the methodAbstractEditableGrid.reloadAll()).- Parameters:
allowReloadAll- True/false.
-
isAllowView
public final boolean isAllowView()Can view instances?- Returns:
- True/false.
-
setAllowView
public void setAllowView(boolean allowView) Enable/disable viewing of instances. (This will not affect the programmatic invocation of the methodview()).- Parameters:
allowView- True/false.
-
isAllowSaveAll
public boolean isAllowSaveAll()Can save all changes?- Returns:
- True/false.
-
setAllowSaveAll
public void setAllowSaveAll(boolean allowSaveAll) Enable/disable saving of all changes made. (This will not affect the programmatic invocation of the methodssave()andsave(Transaction)).- Parameters:
allowSaveAll- True/false.
-
setButtonVisibility
-
customizeObjectEditor
protected void customizeObjectEditor()Customize the editor that will be used for editing the instances. You can get the editor by invoking the methodEditableObjectGrid.getObjectEditor(). However, you have to make sure to call the super method if you override this method.- Overrides:
customizeObjectEditorin classEditableObjectGrid<T extends StoredObject>
-
setExternalEditor
Set an external editor to edit objects of this list editor.- Parameters:
editor- Editor to set.
-
view
public void view()View the currently selected instance. -
validateData
This method is invoked by thesave()method and if any exception is thrown, it will not carry out the real "save action". Exceptions will be displayed as warning messages on the UI. This method is typically overridden to raise user-friendly messages when data is not valid. (Please note that this method will not be invoked by thesave(Transaction)method).- Throws:
Exception- If any the data is not valid.
-
save
Save the currently accumulated changes to the database. (Please note that this method will not use any "saver" set by thesetSaver(Function)method. In fact, a "saver" may call this method to carry out the real "save action" if required.)- Parameters:
transaction- Transaction.- Throws:
Exception- Will be thrown if the save is not successful.
-
aboutToSave
This method is invoked fromsave(Transaction)when changes are about to be saved to the database. You can override this method to save any related objects that are required before saving the edited items.- Parameters:
transaction- Transaction.- Throws:
Exception- if any error occurs and the save should be aborted.
-
skipSave
This method is invoked fromsave(Transaction)when the item is about to save to the database. If this method returnsfalse, the item is not saved.- Parameters:
transaction- Transaction.object- Item being saved. (It may be still virtual).- Returns:
- True/false.
- Throws:
Exception- if any error occurs and the save should be aborted.
-
skipDelete
This method is invoked fromsave(Transaction)when the item is about to delete in the database. If this method returnsfalse, the item is not deleted.- Parameters:
transaction- Transaction.object- Item being saved.- Returns:
- True/false.
- Throws:
Exception- if any error occurs and the save should be aborted.
-
saved
This is invoked when an instance is saved. You can carry out further save-related actions if any.- Parameters:
object- Instance that is saved.- Throws:
Exception- If an exception is thrown, transaction will be aborted.
-
deleted
This is invoked when an instance is deleted while saving. You can carry out further save-related actions if any.- Parameters:
object- Instance that is deleted.- Throws:
Exception- If an exception is thrown, transaction will be aborted.
-
saveCompleted
protected void saveCompleted()This method is invoked after the changes are completely saved to the database. -
save
public void save()Save the currently accumulated changes to the database. Errors if any will be displayed in the UI.If a saver is set via
setSaver(Function), that saver will be used for saving the changes. Otherwise, aTransactionis created andsave(Transaction)is invoked with that transaction to save the changes. -
setSaver
Set a saver so that thesave()method can be customized.- Parameters:
saver- Set a saver that will be invoked to save the changes made.
-
insertedNow
Description copied from class:EditableObjectGridThis will be invoked once an item is inserted.- Overrides:
insertedNowin classEditableObjectGrid<T extends StoredObject>- Parameters:
object- Item.
-
updatedNow
Description copied from class:EditableObjectGridThis will be invoked once an item is updated.- Overrides:
updatedNowin classEditableObjectGrid<T extends StoredObject>- Parameters:
object- Item.
-
deletedNow
Description copied from class:EditableObjectGridThis will be invoked once an item is deleted.- Overrides:
deletedNowin classEditableObjectGrid<T extends StoredObject>- Parameters:
object- Item.
-
reloadedAllNow
protected void reloadedAllNow()Description copied from class:EditableObjectGridThis will be invoked once all items are reloaded.- Overrides:
reloadedAllNowin classEditableObjectGrid<T extends StoredObject>
-