List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay isStateExclusive
public boolean isStateExclusive()
From source file:com.liferay.faces.bridge.ext.context.internal.PortalContextBridgeLiferayImpl.java
License:Open Source License
public PortalContextBridgeLiferayImpl(PortletRequest portletRequest) { this.wrappedPortalContext = portletRequest.getPortalContext(); // Determine whether or not the portlet was added via $theme.runtime(...) Boolean renderPortletResource = (Boolean) portletRequest.getAttribute("RENDER_PORTLET_RESOURCE"); // If this is a runtime portlet, then it is not possible to add resources to the head section since // top_head.jsp is included prior to the runtime portlet being invoked. boolean runtimePortlet = (renderPortletResource != null) && renderPortletResource; // If this portlet is running via WSRP, then it is not possible to add resources to the head section // because Liferay doesn't support that feature with WSRP. boolean wsrpPortlet = BooleanHelper.isTrueToken(portletRequest.getParameter("wsrp")); // If the portlet's state is exclusive, then the head section will not be written. ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); boolean stateExclusive = themeDisplay.isStateExclusive(); if (!(isAjaxRequest(portletRequest) || runtimePortlet || wsrpPortlet || stateExclusive)) { this.addToHeadSupport = "true"; }/*from w w w. jav a 2s.co m*/ if (isLiferayNamespacingParameters(portletRequest)) { this.namespacedParametersRequired = "true"; } }
From source file:com.liferay.faces.bridge.ext.renderkit.html_basic.internal.ScriptsEncoderLiferayImpl.java
License:Open Source License
@Override public void encodeBodyScripts(FacesContext facesContext, List<Script> scripts) throws IOException { ExternalContext externalContext = facesContext.getExternalContext(); Map<String, Object> requestMap = externalContext.getRequestMap(); ThemeDisplay themeDisplay = (ThemeDisplay) requestMap.get(WebKeys.THEME_DISPLAY); // If the portlet is being rendered on its own, then render the scripts immediately before the closing <div> // of the portlet. if (themeDisplay.isStateExclusive() || themeDisplay.isIsolated()) { String scriptsString = getScriptsAsString(facesContext, scripts); ResponseWriter responseWriter = facesContext.getResponseWriter(); responseWriter.write(scriptsString); }/*w w w .j a v a2 s. c o m*/ // Otherwise, allow Liferay to render the scripts at the bottom of the page before the closing <body> tag. else { ScriptData scriptData = (ScriptData) requestMap.get(WebKeys.AUI_SCRIPT_DATA); if (scriptData == null) { scriptData = new ScriptData(); requestMap.put(WebKeys.AUI_SCRIPT_DATA, scriptData); } scriptDataAppendScripts(scriptData, requestMap, scripts); } }