Adds a nested formatter element.<p>

@param elementName the element name
@param contentDefinition the content definition

@throws CmsXmlException in case something goes wrong
17752
protected void addNestedFormatter(String elementName, CmsXmlContentDefinition contentDefinition)
    throws CmsXmlException {

        if (contentDefinition.getSchemaType(elementName) == null) {
            throw new CmsXmlException(
                Messages.get().container(Messages.ERR_XMLCONTENT_INVALID_ELEM_MAPPING_1, elementName));
        }
        m_nestedFormatterElements.add(elementName);
    }
67144
public void addConfiguration(I_CmsXmlConfiguration configuration) {

        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_ADD_CONFIG_1, configuration));
        }
        m_configurations.add(configuration);
        cacheDtdSystemId(configuration);
    }
912033
public CmsXmlContentProperty withName(String name) {

        return new CmsXmlContentProperty(
            name,
            m_type,
            m_visibility,
            m_widget,
            m_widgetConfiguration,
            m_ruleRegex,
            m_ruleType,
            m_default,
            m_niceName,
            m_description,
            m_error,
            m_preferFolder);
    }
1201300
protected CmsContainerElementBean transformContainerElement(
        CmsObject cms,
        CmsTemplateMapperConfiguration config,
        CmsContainerElementBean element) {

        if (m_forSave) {
            try {
                element.initResource(cms);
            } catch (Exception e) {
                LOG.error(e.getLocalizedMessage(), e);
                return null;
            }
        }
        Map<String, String> settings = element.getIndividualSettings();
        if (settings == null) {
            settings = new HashMap<>();
        }
        Map<String, String> newSettings = new HashMap<>();
        for (Map.Entry<String, String> entry : settings.entrySet()) {
            String key = entry.getKey();
            if (CmsTemplateContextInfo.SETTING.equals(key)) {
                continue;
            }
            String value = entry.getValue();
            if (value == null) {
                continue;
            }
            String newValue = value;
            if (key.startsWith(CmsFormatterConfig.FORMATTER_SETTINGS_KEY)) {
                if (CmsUUID.isValidUUID(value)) {
                    String newId = config.getMappedFormatterConfiguration(value);
                    if (newId != null) {
                        newValue = newId;
                    }
                } else if (value.startsWith(CmsFormatterConfig.SCHEMA_FORMATTER_ID)) {
                    String schemaFormatterIdStr = value.substring(CmsFormatterConfig.SCHEMA_FORMATTER_ID.length());
                    if (CmsUUID.isValidUUID(schemaFormatterIdStr)) {
                        CmsUUID schemaFormatterId = new CmsUUID(schemaFormatterIdStr);
                        CmsUUID mappedFormatterId = config.getMappedFormatterJspId(schemaFormatterId);
                        if (mappedFormatterId != null) {
                            newValue = CmsFormatterConfig.SCHEMA_FORMATTER_ID + mappedFormatterId;
                        }
                    }
                }
            }
            newSettings.put(key, newValue);
        }
        CmsContainerElementBean newElement = element.clone();
        newElement.updateIndividualSettings(newSettings);
        CmsUUID formatterId = element.getFormatterId();
        if ((formatterId == null) && m_forSave) {
            try {
                if (element.isGroupContainer(cms)) {
                    // ID for group-container.jsp
                    formatterId = new CmsUUID("e7029fa2-761e-11e0-bd7f-9ffeadaf4d46");
                    newElement.setFormatterId(formatterId);
                } else if (OpenCms.getResourceManager().matchResourceType(
                    "function",
                    element.getResource().getTypeId())) {
                    formatterId = new CmsUUID("087ba7c9-e7fc-4336-acb8-d3416a4eb1fd");
                    newElement.setFormatterId(formatterId);
                }
            } catch (CmsException e) {
                LOG.warn(e.getLocalizedMessage(), e);
            }
        }
        CmsUUID mappedFormatterJspId = config.getMappedFormatterJspId(formatterId);
        if (mappedFormatterJspId != null) {
            newElement.setFormatterId(mappedFormatterJspId);
        }
        return newElement;
    }
399596
protected void initFields(Element parent, CmsXmlContentDefinition contentDef) throws CmsXmlException {

        for (Element fieldElem : parent.elements(N_SETTING)) {
            initField(fieldElem, contentDef);
        }
    }
