code: public static IndexedContainer getPrincipalContainer(
          CmsObject cms,
          List<? extends I_CmsPrincipal> list,
          String captionID,
          String descID,
          String iconID,
          String ouID,
          String icon,
          List<FontIcon> iconList) {
  
          IndexedContainer res = new IndexedContainer();
  
          res.addContainerProperty(captionID, String.class, "");
          res.addContainerProperty(ouID, String.class, "");
          res.addContainerProperty(iconID, FontIcon.class, new CmsCssIcon(icon));
          if (descID != null) {
              res.addContainerProperty(descID, String.class, "");
          }
  
          for (I_CmsPrincipal group : list) {
  
              Item item = res.addItem(group);
              item.getItemProperty(captionID).setValue(group.getSimpleName());
              item.getItemProperty(ouID).setValue(group.getOuFqn());
              if (descID != null) {
                  item.getItemProperty(descID).setValue(group.getDescription(A_CmsUI.get().getLocale()));
              }
          }
  
          for (int i = 0; i < iconList.size(); i++) {
              res.getItem(res.getIdByIndex(i)).getItemProperty(iconID).setValue(iconList.get(i));
          }
  
          return res;
      }
docs: Get container for principal.
  
  @param cms cmsobject
  @param list of principals
  @param captionID caption id
  @param descID description id
  @param iconID icon id
  @param ouID ou id
  @param icon icon
  @param iconList iconlist
  @return indexedcontainer