Search in sources :

Example 16 with WindowState

use of javax.portlet.WindowState in project uPortal by Jasig.

the class PortletWindowRegistryImpl method initializePortletWindowData.

/**
     * Initializes a newly created {@link PortletWindow}, the default implementation sets up the
     * appropriate {@link WindowState} and {@link javax.portlet.PortletMode}
     */
protected void initializePortletWindowData(HttpServletRequest request, PortletWindowData portletWindowData) {
    final IStylesheetDescriptor stylesheetDescriptor = getThemeStylesheetDescriptor(request);
    final IPortletEntityId portletEntityId = portletWindowData.getPortletEntityId();
    final IPortletEntity portletEntity = this.portletEntityRegistry.getPortletEntity(request, portletEntityId);
    final WindowState entityWindowState = portletEntity.getWindowState(stylesheetDescriptor);
    if (persistentWindowStates.contains(entityWindowState)) {
        portletWindowData.setWindowState(entityWindowState);
    } else if (entityWindowState != null) {
        //Set of persistent window states must have changed, nuke the old value
        this.logger.warn("PortletEntity.windowState=" + entityWindowState + " but that state is not in the set of persistent WindowStates. PortletEntity.windowState will be set to null");
        portletEntity.setWindowState(stylesheetDescriptor, null);
        this.portletEntityRegistry.storePortletEntity(request, portletEntity);
    }
}
Also used : WindowState(javax.portlet.WindowState) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) IStylesheetDescriptor(org.apereo.portal.layout.om.IStylesheetDescriptor) IPortletEntityId(org.apereo.portal.portlet.om.IPortletEntityId)

Example 17 with WindowState

use of javax.portlet.WindowState in project uPortal by Jasig.

the class PortalUrlProviderImpl method getPortalUrlBuilderByPortletWindow.

protected IPortalUrlBuilder getPortalUrlBuilderByPortletWindow(HttpServletRequest request, IPortletWindow portletWindow, UrlType urlType) {
    final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
    //See if the targeted portlet is actually a delegate
    final IPortletWindowId parentPortletWindowId = portletWindow.getDelegationParentId();
    if (parentPortletWindowId != null) {
        //Get the portal url builder that targets the parent
        final IPortalUrlBuilder portalUrlBuilder = this.getPortalUrlBuilderByPortletWindow(request, parentPortletWindowId, urlType);
        //See if there is additional delegation request data that needs to be added to the URL
        final DelegationRequest delegationRequest = this.portletDelegationManager.getDelegationRequest(request, portletWindowId);
        if (delegationRequest != null) {
            final IPortletUrlBuilder parentPortletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(parentPortletWindowId);
            final Map<String, List<String>> parentParameters = delegationRequest.getParentParameters();
            if (parentParameters != null) {
                parentPortletUrlBuilder.setParameters(parentParameters);
            }
            final PortletMode parentPortletMode = delegationRequest.getParentPortletMode();
            if (parentPortletMode != null) {
                parentPortletUrlBuilder.setPortletMode(parentPortletMode);
            }
            final WindowState parentWindowState = delegationRequest.getParentWindowState();
            if (parentWindowState != null) {
                parentPortletUrlBuilder.setWindowState(parentWindowState);
            }
        }
        return portalUrlBuilder;
    }
    //create the portlet url builder
    final String layoutNodeId = this.verifyPortletWindowId(request, portletWindowId);
    return new PortalUrlBuilder(this.urlSyntaxProvider, request, layoutNodeId, portletWindowId, urlType);
}
Also used : WindowState(javax.portlet.WindowState) List(java.util.List) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) DelegationRequest(org.apereo.portal.api.portlet.DelegationRequest) PortletMode(javax.portlet.PortletMode)

Example 18 with WindowState

use of javax.portlet.WindowState in project uPortal by Jasig.

the class RenderPortletTag method doEndTag.