375701
public CmsXmlContentProperty withNiceName(String niceName) {

        return new CmsXmlContentProperty(
            m_name,
            m_type,
            m_visibility,
            m_widget,
            m_widgetConfiguration,
            m_ruleRegex,
            m_ruleType,
            m_default,
            niceName,
            m_description,
            m_error,
            m_preferFolder);
    }
428989
@Override
    protected void initContent() {

        if (CmsStringUtil.isNotEmpty(getParamContent())) {
            if (CmsStringUtil.isNotEmpty(getParamElementname())
                && getParamElementname().equals(getParamOldelementname())) {
                if (CmsStringUtil.isNotEmpty(getParamElementlanguage())
                    && getParamElementlanguage().equals(getParamOldelementlanguage())) {
                    return;
                }
            }
        }
        getCms().getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_EDITOR, Boolean.TRUE);

        String elementData;
        if (m_page.hasValue(getParamElementname(), getElementLocale())) {
            // element value is available in the page
            elementData = m_page.getStringValue(getCms(), getParamElementname(), getElementLocale());
        } else {
            // value is not available in the page
            if (Boolean.valueOf(getParamDirectedit()).booleanValue()) {
                // direct edit on a non-existing element: create new element with this name
                m_page.addValue(getParamElementname(), getElementLocale());
            }
            elementData = "";
        }
        setParamContent(elementData);
    }
513853
protected void initFormatters(Element root, CmsXmlContentDefinition contentDefinition) {

        // reading the include resources common for all formatters
        Iterator<Element> itFormatter = CmsXmlGenericWrapper.elementIterator(root, APPINFO_FORMATTER);
        while (itFormatter.hasNext()) {
            // iterate all "formatter" elements in the "formatters" node
            Element element = itFormatter.next();
            String type = element.attributeValue(APPINFO_ATTR_TYPE);
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(type)) {
                // if not set use "*" as default for type
                type = CmsFormatterBean.WILDCARD_TYPE;
            }
            String jspRootPath = element.attributeValue(APPINFO_ATTR_URI);
            String minWidthStr = element.attributeValue(APPINFO_ATTR_MINWIDTH);
            String maxWidthStr = element.attributeValue(APPINFO_ATTR_MAXWIDTH);
            String preview = element.attributeValue(APPINFO_ATTR_PREVIEW);
            String searchContent = element.attributeValue(APPINFO_ATTR_SEARCHCONTENT);
            m_formatters.add(
                new CmsFormatterBean(
                    type,
                    jspRootPath,
                    minWidthStr,
                    maxWidthStr,
                    preview,
                    searchContent,
                    contentDefinition.getSchemaLocation()));
        }
    }
1225713
public void doEdit(final String filename, final CmsUUID structureId) {

        I_CmsEditableData editData = new I_CmsEditableData() {

            public String getContextId() {

                return "";
            }

            public String getEditId() {

                return null;
            }

            public String getElementId() {

                // TODO Auto-generated method stub
                return null;
            }

            public String getElementLanguage() {

                return null;
            }

            public String getElementName() {

                return null;
            }

            public String getNewLink() {

                return null;
            }

            public String getNewTitle() {

                return null;
            }

            public String getNoEditReason() {

                return null;
            }

            public String getPostCreateHandler() {

                return null;
            }

            public String getSitePath() {

                return filename;
            }

            public CmsUUID getStructureId() {

                return structureId;
            }

            public boolean hasEditHandler() {

                return false;
            }

            public boolean hasResource() {

                return true;
            }

            public boolean isUnreleasedOrExpired() {

                return false;
            }

            public void setSitePath(String sitePath) {

                // nothing to do
            }
        };
        if (m_useSelf) {
            FormElement form = CmsContentEditorDialog.generateForm(editData, false, "_self", null);
            RootPanel.getBodyElement().appendChild(form);
            form.submit();
        } else {

            I_CmsContentEditorHandler handler = new I_CmsContentEditorHandler() {

                @SuppressWarnings("synthetic-access")
                public void onClose(String sitePath, CmsUUID id, boolean isNew, boolean hasChangedSettings) {

                    if (!m_reload) {
                        return;
                    }

                    if (m_immediateReload) {
                        reloadTop();
                    }

                    // defer the window.location.reload until after the editor window has closed
                    // so we don't get another confirmation dialog
                    Timer timer = new Timer() {

                        @Override
                        public void run() {

                            reloadTop();

                        }

                    };
                    timer.schedule(10);
                }
            };
            CmsContentEditorDialog.get().openEditDialog(editData, false, null, new DialogOptions(), handler);
        }
    }
