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 classRepresents a location in the source code. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentTracker.LocationfindAttach(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.LocationfindCreate(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 voidrefreshLocation(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 voidtrackAttach(Component component) Tracks the location where the component was attached.static voidtrackCreate(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.Uses lazy evaluation: only stores a lightweight Throwable. Stack trace processing is deferred until findCreate() or findCreateLocations() is called.
- 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.Uses lazy evaluation: only stores a lightweight Throwable. Stack trace processing is deferred until findAttach() or findAttachLocations() is called.
- 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.Note: With lazy evaluation, this method forces evaluation of all tracked components to ensure their locations are cached before applying offsets.
- Parameters:
location- reference component locationoffset- difference in lines to be applied
-