Example usage for com.liferay.portal.kernel.util ThemeFactoryUtil getDefaultRegularThemeId

List of usage examples for com.liferay.portal.kernel.util ThemeFactoryUtil getDefaultRegularThemeId

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util ThemeFactoryUtil getDefaultRegularThemeId.

Prototype

public static String getDefaultRegularThemeId(long companyId) 

Source Link

Usage

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

License:Open Source License

public void updateLookAndFeel(ActionRequest actionRequest, long companyId, long liveGroupId,
        long stagingGroupId, boolean privateLayout, long layoutId, UnicodeProperties typeSettingsProperties)
        throws Exception {

    String[] devices = StringUtil.split(ParamUtil.getString(actionRequest, "devices"));

    for (String device : devices) {
        String deviceThemeId = ParamUtil.getString(actionRequest, device + "ThemeId");
        String deviceColorSchemeId = ParamUtil.getString(actionRequest, device + "ColorSchemeId");
        String deviceCss = ParamUtil.getString(actionRequest, device + "Css");

        boolean deviceInheritLookAndFeel = ParamUtil.getBoolean(actionRequest, device + "InheritLookAndFeel");

        if (deviceInheritLookAndFeel) {
            deviceThemeId = ThemeFactoryUtil.getDefaultRegularThemeId(companyId);
            deviceColorSchemeId = StringPool.BLANK;

            deleteThemeSettingsProperties(typeSettingsProperties, device);
        } else if (Validator.isNotNull(deviceThemeId)) {
            deviceColorSchemeId = getColorSchemeId(companyId, deviceThemeId, deviceColorSchemeId);

            updateThemeSettingsProperties(actionRequest, companyId, typeSettingsProperties, device,
                    deviceThemeId, true);
        }/*www  . ja  va2 s .c  o m*/

        long groupId = liveGroupId;

        if (stagingGroupId > 0) {
            groupId = stagingGroupId;
        }

        _layoutService.updateLayout(groupId, privateLayout, layoutId, typeSettingsProperties.toString());

        _layoutService.updateLookAndFeel(groupId, privateLayout, layoutId, deviceThemeId, deviceColorSchemeId,
                deviceCss);
    }
}

From source file:com.liferay.layout.internal.exportimport.data.handler.StagedLayoutSetStagedModelDataHandler.java

License:Open Source License

protected void exportTheme(PortletDataContext portletDataContext, StagedLayoutSet stagedLayoutSet) {

    boolean exportThemeSettings = MapUtil.getBoolean(portletDataContext.getParameterMap(),
            PortletDataHandlerKeys.THEME_REFERENCE);

    if (!exportThemeSettings) {
        stagedLayoutSet.setColorSchemeId(ColorSchemeFactoryUtil.getDefaultRegularColorSchemeId());
        stagedLayoutSet.setCss(StringPool.BLANK);
        stagedLayoutSet.setThemeId(ThemeFactoryUtil.getDefaultRegularThemeId(stagedLayoutSet.getCompanyId()));

        return;/*from   ww  w. j a  va2  s  .c o  m*/
    }

    long layoutSetBranchId = MapUtil.getLong(portletDataContext.getParameterMap(), "layoutSetBranchId");

    LayoutSetBranch layoutSetBranch = _layoutSetBranchLocalService.fetchLayoutSetBranch(layoutSetBranchId);

    ThemeExporter themeExporter = ThemeExporter.getInstance();

    if (layoutSetBranch != null) {
        try {
            themeExporter.exportTheme(portletDataContext, layoutSetBranch);
        } catch (Exception e) {
            if (_log.isWarnEnabled()) {
                _log.warn("Unable to export theme reference for layout set " + "branch "
                        + layoutSetBranch.getLayoutSetBranchId(), e);
            }
        }
    } else {
        try {
            themeExporter.exportTheme(portletDataContext, stagedLayoutSet);
        } catch (Exception e) {
            if (_log.isWarnEnabled()) {
                _log.warn("Unable to export theme reference for layout set " + stagedLayoutSet.getLayoutSetId(),
                        e);
            }
        }
    }
}