1014200
public static String format(String xml) throws CmsXmlException {

        return CmsXmlUtils.marshal((Node)CmsXmlUtils.unmarshalHelper(xml, null), CmsEncoder.ENCODING_UTF_8);
    }
1076321
public void registerContentDefinition(CmsContentDefinition definition) {

        getWidgetService().addConfigurations(definition.getConfigurations());
        CmsType baseType = definition.getTypes().get(definition.getEntityTypeName());
        m_entityBackend.registerTypes(baseType, definition.getTypes());
        for (CmsEntity entity : definition.getEntities().values()) {
            CmsEntity previousValue = m_entityBackend.getEntity(entity.getId());
            if (previousValue != null) {
                m_entityBackend.changeEntityContentValues(previousValue, entity);
            } else {
                m_entityBackend.registerEntity(entity);
                m_registeredEntities.add(entity.getId());
            }
        }
        for (Map.Entry<String, CmsComplexWidgetData> entry : definition.getComplexWidgetData().entrySet()) {
            String attrName = entry.getKey();
            CmsComplexWidgetData widgetData = entry.getValue();
            getWidgetService().registerComplexWidgetAttribute(
                attrName,
                widgetData.getRendererName(),
                widgetData.getConfiguration());
        }
    }
1263232
protected void addMemberDesc(Element member, Content contentTree) {
        TypeElement containing = utils.getEnclosingTypeElement(member);
        String classdesc = utils.getTypeElementName(containing, true) + " ";
        if (utils.isField(member)) {
            Content resource = contents.getContent(utils.isStatic(member)
                    ? "doclet.Static_variable_in"
                    : "doclet.Variable_in", classdesc);
            contentTree.addContent(resource);
        } else if (utils.isConstructor(member)) {
            contentTree.addContent(
                    contents.getContent("doclet.Constructor_for", classdesc));
        } else if (utils.isMethod(member)) {
            Content resource = contents.getContent(utils.isStatic(member)
                    ? "doclet.Static_method_in"
                    : "doclet.Method_in", classdesc);
            contentTree.addContent(resource);
        }
        addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
                false, contentTree);
    }
999403
@Override
    public void addHeader(String name, String value) {

        if (isSuspended()) {
            return;
        }

        if (CmsRequestUtil.HEADER_CONTENT_TYPE.equalsIgnoreCase(name)) {
            setContentType(value);
            return;
        }

        if (m_cachingRequired && !m_includeMode) {
            addHeaderList(m_bufferHeaders, name, value);
            if (LOG.isDebugEnabled()) {
                LOG.debug(
                    Messages.get().getBundle().key(
                        Messages.LOG_FLEXRESPONSE_ADDING_HEADER_TO_ELEMENT_BUFFER_2,
                        name,
                        value));
            }
        }

        if (m_writeOnlyToBuffer) {
            addHeaderList(m_headers, name, value);
            if (LOG.isDebugEnabled()) {
                LOG.debug(
                    Messages.get().getBundle().key(Messages.LOG_FLEXRESPONSE_ADDING_HEADER_TO_HEADERS_2, name, value));
            }
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.debug(
                    Messages.get().getBundle().key(
                        Messages.LOG_FLEXRESPONSE_ADDING_HEADER_TO_PARENT_RESPONSE_2,
                        name,
                        value));
            }
            m_res.addHeader(name, value);
        }
    }
936772
public void init(CmsObject cms, Locale locale, I_CmsXmlDocument content, CmsResource resource) {

        m_cms = cms;
        m_requestedLocale = locale;
        m_content = content;
        m_resource = resource;
    }
943079
private void ensureElementFormatter(CmsResource resource, HttpServletRequest req) {

        CmsJspStandardContextBean contextBean = CmsJspStandardContextBean.getInstance(req);
        CmsContainerElementBean element = contextBean.getElement();
        if (!resource.getStructureId().equals(element.getFormatterId())) {
            element.setFormatterId(resource.getStructureId());
        }
    }
1127252
@Deprecated
    protected void addSearchField(CmsXmlContentDefinition contentDefinition, CmsSearchField field) {

        addSearchField(contentDefinition, field, I_CmsXmlContentHandler.MappingType.ELEMENT);
    }
1178391
public void generateXml(Element parent, I_CmsConfigurationParameterHandler config) {

        if (config != null) {
            Element elem = parent.addElement(m_name);
            for (String subElemName : m_subElements) {
                for (String value : config.getConfiguration().getList(subElemName)) {
                    elem.addElement(subElemName).addText(value);
                }
            }
        }
    }