code: @SuppressWarnings("unchecked")
      public static <T> T getController(BaseComponent comp, Class<T> type) {
          while (comp != null) {
              Object controller = getController(comp);
              
              if (type.isInstance(controller)) {
                  return (T) controller;
              }
              
              comp = comp.getParent();
          }
          
          return null;
      }
docs: Locates and returns a controller of the given type by searching up the component tree
  starting at the specified component.
  
  @param <T> The type of controller sought.
  @param comp Component for start of search.
  @param type The type of controller sought.
  @return The controller instance, or null if not found.