Ejemplo n.º 1
0
  /**
   * Looks up a component with a given name. This is a crude implementation which walks through all
   * children until it finds the first match. Intended for occasional use eg. Collecting a set of
   * information from a screen when it is completed. Not going to be ideal performance for frequent
   * calls in complicated systems.
   */
  public UIContainer getChild(String searchName) {
    if (name.equals(searchName)) return this;

    UIContainer searchResult = null;
    for (UIContainer c : children) {
      searchResult = c.getChild(searchName);
      if ((searchResult != null) && (searchResult.getName().equals(searchName))) {
        break;
      }
    }
    return searchResult;
  }