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

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

Introduction

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

Prototype

public List<Layout> getLayouts() 

Source Link

Document

Returns the site's top-level pages.

Usage

From source file:com.liferay.hello.soy.web.internal.portlet.action.HelloSoyViewMVCRenderCommand.java

License:Apache License

@Override
public String render(RenderRequest renderRequest, RenderResponse renderResponse) {

    Template template = (Template) renderRequest.getAttribute(WebKeys.TEMPLATE);

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

    List<Layout> layouts = themeDisplay.getLayouts();

    Stream<Layout> layoutStream = layouts.stream();

    template.put("layouts", layoutStream.map(layout -> new HashMap<String, String>() {
        {//from ww  w  .  j  av  a  2  s  .  c  o m
            put("friendlyURL", layout.getFriendlyURL());
            put("nameCurrentValue", layout.getNameCurrentValue());
        }
    }).collect(Collectors.toList()));

    PortletURL navigationURL = renderResponse.createRenderURL();

    navigationURL.setParameter("mvcRenderCommandName", "Navigation");

    template.put("navigationURL", navigationURL.toString());

    template.put("releaseInfo", ReleaseInfo.getReleaseInfo());

    return "View";
}