Interface DraftsFacet

All Superinterfaces:
Facet
All Known Implementing Classes:
DraftsFacetImpl

public interface DraftsFacet extends Facet
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.
  • Field Details

  • Method Details

    • getMinSaveInterval

      Duration getMinSaveInterval()
      Returns the minimum interval between draft writes of the owning view.
    • setMinSaveInterval

      void setMinSaveInterval(Duration interval)
      Sets the minimum interval between draft writes of the owning view.
    • getRestoreMode

      RestoreMode getRestoreMode()
      Returns how a found draft is restored.
    • setRestoreMode

      void setRestoreMode(RestoreMode mode)
      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

      void setRestoreDelegate(@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.
    • getRestoreDelegate

      @Nullable Consumer<DraftRestoreContext> getRestoreDelegate()
      Returns the currently set restore delegate, if any.
    • addDraftRestoredListener

      com.vaadin.flow.shared.Registration addDraftRestoredListener(Consumer<DraftsFacet.DraftRestoredEvent> listener)
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing the listener