001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.editor.configuration;
016    
017    import com.liferay.portal.kernel.json.JSONObject;
018    import com.liferay.portal.theme.ThemeDisplay;
019    import com.liferay.portlet.RequestBackedPortletURLFactory;
020    
021    import java.util.Map;
022    
023    /**
024     * Provides an interface for adapting an {@link EditorOptionsContributor}'s high
025     * level options to a specific configuration JSON object (as used by the {@link
026     * EditorConfigContributor}).
027     *
028     * <p>
029     * Each editor should typically create its own Editor Config Transformer for the
030     * editor's configuration JSON objects, which can differ from those of other
031     * editors.
032     * </p>
033     *
034     * <p>
035     * Implementations must be OSGi components that are registered in the OSGi
036     * Registry.
037     * </p>
038     *
039     * <p>
040     * Editor Config Transformers are targeted to specific editors based on the
041     * <code>editor.name</code> OSGi property.
042     * </p>
043     *
044     * <p>
045     * In case there's more than one Editor Config Transformer for an editor, the
046     * one with the highest service rank is used.
047     * </p>
048     *
049     * @author Sergio Gonz??lez
050     */
051    public interface EditorConfigTransformer {
052    
053            /**
054             * Transforms the editor options in configuration that the editor can
055             * handle, by populating the configuration JSON object.
056             *
057             * @param editorOptions the {@link EditorOptions} object composed of the
058             *        options set by {@link EditorOptionsContributor} modules
059             * @param inputEditorTaglibAttributes the attributes specified to the input
060             *        taglib tag that renders the editor
061             * @param configJSONObject the JSON object composed of the entire
062             *        configuration set by {@link EditorConfigContributor} modules
063             * @param themeDisplay the theme display
064             */
065            public void transform(
066                    EditorOptions editorOptions,
067                    Map<String, Object> inputEditorTaglibAttributes,
068                    JSONObject configJSONObject, ThemeDisplay themeDisplay,
069                    RequestBackedPortletURLFactory requestBackedPortletURLFactory);
070    
071    }