Package com.storedobject.vaadin
Class Svg.Event
java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<Svg>
com.storedobject.vaadin.Svg.Event
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Svg.ClickEvent,Svg.MouseOutEvent,Svg.MouseOverEvent
- Enclosing class:
Svg
Represents an abstract base class for events triggered by interactions
with an SVG component. This class stores details about the event such as
the coordinates of the mouse pointer during the event, the ID and tag name
of the targeted SVG element, and associated metadata related to the event.
Subclasses of this class should define specific event types.
- Author:
- Syam
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetChart()Retrieves the chart associated with this event, if the underlying node is of typeChart.doubleReturns the X-coordinate of the mouse pointer relative to the client area at the time the event was generated.doubleReturns the Y-coordinate of the mouse pointer relative to the client area at the time the event was generated.getNode()Returns the node associated with this event.longReturns the node identifier associated with this event.Returns the tag name of the HTML or SVG element associated with the event.getValue()Retrieves the value associated with the event.longReturns the value identifier associated with this event.Methods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, isFromClient, unregisterListenerMethods inherited from class java.util.EventObject
toString
-
Constructor Details
-
Event
public Event(Svg source, boolean fromClient, @EventData("event.clientX") double clientX, @EventData("event.clientY") double clientY, @EventData("event.target.id") String elementId, @EventData("event.target.tagName") String tagName) Creates a new event using the given source and indicator whether the event originated from the client side or the server side.- Parameters:
source- the source componentfromClient-trueif the event originated from the client side,falseotherwiseclientX- the x coordinate of the mouse pointerclientY- the y coordinate of the mouse pointerelementId- the id of the element that was clickedtagName- the tag name of the element that was clicked
-
-
Method Details
-
getClientX
public double getClientX()Returns the X-coordinate of the mouse pointer relative to the client area at the time the event was generated.- Returns:
- the X-coordinate of the mouse pointer in pixels
-
getClientY
public double getClientY()Returns the Y-coordinate of the mouse pointer relative to the client area at the time the event was generated.- Returns:
- the Y-coordinate of the mouse pointer in pixels
-
getTagName
Returns the tag name of the HTML or SVG element associated with the event.- Returns:
- the tag name of the element as a string
-
getNodeId
public long getNodeId()Returns the node identifier associated with this event. The identifier corresponds to a unique ID assigned to the element or node that triggered the event.- Returns:
- the node ID as a long value
-
getValueId
public long getValueId()Returns the value identifier associated with this event. The identifier corresponds to a unique ID assigned to the value within the node that triggered the event. Typically, a value represents a specific data point of theChartwhen the node is aChart.- Returns:
- the value ID as a long value
-
getNode
Returns the node associated with this event. The node represents a specific element or object within the context of the generated event.- Returns:
- the associated Node object
-
getValue
Retrieves the value associated with the event. The value is typically an encapsulation of data specific to the event context, such as user interaction or chart data points.- Returns:
- the associated
Values.Valueobject
-
getChart
Retrieves the chart associated with this event, if the underlying node is of typeChart.- Returns:
- the associated
Chartobject if the node is an instance ofChart, ornullotherwise
-