Example usage for com.liferay.portal.kernel.theme ThemeDisplay getColorScheme

List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getColorScheme

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.theme ThemeDisplay getColorScheme.

Prototype

public ColorScheme getColorScheme() 

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   ww  w.  j  ava2 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  ww  w.j ava 2s .  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));
}