Package com.storedobject.vaadin.util
Class Listeners
java.lang.Object
com.storedobject.vaadin.util.Listeners
- Direct Known Subclasses:
ClickListeners
,ValueChangeListeners
Abstract base class for managing and notifying a collection of listeners.
Subclasses should provide an implementation for the
fire
method to define
how events are dispatched to individual listeners.
This class is designed to manage multiple listeners that can be added or removed
dynamically and supports the firing of events to all registered listeners.- Author:
- Syam
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.Registration
add
(EventListener listener) Adds a listener to the internal collection of event listeners.protected abstract void
fire
(EventListener listener, EventObject event) Dispatches an event to a specified listener.void
fire
(EventObject event) Notifies all registered listeners of the provided event by invoking thefire
method for each listener.void
remove
(EventListener listener) Removes the specified event listener from the collection of registered listeners.
-
Constructor Details
-
Listeners
public Listeners()
-
-
Method Details
-
fire
Notifies all registered listeners of the provided event by invoking thefire
method for each listener.- Parameters:
event
- the event to be dispatched to each registered listener
-
fire
Dispatches an event to a specified listener. This method defines how a particular event is delivered to an individual listener. Subclasses must implement this method to define the specific behavior of event delivery.- Parameters:
listener
- the event listener to which the event is dispatchedevent
- the event object to be delivered to the listener
-
add
Adds a listener to the internal collection of event listeners.- Parameters:
listener
- the event listener to be added to the collection- Returns:
- a
Registration
object that can be used to remove the listener
-
remove
Removes the specified event listener from the collection of registered listeners. If the listener is not currently registered, no action is taken.- Parameters:
listener
- the event listener to be removed from the collection
-