Package io.jmix.uirecoveryflowui.facet
Interface DraftsFacet
- All Superinterfaces:
Facet
- All Known Implementing Classes:
DraftsFacetImpl
A facet that captures the dirty state of the owning view's
DataContext
into a draft, and restores it when the view is opened again.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classEvent fired after the facet restored a draft into the owning view's data context, so that the view can react to the restored state. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationAdds aDraftsFacet.DraftRestoredEventlistener.voidDeletes the draft associated with the owning view's key.Returns the minimum interval between draft writes of the owning view.@Nullable Consumer<DraftRestoreContext> Returns the currently set restore delegate, if any.Returns how a found draft is restored.voidBuilds a draft payload from the current state of the owning view's data context and writes it immediately, bypassing the minimum save interval throttle.voidsetMinSaveInterval(Duration interval) Sets the minimum interval between draft writes of the owning view.voidsetRestoreDelegate(@Nullable Consumer<DraftRestoreContext> delegate) Sets a delegate invoked when a draft is found for the owning view, allowing custom restore logic or preventing the facet's own restore behavior.voidsetRestoreMode(RestoreMode mode) Sets how a found draft is restored.
-
Field Details
-
FACET_NAME
- See Also:
-
-
Method Details
-
getMinSaveInterval
Duration getMinSaveInterval()Returns the minimum interval between draft writes of the owning view. -
setMinSaveInterval
Sets the minimum interval between draft writes of the owning view. -
getRestoreMode
RestoreMode getRestoreMode()Returns how a found draft is restored. -
setRestoreMode
Sets how a found draft is restored. -
saveDraftNow
void saveDraftNow()Builds a draft payload from the current state of the owning view's data context and writes it immediately, bypassing the minimum save interval throttle. -
deleteDrafts
void deleteDrafts()Deletes the draft associated with the owning view's key. -
setRestoreDelegate
Sets a delegate invoked when a draft is found for the owning view, allowing custom restore logic or preventing the facet's own restore behavior. -
getRestoreDelegate
@Nullable Consumer<DraftRestoreContext> getRestoreDelegate()Returns the currently set restore delegate, if any. -
addDraftRestoredListener
com.vaadin.flow.shared.Registration addDraftRestoredListener(Consumer<DraftsFacet.DraftRestoredEvent> listener) Adds aDraftsFacet.DraftRestoredEventlistener.- Parameters:
listener- a listener to add- Returns:
- a registration object for removing the listener
-