Example usage for com.liferay.portal.kernel.theme PortletDisplay getColumnId

List of usage examples for com.liferay.portal.kernel.theme PortletDisplay getColumnId

Introduction

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

Prototype

public String getColumnId() 

Source Link

Usage

From source file:com.liferay.faces.bridge.ext.filter.internal.HeaderRequestBridgeLiferayImpl.java

License:Open Source License

public HeaderRequestBridgeLiferayImpl(HeaderRequest headerRequest, String responseNamespace,
        PortletConfig portletConfig, PortalContext portalContext) {
    super(headerRequest);
    this.liferayPortletRequest = new LiferayPortletRequest(headerRequest, responseNamespace, portletConfig);
    this.portalContext = portalContext;

    // Hack: Need to save information that's only available at RenderRequest time in order to have
    // LiferayURLGeneratorBaseImpl be able to create ResourceURLs properly during the RESOURCE_PHASE.
    String p_p_col_id = responseNamespace.concat("p_p_col_id");
    String p_p_col_pos = responseNamespace.concat("p_p_col_pos");
    String p_p_col_count = responseNamespace.concat("p_p_col_count");
    String p_p_mode = responseNamespace.concat("p_p_mode");
    String p_p_state = responseNamespace.concat("p_p_state");

    try {// w  w w  .  j a v a  2s.  co  m
        PortletContext portletContext = headerRequest.getPortletSession().getPortletContext();

        // Get the p_p_col_id and save it.
        ThemeDisplay themeDisplay = (ThemeDisplay) headerRequest.getAttribute(WebKeys.THEME_DISPLAY);
        PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
        portletContext.setAttribute(p_p_col_id, portletDisplay.getColumnId());

        // Get the p_p_col_pos and save it.
        portletContext.setAttribute(p_p_col_pos, Integer.toString(portletDisplay.getColumnPos()));

        // Get the p_p_col_count and save it.
        portletContext.setAttribute(p_p_col_count, Integer.toString(portletDisplay.getColumnCount()));

        // Get the p_p_mode and save it.
        PortletMode portletMode = headerRequest.getPortletMode();

        if (portletMode != null) {
            portletContext.setAttribute(p_p_mode, portletMode.toString());
        }

        // Get the p_p_state and save it.
        WindowState windowState = headerRequest.getWindowState();

        if (windowState != null) {
            portletContext.setAttribute(p_p_state, windowState.toString());
        }
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:com.liferay.faces.bridge.ext.filter.internal.RenderRequestBridgeLiferayImpl.java

License:Open Source License

public RenderRequestBridgeLiferayImpl(RenderRequest renderRequest, String responseNamespace,
        PortletConfig portletConfig, PortalContext portalContext) {
    super(renderRequest);
    this.liferayPortletRequest = new LiferayPortletRequest(renderRequest, responseNamespace, portletConfig);
    this.portalContext = portalContext;

    // Hack: Need to save information that's only available at RenderRequest time in order to have
    // LiferayURLGeneratorBaseImpl be able to create ResourceURLs properly during the RESOURCE_PHASE.
    String p_p_col_id = responseNamespace.concat("p_p_col_id");
    String p_p_col_pos = responseNamespace.concat("p_p_col_pos");
    String p_p_col_count = responseNamespace.concat("p_p_col_count");
    String p_p_mode = responseNamespace.concat("p_p_mode");
    String p_p_state = responseNamespace.concat("p_p_state");

    try {//from  w  w w  .  ja  v  a 2s  .  c  o  m
        PortletContext portletContext = renderRequest.getPortletSession().getPortletContext();

        // Get the p_p_col_id and save it.
        ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
        PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
        portletContext.setAttribute(p_p_col_id, portletDisplay.getColumnId());

        // Get the p_p_col_pos and save it.
        portletContext.setAttribute(p_p_col_pos, Integer.toString(portletDisplay.getColumnPos()));

        // Get the p_p_col_count and save it.
        portletContext.setAttribute(p_p_col_count, Integer.toString(portletDisplay.getColumnCount()));

        // Get the p_p_mode and save it.
        PortletMode portletMode = renderRequest.getPortletMode();

        if (portletMode != null) {
            portletContext.setAttribute(p_p_mode, portletMode.toString());
        }

        // Get the p_p_state and save it.
        WindowState windowState = renderRequest.getWindowState();

        if (windowState != null) {
            portletContext.setAttribute(p_p_state, windowState.toString());
        }
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}