Example usage for com.liferay.portal.model.impl ThemeSettingImpl namespaceProperty

List of usage examples for com.liferay.portal.model.impl ThemeSettingImpl namespaceProperty

Introduction

In this page you can find the example usage for com.liferay.portal.model.impl ThemeSettingImpl namespaceProperty.

Prototype

public static String namespaceProperty(String device, String key) 

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;/*from  w w  w .ja v a2s .c o m*/

    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);
    }

    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);
        }
    }
}

From source file:com.liferay.portlet.layoutsadmin.action.EditLayoutsAction.java

License:Open Source License

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

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

    Layout layout = LayoutLocalServiceUtil.getLayout(groupId, privateLayout, layoutId);

    LayoutSet layoutSet = layout.getLayoutSet();

    for (String key : themeSettings.keySet()) {
        ThemeSetting themeSetting = themeSettings.get(key);

        String type = GetterUtil.getString(themeSetting.getType(), "text");

        String property = device + "ThemeSettingsProperties--" + key + StringPool.DOUBLE_DASH;

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

        if (type.equals("checkbox")) {
            value = String.valueOf(GetterUtil.getBoolean(value));
        }/*  w  w  w .  j  a  v  a2  s . co m*/

        if (!value.equals(layoutSet.getThemeSetting(key, device))) {
            typeSettingsProperties.setProperty(ThemeSettingImpl.namespaceProperty(device, key), value);
        }
    }
}