Class EventDispatcher
java.lang.Object
com.wontlost.ckeditor.internal.EventDispatcher
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddAutosaveListener(com.vaadin.flow.component.ComponentEventListener<AutosaveEvent> listener) Add an autosave listener.com.vaadin.flow.shared.RegistrationaddContentChangeListener(com.vaadin.flow.component.ComponentEventListener<ContentChangeEvent> listener) Add a content change listener.com.vaadin.flow.shared.RegistrationaddEditorErrorListener(com.vaadin.flow.component.ComponentEventListener<EditorErrorEvent> listener) Add an error listener.com.vaadin.flow.shared.RegistrationaddEditorReadyListener(com.vaadin.flow.component.ComponentEventListener<EditorReadyEvent> listener) Add an editor ready listener.com.vaadin.flow.shared.RegistrationaddFallbackListener(com.vaadin.flow.component.ComponentEventListener<FallbackEvent> listener) Add a fallback mode listener.voidcleanup()Clean up all listeners.voidfireAutosave(String content, boolean success, String errorMessage) Fire an autosave event.voidfireContentChange(String oldContent, String newContent, ContentChangeEvent.ChangeSource changeSource) Fire a content change event.booleanFire an error event.voidfireEditorReady(long initTimeMs) Fire an editor ready event.voidfireFallback(FallbackEvent.FallbackMode mode, String reason, String originalError) Fire a fallback mode event.Get the error handler.Get statistics about registered listeners.voidsetErrorHandler(ErrorHandler errorHandler) Set the error handler.
-
Constructor Details
-
EventDispatcher
Create an event dispatcher.- Parameters:
source- the event source component
-
-
Method Details
-
setErrorHandler
Set the error handler.- Parameters:
errorHandler- the error handler
-
getErrorHandler
-
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
Fire an error event.- Parameters:
error- the error information- Returns:
- true if the error was handled by the error handler
-
fireAutosave
-
fireContentChange
public void fireContentChange(String oldContent, String newContent, ContentChangeEvent.ChangeSource changeSource) Fire a content change event.- Parameters:
oldContent- the old contentnewContent- the new contentchangeSource- the source of the change
-
fireFallback
Fire a fallback mode event.- Parameters:
mode- the fallback modereason- the reason for fallbackoriginalError- the original error
-
cleanup
public void cleanup()Clean up all listeners. -
getListenerStats
Get statistics about registered listeners.- Returns:
- listener statistics
-