code: private void addFunctionDetailElement(
          CmsObject cms,
          CmsXmlContainerPage page,
          String containerName,
          CmsUUID elementId,
          CmsUUID formatterId)
      throws CmsException {
  
          CmsContainerPageBean bean = page.getContainerPage(cms);
          List<CmsContainerBean> containerBeans = new ArrayList<CmsContainerBean>();
          Collection<CmsContainerBean> originalContainers = bean.getContainers().values();
          if ((containerName == null) && !originalContainers.isEmpty()) {
              CmsContainerBean firstContainer = originalContainers.iterator().next();
              containerName = firstContainer.getName();
          }
          boolean foundContainer = false;
          for (CmsContainerBean cntBean : originalContainers) {
              boolean isDetailTarget = cntBean.getName().equals(containerName);
              if (isDetailTarget && !foundContainer) {
                  foundContainer = true;
                  List<CmsContainerElementBean> newElems = new ArrayList<CmsContainerElementBean>();
                  newElems.addAll(cntBean.getElements());
                  CmsContainerElementBean newElement = new CmsContainerElementBean(
                      elementId,
                      formatterId,
                      new HashMap<String, String>(),
                      false);
                  newElems.add(0, newElement);
                  CmsContainerBean newCntBean = new CmsContainerBean(
                      cntBean.getName(),
                      cntBean.getType(),
                      cntBean.getParentInstanceId(),
                      cntBean.isRootContainer(),
                      newElems);
                  containerBeans.add(newCntBean);
              } else {
                  containerBeans.add(cntBean);
              }
          }
          if (!foundContainer) {
              throw new CmsException(
                  Messages.get().container(Messages.ERR_NO_FUNCTION_DETAIL_CONTAINER_1, page.getFile().getRootPath()));
          }
          CmsContainerPageBean bean2 = new CmsContainerPageBean(new ArrayList<CmsContainerBean>(containerBeans));
          page.writeContainerPage(cms, bean2);
  
      }
docs: Adds a function detail element to a container page.<p>
  
  @param cms the current CMS context
  @param page the container page which should be changed
  @param containerName the name of the container which should be used for function detail elements
  @param elementId the structure id of the element to add
  @param formatterId the structure id of the formatter for the element
  
  @throws CmsException if something goes wrong