Example usage for com.liferay.portal.kernel.model Layout getDefaultThemeSetting

List of usage examples for com.liferay.portal.kernel.model Layout getDefaultThemeSetting

Introduction

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

Prototype

public String getDefaultThemeSetting(String key, String device, boolean inheritLookAndFeel);

Source Link

Usage

From source file:com.liferay.layout.admin.web.internal.portlet.action.ActionUtil.java

License:Open Source License

protected void setThemeSettingProperties(ActionRequest actionRequest, UnicodeProperties typeSettingsProperties,
        Map<String, ThemeSetting> themeSettings, String device, boolean isLayout) throws PortalException {

    Layout layout = null;

    if (isLayout) {
        long groupId = ParamUtil.getLong(actionRequest, "groupId");
        boolean privateLayout = ParamUtil.getBoolean(actionRequest, "privateLayout");
        long layoutId = ParamUtil.getLong(actionRequest, "layoutId");

        layout = _layoutLocalService.getLayout(groupId, privateLayout, layoutId);
    }/*  w  w  w . j  a va 2s  .c  om*/

    for (Map.Entry<String, ThemeSetting> entry : themeSettings.entrySet()) {
        String key = entry.getKey();
        ThemeSetting themeSetting = entry.getValue();

        String property = StringBundler.concat(device, "ThemeSettingsProperties--", key,
                StringPool.DOUBLE_DASH);

        String value = ParamUtil.getString(actionRequest, property, themeSetting.getValue());

        if ((isLayout && !Objects.equals(value, layout.getDefaultThemeSetting(key, device, false)))
                || (!isLayout && !value.equals(themeSetting.getValue()))) {

            typeSettingsProperties.setProperty(ThemeSettingImpl.namespaceProperty(device, key), value);
        }
    }
}