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
StoredObject
s. 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.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 ButtonLayout
Button 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 void
aboutToSave
(Transaction transaction) This method is invoked fromsave(Transaction)
when changes are about to be saved to the database.void
add()
Add a new instance via the UI.void
clear()
This method doesn't clear the items.void
Create extra header rows if required here by invokingHasColumns.prependHeader()
orHasColumns.appendHeader()
(typically useful for creating column grouping etc.).protected void
Customize the editor that will be used for editing the instances.void
delete()
Delete a selected instance.protected void
deleted
(Transaction transaction, T object) This is invoked when an instance is deleted while saving.protected void
deletedNow
(T object) This will be invoked once an item is deleted.void
edit()
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.void
Hide the Save/Cancel buttons when row editing is active.protected void
insertedNow
(T object) This will be invoked once an item is inserted.final boolean
Can add new instances? (This will not affect the programmatic invocation of the methodadd()
).final boolean
Can delete instances?final boolean
Can edit instances? (This will not affect the programmatic invocation of the methodedit()
).final boolean
Can reload/restore instances?final boolean
Can reload/restore all instances?boolean
Can save all changes?final boolean
Can view instances?boolean
Check if this editor is in an invalid state or not.void
reload()
Reload a selected instance.protected void
This will be invoked once all items are reloaded.void
save()
Save the currently accumulated changes to the database.void
save
(Transaction transaction) Save the currently accumulated changes to the database.protected void
This method is invoked after the changes are completely saved to the database.protected void
saved
(Transaction transaction, T object) This is invoked when an instance is saved.selected()
Get the currently selected instance.void
setAllowAdd
(boolean allowAdd) Enable/disable adding of new instances.void
setAllowDelete
(boolean allowDelete) Enable/disable deleting of instances.void
setAllowEdit
(boolean allowEdit) Enable/disable editing of instances.void
setAllowReload
(boolean allowReload) Enable/disable reloading/restoring of instances.void
setAllowReloadAll
(boolean allowReloadAll) Enable/disable reloading/restoring of all instances.void
setAllowSaveAll
(boolean allowSaveAll) Enable/disable saving of all changes made.void
setAllowView
(boolean allowView) Enable/disable viewing of instances.void
This method should be overridden to control the visibility of various buttons.void
setExternalEditor
(ObjectEditor<T> editor) Set an external editor to edit objects of this list editor.void
setReadOnly
(boolean readOnly) Set read only.void
setSaver
(Function<EditableList<T>, Boolean> saver) Set a saver so that thesave()
method can be customized.protected boolean
skipDelete
(Transaction transaction, T object) This method is invoked fromsave(Transaction)
when the item is about to delete in the database.protected boolean
skipSave
(Transaction transaction, T object) This method is invoked fromsave(Transaction)
when the item is about to save to the database.protected void
updatedNow
(T object) This will be invoked once an item is updated.void
This method is invoked by thesave()
method and if any exception is thrown, it will not carry out the real "save action".void
view()
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, validateData
Methods 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, update
Methods 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, validateUpdate
Methods 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, 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, 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.ui.EditableDataGrid
canDelete, canEdit, canPostLedger, canViewLedger
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.storedobject.core.FilterMethods
getFilterCondition, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setLoadFilter, setViewFilter
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
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, 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, 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.ui.ObjectEditorListener
editingCancelled, editingEnded, editingStarted
Methods 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, validateFilterCondition
Methods 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, setOrderBy
Methods 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, streamFiltered
Methods inherited from interface com.storedobject.core.ObjectSetter
accept, setObject
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
-
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:HasColumns
Create extra header rows if required here by invokingHasColumns.prependHeader()
orHasColumns.appendHeader()
(typically useful for creating column grouping etc.). Default implementation does nothing. This is invoked beforeHasColumns.createHeader()
. -
getColumnField
Description copied from class:EditableObjectGrid
Get 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:
getColumnField
in 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:EditableObjectGrid
Set read only.- Overrides:
setReadOnly
in classEditableObjectGrid<T extends StoredObject>
- Parameters:
readOnly
- If true, rows will not be editable.
-
clear
public void clear()Description copied from class:AbstractEditableGrid
This method doesn't clear the items. Instead, it just invokes theAbstractEditableGrid.fireChanged(Object, int)
method withnull
as the item value andEditorAction.ALL
as the "change action". Subclasses should implement the real "clear" functionality.- Specified by:
clear
in interfaceCollection<T extends StoredObject>
- Specified by:
clear
in interfaceList<T extends StoredObject>
- Specified by:
clear
in interfaceObjectLoader<T extends StoredObject>
- Overrides:
clear
in classEditableObjectGrid<T extends StoredObject>
-
getObjectViewer
Get the viewer for this grid. Ifnull
is 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:DataGrid
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()
).- Overrides:
selected
in 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:
customizeObjectEditor
in 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, aTransaction
is 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:EditableObjectGrid
This will be invoked once an item is inserted.- Overrides:
insertedNow
in classEditableObjectGrid<T extends StoredObject>
- Parameters:
object
- Item.
-
updatedNow
Description copied from class:EditableObjectGrid
This will be invoked once an item is updated.- Overrides:
updatedNow
in classEditableObjectGrid<T extends StoredObject>
- Parameters:
object
- Item.
-
deletedNow
Description copied from class:EditableObjectGrid
This will be invoked once an item is deleted.- Overrides:
deletedNow
in classEditableObjectGrid<T extends StoredObject>
- Parameters:
object
- Item.
-
reloadedAllNow
protected void reloadedAllNow()Description copied from class:EditableObjectGrid
This will be invoked once all items are reloaded.- Overrides:
reloadedAllNow
in classEditableObjectGrid<T extends StoredObject>
-