示例#1
0
  private Group findGroupInGroup(Group group, String id) {
    Group groupResult = null;

    // Is it this group:
    if (group.getId().equals(id)) {
      return group;
    }

    // Or inside inner groups:
    for (Group innerGroup : group.getInnerGroups()) {
      groupResult = findGroupInGroup(innerGroup, id);
      if (groupResult != null) {
        return groupResult;
      }
    }
    return null;
  }
示例#2
0
  private Widget findWidgetInGroup(Group group, String id) {
    Widget widgetResult = null;
    // widget can be inside the group widgets
    for (Widget widget : group.getWidgets()) {
      if (widget.getId().equals(id)) {
        return widget;
      }
    }
    // or inside inner groups:
    for (Group innerGroup : group.getInnerGroups()) {
      widgetResult = findWidgetInGroup(innerGroup, id);
      if (widgetResult != null) {
        return widgetResult;
      }
    }

    return null;
  }