Class ComponentTracker
java.lang.Object
com.vaadin.flow.component.internal.ComponentTracker
Tracks the location in source code where components were instantiated.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Represents a location in the source code. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentTracker.Location
findAttach
(Component component) Finds the location where the given component instance was attached to a parent.static ComponentTracker.Location[]
findAttachLocations
(Component component) Finds the locations related to where the given component instance was attached to a parent.static ComponentTracker.Location
findCreate
(Component component) Finds the location where the given component instance was created.static ComponentTracker.Location[]
findCreateLocations
(Component component) Finds the locations related to where the given component instance was created.static void
refreshLocation
(ComponentTracker.Location location, int offset) Refreshes location of all components that had create or attach location below given reference component by given offset value.static void
trackAttach
(Component component) Tracks the location where the component was attached.static void
trackCreate
(Component component) Tracks the location where the component was created.
-
Constructor Details
-
ComponentTracker
public ComponentTracker()
-
-
Method Details
-
findCreate
Finds the location where the given component instance was created.- Parameters:
component
- the component to find- Returns:
- the location where the component was created
-
findCreateLocations
Finds the locations related to where the given component instance was created.- Parameters:
component
- the component to find- Returns:
- the locations involved in creating the component
-
trackCreate
Tracks the location where the component was created. This should be called from the Component constructor so that the creation location can be found from the current stacktrace.- Parameters:
component
- the component to track
-
findAttach
Finds the location where the given component instance was attached to a parent.- Parameters:
component
- the component to find- Returns:
- the location where the component was attached
-
findAttachLocations
Finds the locations related to where the given component instance was attached to a parent.- Parameters:
component
- the component to find- Returns:
- the locations involved in creating the component
-
trackAttach
Tracks the location where the component was attached. This should be called from the Component attach logic so that the creation location can be found from the current stacktrace.- Parameters:
component
- the component to track
-
refreshLocation
Refreshes location of all components that had create or attach location below given reference component by given offset value. Location may change due to dynamic code updates conducted by Vaadin developer tools.- Parameters:
location
- reference component locationoffset
- difference in lines to be applied
-