Example usage for com.liferay.portal.kernel.model ColorScheme getCssClass

List of usage examples for com.liferay.portal.kernel.model ColorScheme getCssClass

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model ColorScheme getCssClass.

Prototype

public String getCssClass();

Source Link

Usage

From source file:com.liferay.frontend.editor.ckeditor.web.editor.configuration.CKEditorConfigContributor.java

License:Open Source License

@Override
public void populateConfigJSONObject(JSONObject jsonObject, Map<String, Object> inputEditorTaglibAttributes,
        ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) {

    super.populateConfigJSONObject(jsonObject, inputEditorTaglibAttributes, themeDisplay,
            requestBackedPortletURLFactory);

    jsonObject.put("autoParagraph", Boolean.FALSE);
    jsonObject.put("autoSaveTimeout", 3000);

    ColorScheme colorScheme = themeDisplay.getColorScheme();

    String cssClasses = (String) inputEditorTaglibAttributes.get("liferay-ui:input-editor:cssClasses");

    jsonObject.put("bodyClass",
            "html-editor " + HtmlUtil.escape(colorScheme.getCssClass()) + " " + HtmlUtil.escape(cssClasses));

    jsonObject.put("closeNoticeTimeout", 8000);
    jsonObject.put("entities", Boolean.FALSE);

    String extraPlugins = "a11yhelpbtn,itemselector,lfrpopup,media";

    boolean inlineEdit = GetterUtil
            .getBoolean((String) inputEditorTaglibAttributes.get("liferay-ui:input-editor:inlineEdit"));

    if (inlineEdit) {
        extraPlugins += ",ajaxsave,restore";
    }/*from   www  .j  ava 2  s  . c om*/

    jsonObject.put("extraPlugins", extraPlugins);

    jsonObject.put("filebrowserWindowFeatures",
            "title=" + LanguageUtil.get(themeDisplay.getLocale(), "browse"));
    jsonObject.put("pasteFromWordRemoveFontStyles", Boolean.FALSE);
    jsonObject.put("pasteFromWordRemoveStyles", Boolean.FALSE);
    jsonObject.put("stylesSet", getStyleFormatsJSONArray(themeDisplay.getLocale()));
    jsonObject.put("toolbar_editInPlace", getToolbarEditInPlaceJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_email", getToolbarEmailJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_liferay", getToolbarLiferayJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_liferayArticle", getToolbarLiferayArticleJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_phone", getToolbarPhoneJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_simple", getToolbarSimpleJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_tablet", getToolbarTabletJSONArray(inputEditorTaglibAttributes));
}

From source file:com.liferay.frontend.editor.ckeditor.web.internal.editor.configuration.CKEditorConfigContributor.java

License:Open Source License

@Override
public void populateConfigJSONObject(JSONObject jsonObject, Map<String, Object> inputEditorTaglibAttributes,
        ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) {

    super.populateConfigJSONObject(jsonObject, inputEditorTaglibAttributes, themeDisplay,
            requestBackedPortletURLFactory);

    jsonObject.put("autoParagraph", Boolean.FALSE);
    jsonObject.put("autoSaveTimeout", 3000);

    ColorScheme colorScheme = themeDisplay.getColorScheme();

    String cssClasses = (String) inputEditorTaglibAttributes.get("liferay-ui:input-editor:cssClasses");

    jsonObject.put("bodyClass", StringBundler.concat("html-editor ", HtmlUtil.escape(colorScheme.getCssClass()),
            " ", HtmlUtil.escape(cssClasses)));

    jsonObject.put("closeNoticeTimeout", 8000);
    jsonObject.put("entities", Boolean.FALSE);

    String extraPlugins = "a11yhelpbtn,itemselector,lfrpopup,media";

    boolean inlineEdit = GetterUtil
            .getBoolean((String) inputEditorTaglibAttributes.get("liferay-ui:input-editor:inlineEdit"));

    if (inlineEdit) {
        extraPlugins += ",ajaxsave,restore";
    }/*from w  ww.j  av a2s. c o  m*/

    jsonObject.put("extraPlugins", extraPlugins);

    jsonObject.put("filebrowserWindowFeatures",
            "title=" + LanguageUtil.get(themeDisplay.getLocale(), "browse"));
    jsonObject.put("pasteFromWordRemoveFontStyles", Boolean.FALSE);
    jsonObject.put("pasteFromWordRemoveStyles", Boolean.FALSE);
    jsonObject.put("stylesSet", getStyleFormatsJSONArray(themeDisplay.getLocale()));
    jsonObject.put("toolbar_editInPlace", getToolbarEditInPlaceJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_email", getToolbarEmailJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_liferay", getToolbarLiferayJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_liferayArticle", getToolbarLiferayArticleJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_phone", getToolbarPhoneJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_simple", getToolbarSimpleJSONArray(inputEditorTaglibAttributes));
    jsonObject.put("toolbar_tablet", getToolbarTabletJSONArray(inputEditorTaglibAttributes));
}