docs: public static List<CmsDialogElement> computeElements(
          CmsObject cms,
          CmsXmlPage xmlPage,
          String xmlPageUri,
          Locale locale) {
  
          List<CmsDialogElement> result = new ArrayList<CmsDialogElement>();
  
          if (xmlPage != null) {
              List<String> elementNames = xmlPage.getNames(locale);
  
              Iterator<String> i = elementNames.iterator();
              while (i.hasNext()) {
                  String name = i.next();
                  CmsDialogElement element = new CmsDialogElement(name, null, false, false, true);
                  result.add(element);
              }
          }
  
          String currentTemplate = null;
          try {
              currentTemplate = cms.readPropertyObject(
                  xmlPageUri,
                  CmsPropertyDefinition.PROPERTY_TEMPLATE,
                  true).getValue();
          } catch (CmsException e) {
              if (LOG.isWarnEnabled()) {
                  LOG.warn(e.getLocalizedMessage(), e);
              }
          }
          if ((currentTemplate != null) && (currentTemplate.length() > 0)) {
              // template found, check template-elements property
              String elements = null;
              try {
                  // read the property from the template file
                  elements = cms.readPropertyObject(
                      currentTemplate,
                      CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
                      false).getValue(null);
              } catch (CmsException e) {
                  if (LOG.isWarnEnabled()) {
                      LOG.warn(e.getLocalizedMessage(), e);
                  }
              }
              if (elements != null) {
                  // elements are defined on template file, merge with available elements
                  List<String> tokens = CmsStringUtil.splitAsList(elements, ',', true);
                  Iterator<String> it = tokens.iterator();
                  while (it.hasNext()) {
                      String currentElement = it.next();
                      String niceName = null;
                      boolean mandatory = false;
                      int sepIndex = currentElement.indexOf("|");
                      if (sepIndex != -1) {
                          // nice name found for current element, extract it
                          niceName = currentElement.substring(sepIndex + 1);
                          currentElement = currentElement.substring(0, sepIndex);
                      }
                      if (currentElement.endsWith("*")) {
                          // element is mandatory
                          mandatory = true;
                          currentElement = currentElement.substring(0, currentElement.length() - 1);
                      }
  
                      CmsDialogElement element = new CmsDialogElement(currentElement, niceName, mandatory, true, false);
                      if (result.contains(element)) {
                          element.setExisting(true);
                          result.remove(element);
                      }
                      result.add(element);
                  }
              }
          }
  
          Collections.sort(result);
          return result;
      }