Class EventDispatcher

java.lang.Object
com.wontlost.ckeditor.internal.EventDispatcher

public class EventDispatcher extends Object
Internal class for managing editor event dispatching. Provides type-safe event registration and dispatch mechanism.

This class is an internal API and should not be used directly by external code.

  • Constructor Details

    • EventDispatcher

      public EventDispatcher(VaadinCKEditor source)
      Create an event dispatcher.
      Parameters:
      source - the event source component
  • Method Details

    • setErrorHandler

      public void setErrorHandler(ErrorHandler errorHandler)
      Set the error handler.
      Parameters:
      errorHandler - the error handler
    • getErrorHandler

      public ErrorHandler getErrorHandler()
      Get the error handler.
      Returns:
      the error handler
    • addEditorReadyListener

      public com.vaadin.flow.shared.Registration addEditorReadyListener(com.vaadin.flow.component.ComponentEventListener<EditorReadyEvent> listener)
      Add an editor ready listener.
      Parameters:
      listener - the listener
      Returns:
      a registration handle for removing the listener
    • addEditorErrorListener

      public com.vaadin.flow.shared.Registration addEditorErrorListener(com.vaadin.flow.component.ComponentEventListener<EditorErrorEvent> listener)
      Add an error listener.
      Parameters:
      listener - the listener
      Returns:
      a registration handle
    • addAutosaveListener

      public com.vaadin.flow.shared.Registration addAutosaveListener(com.vaadin.flow.component.ComponentEventListener<AutosaveEvent> listener)
      Add an autosave listener.
      Parameters:
      listener - the listener
      Returns:
      a registration handle
    • addContentChangeListener

      public com.vaadin.flow.shared.Registration addContentChangeListener(com.vaadin.flow.component.ComponentEventListener<ContentChangeEvent> listener)
      Add a content change listener.
      Parameters:
      listener - the listener
      Returns:
      a registration handle
    • addFallbackListener

      public com.vaadin.flow.shared.Registration addFallbackListener(com.vaadin.flow.component.ComponentEventListener<FallbackEvent> listener)
      Add a fallback mode listener.
      Parameters:
      listener - the listener
      Returns:
      a registration handle
    • fireEditorReady

      public void fireEditorReady(long initTimeMs)
      Fire an editor ready event.
      Parameters:
      initTimeMs - initialization time in milliseconds
    • fireEditorError

      public boolean fireEditorError(EditorErrorEvent.EditorError error)
      Fire an error event.
      Parameters:
      error - the error information
      Returns:
      true if the error was handled by the error handler
    • fireAutosave

      public void fireAutosave(String content, boolean success, String errorMessage)
      Fire an autosave event.
      Parameters:
      content - the saved content
      success - whether the save succeeded
      errorMessage - error message (null on success)
    • fireContentChange

      public void fireContentChange(String oldContent, String newContent, ContentChangeEvent.ChangeSource changeSource)
      Fire a content change event.
      Parameters:
      oldContent - the old content
      newContent - the new content
      changeSource - the source of the change
    • fireFallback

      public void fireFallback(FallbackEvent.FallbackMode mode, String reason, String originalError)
      Fire a fallback mode event.
      Parameters:
      mode - the fallback mode
      reason - the reason for fallback
      originalError - the original error
    • cleanup

      public void cleanup()
      Clean up all listeners.
    • getListenerStats

      public EventDispatcher.ListenerStats getListenerStats()
      Get statistics about registered listeners.
      Returns:
      listener statistics