Class DataGridEditorImpl<T>
java.lang.Object
com.vaadin.flow.component.grid.Grid.AbstractGridExtension<T>
io.jmix.flowui.component.grid.editor.DataGridEditorImpl<T>
- All Implemented Interfaces:
com.vaadin.flow.component.grid.editor.Editor<T>,com.vaadin.flow.data.provider.DataGenerator<T>,DataGridDataProviderChangeObserver,DataGridEditor<T>,Serializable
public class DataGridEditorImpl<T>
extends com.vaadin.flow.component.grid.Grid.AbstractGridExtension<T>
implements DataGridEditor<T>, DataGridDataProviderChangeObserver
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected booleanprotected Consumer<SupportsStatusChangeHandler.StatusContext<?>>protected Tprotected com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.internal.ExecutionContext>protected Map<T,DataGridEditorValueSourceProvider<T>> protected booleanprotected Consumer<ValidationErrors> -
Constructor Summary
ConstructorsConstructorDescriptionDataGridEditorImpl(com.vaadin.flow.component.grid.Grid<T> grid, org.springframework.context.ApplicationContext applicationContext) -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddCancelListener(com.vaadin.flow.component.grid.editor.EditorCancelListener<T> listener) com.vaadin.flow.shared.RegistrationaddCloseListener(com.vaadin.flow.component.grid.editor.EditorCloseListener<T> listener) protected <L> com.vaadin.flow.shared.RegistrationaddListener(Class<L> listenerType, L listener) com.vaadin.flow.shared.RegistrationaddOpenListener(com.vaadin.flow.component.grid.editor.EditorOpenListener<T> listener) com.vaadin.flow.shared.RegistrationaddSaveListener(com.vaadin.flow.component.grid.editor.EditorSaveListener<T> listener) voidcancel()protected voidprotected voidvoidprotected voidprotected voidprotected InstanceContainer<T>createInstanceContainer(T item) protected ValueSourceProvidercreateValueSourceProvider(T item) voidprotected voiddefaultComponentStatusHandler(SupportsStatusChangeHandler.StatusContext<?> statusContext) protected voiddetachItemContainer(DataGridEditorValueSourceProvider<T> valueSourceProvider) voidprotected voidfireCancelEvent(com.vaadin.flow.component.grid.editor.EditorCancelEvent<T> event) protected voidfireCloseEvent(com.vaadin.flow.component.grid.editor.EditorCloseEvent<T> event) protected voidfireOpenEvent(com.vaadin.flow.component.grid.editor.EditorOpenEvent<T> event) protected voidfireSaveEvent(com.vaadin.flow.component.grid.editor.EditorSaveEvent<T> event) voidgenerateData(T item, elemental.json.JsonObject jsonObject) com.vaadin.flow.data.binder.Binder<T>protected DataComponentsprotected MetaClassprotected EventBuscom.vaadin.flow.component.grid.Grid<T>getGrid()getItem()protected UiComponentsGeneratorprotected ViewValidationprotected voidhandleComponentStatus(SupportsStatusChangeHandler.StatusContext<?> statusContext) protected voidhandleItemClick(com.vaadin.flow.component.grid.ItemClickEvent<T> event) voidinitColumnDefaultEditorComponent(com.vaadin.flow.component.grid.Grid.Column<T> column, String property) Inits the default function that returns the column editor component that is bound to the passed entity's property.voidinitColumnDefaultEditorComponent(String property) Inits the default function that returns the column editor component that is bound to the passed entity's property.protected voidbooleanprotected booleanbooleanisOpen()booleanisSaving()voidrefresh()protected voidregisterEditComponent(com.vaadin.flow.component.grid.Grid.Column<T> column, com.vaadin.flow.component.Component editComponent) protected voidrequestEditItem(T item) booleansave()com.vaadin.flow.component.grid.editor.Editor<T>setBuffered(boolean buffered) voidsetColumnEditorComponent(com.vaadin.flow.component.grid.Grid.Column<T> column, String property, Function<EditComponentGenerationContext<T>, com.vaadin.flow.component.Component> generator) Sets a function that returns the column editor component.voidsetColumnEditorComponent(String property, Function<EditComponentGenerationContext<T>, com.vaadin.flow.component.Component> generator) Sets a function that returns the column editor component.voidSets a callback that is set to editor components which implementSupportsStatusChangeHandler.voidsetValidationErrorsHandler(Consumer<ValidationErrors> validationErrorsHandler) Sets a callback that is used to handle validation errors when Editor attempts to save the data, i.e.protected voidvalidateCanEdit(T item) protected ValidationErrorsprotected voidwriteComponent(com.vaadin.flow.component.Component component) protected voidMethods inherited from class com.vaadin.flow.component.grid.Grid.AbstractGridExtension
extend, refresh, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.data.provider.DataGenerator
destroyAllData, destroyData, refreshData
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
listeners
-
editItemRequest
protected com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.internal.ExecutionContext> editItemRequest -
defaultComponentStatusHandler
-
validationErrorsHandler
-
edited
-
buffered
protected boolean buffered -
saving
protected boolean saving -
itemValueSourceProviders
-
columnEditorComponents
-
-
Constructor Details
-
DataGridEditorImpl
public DataGridEditorImpl(com.vaadin.flow.component.grid.Grid<T> grid, org.springframework.context.ApplicationContext applicationContext)
-
-
Method Details
-
getEventBus
-
initGrid
-
setBinder
public com.vaadin.flow.component.grid.editor.Editor<T> setBinder(com.vaadin.flow.data.binder.Binder<T> binder) - Specified by:
setBinderin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
getBinder
- Specified by:
getBinderin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
setBuffered
- Specified by:
setBufferedin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
closeIfOpen
protected void closeIfOpen() -
isBuffered
public boolean isBuffered()- Specified by:
isBufferedin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
isSaving
public boolean isSaving()- Specified by:
isSavingin interfaceDataGridEditor<T>- Returns:
trueif this editor is buffered and is in a process of writing data to an item,falseotherwise
-
isOpen
public boolean isOpen()- Specified by:
isOpenin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
save
public boolean save()- Specified by:
savein interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
isEditorEditComponentsValid
protected boolean isEditorEditComponentsValid() -
validateEditor
-
writeEditComponents
protected void writeEditComponents() -
writeComponent
protected void writeComponent(com.vaadin.flow.component.Component component) -
cancel
public void cancel()- Specified by:
cancelin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
closeEditor
public void closeEditor()- Specified by:
closeEditorin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
editItem
- Specified by:
editItemin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
requestEditItem
-
refresh
public void refresh()- Specified by:
refreshin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
getItem
- Specified by:
getItemin interfaceDataGridEditor<T>- Specified by:
getItemin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
getGrid
-
generateData
- Specified by:
generateDatain interfacecom.vaadin.flow.data.provider.DataGenerator<T>
-
closeInternal
protected void closeInternal() -
handleItemClick
-
validateCanEdit
-
createValueSourceProvider
-
createInstanceContainer
-
clearItemValueSourceProviders
-
detachItemContainer
-
clearEditorComponents
protected void clearEditorComponents() -
dataProviderChanged
public void dataProviderChanged()- Specified by:
dataProviderChangedin interfaceDataGridDataProviderChangeObserver
-
getEntityMetaClass
-
initColumnDefaultEditorComponent
Description copied from interface:DataGridEditorInits the default function that returns the column editor component that is bound to the passed entity's property. To find the column it's assumed that the column key is equal to the property.- Specified by:
initColumnDefaultEditorComponentin interfaceDataGridEditor<T>- Parameters:
property- an entity attribute for which the edit component is created- See Also:
-
setColumnEditorComponent
public void setColumnEditorComponent(String property, Function<EditComponentGenerationContext<T>, com.vaadin.flow.component.Component> generator) Description copied from interface:DataGridEditorSets a function that returns the column editor component. To bound an editor component to the passed entity's property, the function implementation should useEditComponentGenerationContext.getValueSourceProvider()to obtain an instance ofValueSource. To find the column it's assumed that the column key is equal to the property.- Specified by:
setColumnEditorComponentin interfaceDataGridEditor<T>- Parameters:
property- an entity attribute for which the edit component is createdgenerator- a callback function that is used to create an edit component- See Also:
-
initColumnDefaultEditorComponent
public void initColumnDefaultEditorComponent(com.vaadin.flow.component.grid.Grid.Column<T> column, String property) Description copied from interface:DataGridEditorInits the default function that returns the column editor component that is bound to the passed entity's property.- Specified by:
initColumnDefaultEditorComponentin interfaceDataGridEditor<T>- Parameters:
column- a grid column for which to set editor componentproperty- an entity attribute for which an edit component is created- See Also:
-
setColumnEditorComponent
public void setColumnEditorComponent(com.vaadin.flow.component.grid.Grid.Column<T> column, String property, Function<EditComponentGenerationContext<T>, com.vaadin.flow.component.Component> generator) Description copied from interface:DataGridEditorSets a function that returns the column editor component. To bound an editor component to the passed entity's property, the function implementation should useEditComponentGenerationContext.getValueSourceProvider()to obtain an instance ofValueSource.- Specified by:
setColumnEditorComponentin interfaceDataGridEditor<T>- Parameters:
column- a grid column for which to set editor componentproperty- an entity attribute for which the edit component is createdgenerator- a callback function that is used to create an edit component- See Also:
-
defaultComponentStatusHandler
protected void defaultComponentStatusHandler(SupportsStatusChangeHandler.StatusContext<?> statusContext) -
handleComponentStatus
-
setDefaultComponentStatusHandler
public void setDefaultComponentStatusHandler(@Nullable Consumer<SupportsStatusChangeHandler.StatusContext<?>> handler) Description copied from interface:DataGridEditorSets a callback that is set to editor components which implementSupportsStatusChangeHandler. If a custom component generator is used, this status handler can be obtained fromEditComponentGenerationContext.getStatusHandler().- Specified by:
setDefaultComponentStatusHandlerin interfaceDataGridEditor<T>- Parameters:
handler- a callback that is set to editor components which implementSupportsStatusChangeHandler
-
setValidationErrorsHandler
public void setValidationErrorsHandler(@Nullable Consumer<ValidationErrors> validationErrorsHandler) Description copied from interface:DataGridEditorSets a callback that is used to handle validation errors when Editor attempts to save the data, i.e. whenEditor.save()is invoked.Note! This handler can be called only if editor is in buffered mode.
- Specified by:
setValidationErrorsHandlerin interfaceDataGridEditor<T>- Parameters:
validationErrorsHandler- a callback that is used to handle validation errors- See Also:
-
Editor.setBuffered(boolean)
-
registerEditComponent
protected void registerEditComponent(com.vaadin.flow.component.grid.Grid.Column<T> column, com.vaadin.flow.component.Component editComponent) -
addSaveListener
public com.vaadin.flow.shared.Registration addSaveListener(com.vaadin.flow.component.grid.editor.EditorSaveListener<T> listener) - Specified by:
addSaveListenerin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
addCancelListener
public com.vaadin.flow.shared.Registration addCancelListener(com.vaadin.flow.component.grid.editor.EditorCancelListener<T> listener) - Specified by:
addCancelListenerin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
addOpenListener
public com.vaadin.flow.shared.Registration addOpenListener(com.vaadin.flow.component.grid.editor.EditorOpenListener<T> listener) - Specified by:
addOpenListenerin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
addCloseListener
public com.vaadin.flow.shared.Registration addCloseListener(com.vaadin.flow.component.grid.editor.EditorCloseListener<T> listener) - Specified by:
addCloseListenerin interfacecom.vaadin.flow.component.grid.editor.Editor<T>
-
addListener
-
fireOpenEvent
-
fireCancelEvent
-
fireSaveEvent
-
fireCloseEvent
-
getDataComponents
-
getUiComponentsGenerator
-
getViewValidation
-