Package com.storedobject.vaadin.util
Class ElementClick
java.lang.Object
com.storedobject.vaadin.util.ElementClick
- All Implemented Interfaces:
ClickNotifier
,com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.Component>
,Serializable
A class that enables handling and notifying click events for a specified component.
The class adds an event listener to the component's associated
Element
to capture
click events with detailed event data, and notifies registered listeners when a click event occurs.
This provides an enhanced mechanism to manage and process click events on components.
The class uses EnhancedClickEvent
to encapsulate detailed click event information,
such as screen coordinates, client coordinates, component-relative coordinates, button state,
and additional keyboard modifier states (e.g., Ctrl, Shift, Alt, Meta).
This class implements the ClickNotifier
interface, allowing the addition and removal
of click listeners dynamically.- Author:
- Syam
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionElementClick
(com.vaadin.flow.component.Component component) Constructor to initialize an ElementClick instance with a specified component.ElementClick
(com.vaadin.flow.component.Component component, com.vaadin.flow.dom.Element element) Constructs an instance of the ElementClick class. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.Registration
addClickListener
(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.Component>> listener) void
removeClickListener
(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.Component>> listener) Remove a listener.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.storedobject.vaadin.util.ClickNotifier
replaceClickListener
Methods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickShortcut, addDoubleClickListener, addSingleClickListener
-
Constructor Details
-
ElementClick
public ElementClick(com.vaadin.flow.component.Component component) Constructor to initialize an ElementClick instance with a specified component.- Parameters:
component
- the component to which the click event listener will be attached.
-
ElementClick
public ElementClick(com.vaadin.flow.component.Component component, com.vaadin.flow.dom.Element element) Constructs an instance of the ElementClick class. Sets up a click event listener for the specified element, or resolves the element from the given component if the element is null. The event listener captures various click data such as position, button, and modifier keys.- Parameters:
component
- the component associated with the click event. If the element is null, the component's element or internal element (if the component is an instance of InternalElement) is used.element
- the specific element to which the click event listener is attached. If null, the element is resolved from the provided component.
-
-
Method Details
-
addClickListener
public com.vaadin.flow.shared.Registration addClickListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.Component>> listener) - Specified by:
addClickListener
in interfacecom.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.Component>
-
removeClickListener
public void removeClickListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.Component>> listener) Description copied from interface:ClickNotifier
Remove a listener.- Specified by:
removeClickListener
in interfaceClickNotifier
- Parameters:
listener
- Listener
-