Package io.jmix.flowui.model
Class DataContext.PreSaveEvent
java.lang.Object
java.util.EventObject
io.jmix.flowui.model.DataContext.PreSaveEvent
- All Implemented Interfaces:
- Serializable
- Enclosing interface:
- DataContext
Event sent before saving changes.
 
 In this event listener, you can add arbitrary entity instances to the
 saved collections returned by getModifiedInstances() and
 getRemovedInstances() methods, for example:
 
     @Subscribe(target = Target.DATA_CONTEXT)
     protected void onPreSave(DataContext.PreSaveEvent event) {
         event.getModifiedInstances().add(customer);
     }
 
 
 You can also prevent saving using the preventSave() method
 of the event, for example:
 
     @Subscribe(target = Target.DATA_CONTEXT)
     protected void onPreSave(DataContext.PreSaveEvent event) {
         if (doNotSave()) {
             event.preventSave();
         }
     }
 - 
Field SummaryFields inherited from class java.util.EventObjectsource
- 
Constructor SummaryConstructorsConstructorDescriptionPreSaveEvent(DataContext dataContext, Collection modified, Collection removed) 
- 
Method SummaryModifier and TypeMethodDescriptionReturns the collection of modified instances.Returns the collection of removed instances.The data context which sent the event.booleanReturns true ifpreventSave()method was called and save will be aborted.voidInvoke this method if you want to abort the saving process.Methods inherited from class java.util.EventObjecttoString
- 
Constructor Details- 
PreSaveEvent
 
- 
- 
Method Details- 
getSourceThe data context which sent the event.- Overrides:
- getSourcein class- EventObject
 
- 
getModifiedInstancesReturns the collection of modified instances.
- 
getRemovedInstancesReturns the collection of removed instances.
- 
preventSavepublic void preventSave()Invoke this method if you want to abort the saving process.
- 
isSavePreventedpublic boolean isSavePrevented()Returns true ifpreventSave()method was called and save will be aborted.
 
-