@Override
public int doEndTag() throws JspException {
    //From portlet:defineObjects
    final RenderRequest renderRequest = (RenderRequest) this.pageContext.getAttribute("renderRequest");
    final RenderResponse renderResponse = (RenderResponse) this.pageContext.getAttribute("renderResponse");
    final PortletDelegationLocator portletDelegationLocator = (PortletDelegationLocator) renderRequest.getAttribute(PortletDelegationLocator.PORTLET_DELECATION_LOCATOR_ATTR);
    final String sessionKey = this.sessionKeyPrefix + this.fname;
    final PortletSession portletSession = renderRequest.getPortletSession();
    IPortletWindowId portletWindowId = (IPortletWindowId) portletSession.getAttribute(sessionKey);
    final PortletDelegationDispatcher portletDelegationDispatcher;
    final DelegateState delegateState;
    //No id in session, create a new dispatcher
    if (portletWindowId == null) {
        portletDelegationDispatcher = portletDelegationLocator.createRequestDispatcher(renderRequest, this.fname);
        portletWindowId = portletDelegationDispatcher.getPortletWindowId();
        portletSession.setAttribute(sessionKey, portletWindowId);
        final PortletMode portletMode = PortletUtils.getPortletMode(this.portletMode);
        final WindowState windowState = PortletUtils.getWindowState(this.windowState);
        delegateState = new DelegateState(portletMode, windowState);
    } else //id in session, get the old dispatcher
    {
        portletDelegationDispatcher = portletDelegationLocator.getRequestDispatcher(renderRequest, portletWindowId);
        delegateState = null;
    }
    final DelegationRequest delegationRequest = new DelegationRequest();
    delegationRequest.setDelegateState(delegateState);
    //Setup base for portlet URLs
    delegationRequest.setParentPortletMode(this.parentUrlMode);
    delegationRequest.setParentWindowState(this.parentUrlState);
    delegationRequest.setParentParameters(this.parentUrlParameters);
    final JspWriter out = this.pageContext.getOut();
    try {
        portletDelegationDispatcher.doRender(renderRequest, renderResponse, delegationRequest, new JspWriterPortletOutputHandler(out, renderResponse));
    } catch (IOException e) {
        throw new JspException("Failed to execute delegate render on portlet '" + this.fname + "'", e);
    }
    return Tag.EVAL_PAGE;
}
Also used : WindowState(javax.portlet.WindowState) RenderRequest(javax.portlet.RenderRequest) DelegateState(org.apereo.portal.api.portlet.DelegateState) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter) PortletMode(javax.portlet.PortletMode) JspException(javax.servlet.jsp.JspException) PortletSession(javax.portlet.PortletSession) PortletDelegationDispatcher(org.apereo.portal.api.portlet.PortletDelegationDispatcher) RenderResponse(javax.portlet.RenderResponse) PortletDelegationLocator(org.apereo.portal.api.portlet.PortletDelegationLocator) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) DelegationRequest(org.apereo.portal.api.portlet.DelegationRequest)

Example 19 with WindowState

use of javax.portlet.WindowState in project uPortal by Jasig.

the class PortletDelegationDispatcherImpl method setupDelegateRequestInfo.

protected void setupDelegateRequestInfo(HttpServletRequest request, DelegationRequest delegationRequest) {
    if (delegationRequest == null) {
        return;
    }
    final DelegateState delegateState = delegationRequest.getDelegateState();
    if (delegateState != null) {
        final PortletMode portletMode = delegateState.getPortletMode();
        if (portletMode != null) {
            this.portletWindow.setPortletMode(portletMode);
        }
        final WindowState windowState = delegateState.getWindowState();
        if (windowState != null) {
            this.portletWindow.setWindowState(windowState);
        }
    }
    final IPortletWindowId portletWindowId = this.portletWindow.getPortletWindowId();
    //Store the DelegationRequest so it can be accessed elsewhere
    this.portletDelegationManager.setDelegationRequest(request, portletWindowId, delegationRequest);
}
Also used : WindowState(javax.portlet.WindowState) DelegateState(org.apereo.portal.api.portlet.DelegateState) PortletMode(javax.portlet.PortletMode) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Aggregations

WindowState (javax.portlet.WindowState)19 PortletMode (javax.portlet.PortletMode)11 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)10 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)7 Map (java.util.Map)4 IStylesheetDescriptor (org.apereo.portal.layout.om.IStylesheetDescriptor)4 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)4 List (java.util.List)3 StringWriter (java.io.StringWriter)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedList (java.util.LinkedList)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 Transformer (javax.xml.transform.Transformer)2 StreamResult (javax.xml.transform.stream.StreamResult)2 DelegateState (org.apereo.portal.api.portlet.DelegateState)2 DelegationRequest (org.apereo.portal.api.portlet.DelegationRequest)2 MockPortletWindowId (org.apereo.portal.mock.portlet.om.MockPortletWindowId)2 IPerson (org.apereo.portal.security.IPerson)2 IPortalRequestInfo (org.apereo.portal.url.IPortalRequestInfo)2