Class FlowUtil

java.lang.Object
com.vaadin.copilot.FlowUtil

public class FlowUtil extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static Map<com.vaadin.flow.component.internal.ComponentTracker.Location,File>
    findActiveJavaFiles(com.vaadin.flow.server.VaadinSession session, int uiId)
    Finds all Java files that are used to create the current component tree for the given ui.
    static Map<com.vaadin.flow.component.Component,ComponentTypeAndSourceLocation>
    findAllComponents(com.vaadin.flow.server.VaadinSession session, int uiId)
     
    static Optional<com.vaadin.flow.component.Component>
    findComponentByNodeIdAndUiId(com.vaadin.flow.server.VaadinSession vaadinSession, int nodeId, int uiId)
    Finds the Component instance with given nodeId in UI with uiId via VaadinSession.accessSynchronously(Command)
    static Integer
    getNodeId(com.vaadin.flow.component.Component component)
     
    static Optional<com.vaadin.flow.router.RouteData>
    getRouteData(com.vaadin.flow.server.VaadinSession session, int uiId)
     
    static List<Class<? extends com.vaadin.flow.component.HasElement>>
    getViewChain(com.vaadin.flow.server.VaadinSession session, int uiId)
    Returns the view chain for the given UI.
    static boolean
    testAncestors(com.vaadin.flow.server.VaadinSession session, com.vaadin.flow.component.Component component, Predicate<com.vaadin.flow.component.Component> testPredicate)
    The method traverses up the component hierarchy, starting from the immediate parent of the given component, and applies the provided Predicate to each ancestor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • findActiveJavaFiles

      public static Map<com.vaadin.flow.component.internal.ComponentTracker.Location,File> findActiveJavaFiles(com.vaadin.flow.server.VaadinSession session, int uiId)
      Finds all Java files that are used to create the current component tree for the given ui.
      Parameters:
      uiId - the id for the UI, inside the given session
      Returns:
      a map of the locations and the corresponding Java files
    • findAllComponents

      public static Map<com.vaadin.flow.component.Component,ComponentTypeAndSourceLocation> findAllComponents(com.vaadin.flow.server.VaadinSession session, int uiId)
    • getViewChain

      public static List<Class<? extends com.vaadin.flow.component.HasElement>> getViewChain(com.vaadin.flow.server.VaadinSession session, int uiId)
      Returns the view chain for the given UI.
      Parameters:
      session - the vaadin session
      uiId - the id for the UI, inside the given session
      Returns:
      a list of the view classes currently being shown in the UI
    • testAncestors

      public static boolean testAncestors(com.vaadin.flow.server.VaadinSession session, com.vaadin.flow.component.Component component, Predicate<com.vaadin.flow.component.Component> testPredicate)
      The method traverses up the component hierarchy, starting from the immediate parent of the given component, and applies the provided Predicate to each ancestor.

      The session is locked during traversal

      Parameters:
      session - the VaadinSession to which the component belongs; must not be null.
      component - the Component whose ancestors are to be tested; must not be null.
      testPredicate - the Predicate used to test each ancestor component; must not be null.
      Returns:
      true if any ancestor component satisfies the given predicate, false otherwise.
    • getNodeId

      public static Integer getNodeId(com.vaadin.flow.component.Component component)
    • getRouteData

      public static Optional<com.vaadin.flow.router.RouteData> getRouteData(com.vaadin.flow.server.VaadinSession session, int uiId)
    • findComponentByNodeIdAndUiId

      public static Optional<com.vaadin.flow.component.Component> findComponentByNodeIdAndUiId(com.vaadin.flow.server.VaadinSession vaadinSession, int nodeId, int uiId)
      Finds the Component instance with given nodeId in UI with uiId via VaadinSession.accessSynchronously(Command)
      Parameters:
      vaadinSession - Vaadin session to access UI elements
      nodeId - Node id
      uiId - ui id
      Returns:
      Component or Optional.empty()