Example usage for com.liferay.portal.kernel.model LayoutTypePortlet reorganizePortlets

List of usage examples for com.liferay.portal.kernel.model LayoutTypePortlet reorganizePortlets

Introduction

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

Prototype

public void reorganizePortlets(List<String> newColumns, List<String> oldColumns);

Source Link

Usage

From source file:com.liferay.nested.portlets.web.internal.portlet.action.NestedPortletsConfigurationAction.java

License:Open Source License

protected void reorganizeNestedColumns(ActionRequest actionRequest, String portletResource,
        String newLayoutTemplateId, String oldLayoutTemplateId) throws PortalException {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Layout layout = themeDisplay.getLayout();
    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();
    Theme theme = themeDisplay.getTheme();

    LayoutTemplate newLayoutTemplate = _layoutTemplateLocalService.getLayoutTemplate(newLayoutTemplateId, false,
            theme.getThemeId());/*w  ww  .ja  v  a2s .c om*/

    List<String> newColumns = getColumnNames(newLayoutTemplate.getContent(), portletResource);

    LayoutTemplate oldLayoutTemplate = _layoutTemplateLocalService.getLayoutTemplate(oldLayoutTemplateId, false,
            theme.getThemeId());

    List<String> oldColumns = getColumnNames(oldLayoutTemplate.getContent(), portletResource);

    layoutTypePortlet.reorganizePortlets(newColumns, oldColumns);

    layoutTypePortlet.setStateMax(StringPool.BLANK);

    _layoutLocalService.updateLayout(layout.getGroupId(), layout.isPrivateLayout(), layout.getLayoutId(),
            layout.getTypeSettings());
}