Package org.apache.jetspeed.container.state

Examples of org.apache.jetspeed.container.state.MutableNavigationalState


        boolean targeted = fusion.isTargeted(jdata, instance, action);               
        boolean restoring = false;
        if (targeted && action != null && action.equals(J1_RESTORE_ACTION))
        {
            restoring = true;
            MutableNavigationalState mnav = (MutableNavigationalState)nav;
            mnav.setMode(window, PortletMode.VIEW);
            //nav.sync(context);           
        }
       
        boolean customized = (!restoring && (jdata.getMode() == JetspeedRunData.CUSTOMIZE ||
                              targeted && action.equals(J1_EDIT_ACTION) ||
View Full Code Here


    private void syncNavigationalState(PortletWindow window,
                                       JetspeedRunData data,
                                       int mode,
                                       PortletInstance instance)
    {
        MutableNavigationalState nav = getNavigationalState(data);
        RequestContext context = (RequestContext) data.getRequest().getAttribute(FUSION_NAV_STATE);       
        if (null == nav)
        {
            return;
        }
           
        PortletMode mode2 = PortletMode.VIEW;
        WindowState state = WindowState.NORMAL;
        
        mode2 = nav.getMode(window);
        state = nav.getState(window);
        
        if (isMinimized(data))
        {
            nav.setState(window, WindowState.MINIMIZED);
            nav.sync(context);
            return;           
        }
       
       
        String action = data.getAction();
        boolean targeted = isTargeted(data, instance, action);
        
        boolean syncRequired = false;
        
        if (!targeted)
        {
            if (mode2 != null && mode2.equals(PortletMode.VIEW))
            {
               
            }
        }
        else
        {           
            if (targeted && action.equals(J1_HELP_ACTION))
            {
                nav.setMode(window, PortletMode.HELP);
                nav.sync(context);           
                return;
            }
            if (targeted && action.equals(J1_RESTORE_ACTION))
            {
                nav.setMode(window, PortletMode.VIEW);
                nav.setState(window, WindowState.NORMAL);
                nav.sync(context);           
                return;
            }
            if (targeted && action.equals(J1_EDIT_ACTION))
            {
                nav.setMode(window, PortletMode.EDIT);
                nav.sync(context);           
                return;
            }
           
            switch (mode)
            {
            case JetspeedRunData.NORMAL:
                if (!mode2.equals(PortletMode.VIEW))
                {
                    nav.setMode(window, PortletMode.VIEW);
                    syncRequired = true;
                }
                if (!state.equals(WindowState.NORMAL))
                {
                    nav.setState(window, WindowState.NORMAL);
                    syncRequired = true;               
                }               
                break;
            case JetspeedRunData.MAXIMIZE:
                if (!state.equals(WindowState.MAXIMIZED))
                {
                    nav.setState(window, WindowState.MAXIMIZED);
                    syncRequired = true;               
                }               
                break;
            case JetspeedRunData.CUSTOMIZE:
                if (!mode2.equals(PortletMode.EDIT))
                {
                    nav.setMode(window, PortletMode.EDIT);
                    syncRequired = true;               
                }               
                break;               
            }
             
            if (syncRequired)
            {
                nav.sync(context);
            }
        }
    }
View Full Code Here

           
            String oldState = fragment.getState();
            String oldMode = fragment.getMode();
           
            // Now Change the transient navigational state
            MutableNavigationalState navState = (MutableNavigationalState)requestContext.getPortalURL().getNavigationalState();
            PortletWindow portletWindow = windowAccessor.getPortletWindow(fragment);
            if (portletWindow != null)
            {
                oldState = navState.getState(portletWindow).toString();
                oldMode =  navState.getMode(portletWindow).toString();
                if (windowState != null)
                {
                    navState.setState(portletWindow, new WindowState(windowState));
                }
                if (portletMode != null)
                {
                    navState.setMode(portletWindow, new PortletMode(portletMode));
                }
                navState.sync(requestContext);                               
            }
           

            if (checkAccess(requestContext, JetspeedActions.EDIT))
            {
View Full Code Here

        {
            // create a session if not already created, necessary for Tomcat 5
            request.getRequest().getSession(true);

            // PortletContainerServices.prepare();
            MutableNavigationalState state = (MutableNavigationalState)request.getPortalURL().getNavigationalState();
            if (state != null)
            {
                boolean redirect = false;
                Page page = request.getPage();
                PortletWindow window = state.getPortletWindowOfResource();
                if (window != null && page.getFragmentById(window.getId().toString()) == null)
                {
                    // target window doesn't exists anymore or the target page is not accessible (anymore)
                    request.getResponse().sendError(HttpServletResponse.SC_NOT_FOUND);
                    return;
                }
                window = state.getPortletWindowOfAction();
                if (window != null && page.getFragmentById(window.getId().toString()) == null)
                {
                    // target window doesn't exists anymore or the target page is not accessible (anymore)
                    // remove any navigational state for the window
                    state.removeState(window);
                    // as this is an action request which cannot be handled, perform a direct redirect after sync state (for the other windows)
                    redirect = true;
                }
                window = state.getMaximizedWindow();
                if (window != null && page.getFragmentById(window.getId().toString()) == null)
                {
                    // target window doesn't exists anymore or the target page is not accessible (anymore)
                    // remove any navigational state for the window
                    state.removeState(window);
                }
                state.sync(request);
                if (redirect)
                {
                    // target page doesn't contain (anymore) the targeted windowOfAction
                    // this can also occur when a session is expired and the target page isn't accessible for the anonymous user
                    // Redirect the user back to the target page (with possibly retaining the other windows navigational state).
                    request.getResponse().sendRedirect(request.getPortalURL().getPortalURL());
                    return;
                }

                PortletWindow actionWindow = state.getPortletWindowOfAction();
                if (null == actionWindow)
                {
                    // set to null to denote that no action was requested
                    request.setActionWindow(null);
                }
View Full Code Here

           
            String oldState = fragment.getState();
            String oldMode = fragment.getMode();
           
            // Now Change the transient navigational state
            MutableNavigationalState navState = (MutableNavigationalState)requestContext.getPortalURL().getNavigationalState();
            PortletWindow portletWindow = windowAccessor.getPortletWindow(fragment);
            if (portletWindow != null)
            {
                oldState = navState.getState(portletWindow).toString();
                oldMode =  navState.getMode(portletWindow).toString();
                if (windowState != null)
                {
                    navState.setState(portletWindow, new WindowState(windowState));
                }
                if (portletMode != null)
                {
                    navState.setMode(portletWindow, new PortletMode(portletMode));
                }
                navState.sync(requestContext);                               
            }
           

            if (checkAccess(requestContext, JetspeedActions.EDIT))
            {
View Full Code Here

        {
            // create a session if not already created, necessary for Tomcat 5
            request.getRequest().getSession(true);

            // PortletContainerServices.prepare();
            MutableNavigationalState state = (MutableNavigationalState)request.getPortalURL().getNavigationalState();
            if (state != null)
            {
                boolean redirect = false;
                Page page = request.getPage();
                PortletWindow window = state.getPortletWindowOfResource();
                if (window != null && page.getFragmentById(window.getId().toString()) == null)
                {
                    // target window doesn't exists anymore or the target page is not accessible (anymore)
                    request.getResponse().sendError(HttpServletResponse.SC_NOT_FOUND);
                    return;
                }
                window = state.getPortletWindowOfAction();
                if (window != null && page.getFragmentById(window.getId().toString()) == null)
                {
                    if (!((PortletWindowImpl) window).isInstantlyRendered())
                    {
                        // target window doesn't exists anymore or the target page is not accessible (anymore)
                        // remove any navigational state for the window
                        state.removeState(window);
                        // as this is an action request which cannot be handled, perform a direct redirect after sync state (for the other windows)
                        redirect = true;
                    }
                }
                window = state.getMaximizedWindow();
                if (window != null && page.getFragmentById(window.getId().toString()) == null)
                {
                    // target window doesn't exists anymore or the target page is not accessible (anymore)
                    // remove any navigational state for the window
                    state.removeState(window);
                }
                state.sync(request);
                if (redirect)
                {
                    // target page doesn't contain (anymore) the targeted windowOfAction
                    // this can also occur when a session is expired and the target page isn't accessible for the anonymous user
                    // Redirect the user back to the target page (with possibly retaining the other windows navigational state).
                    request.getResponse().sendRedirect(request.getPortalURL().getPortalURL());
                    return;
                }

                PortletWindow actionWindow = state.getPortletWindowOfAction();
                if (null == actionWindow)
                {
                    // set to null to denote that no action was requested
                    request.setActionWindow(null);
                }
View Full Code Here

                    // a session is expired and the target actionWindow doesn't have portlet entity.
                    // Redirect the user back to the target page (with possibly retaining the other windows navigational state).
                    log.warn("Portlet action was canceled because the session was expired. The actionWindow's id is " + actionWindow.getId());
                   
                    request.setActionWindow(null);
                    MutableNavigationalState state = (MutableNavigationalState) request.getPortalURL().getNavigationalState();
                   
                    if (state != null)
                    {
                        state.removeState(actionWindow);
                        state.sync(request);
                        request.getResponse().sendRedirect(request.getPortalURL().getPortalURL());
                        return;
                    }
                }
View Full Code Here

             
              String oldState = fragment.getState();
              String oldMode = fragment.getMode();
             
              // Now Change the transient navigational state
              MutableNavigationalState navState = (MutableNavigationalState)requestContext.getPortalURL().getNavigationalState();
              PortletWindow portletWindow = windowAccessor.getPortletWindow(fragment);
              if (portletWindow != null)
              {
                  oldState = navState.getState(portletWindow).toString();
                  oldMode =  navState.getMode(portletWindow).toString();
                  if (requestedState != null)
                  {
                      navState.setState(portletWindow, new WindowState(requestedState));
                  }
                  if (requestedMode != null)
                  {
                      navState.setMode(portletWindow, new PortletMode(requestedMode));
                  }
                  navState.sync(requestContext);                               
              }
             
 
              if (checkAccess(requestContext, JetspeedActions.EDIT))
              {
View Full Code Here

    private void changePortletView(PortletRequest request, PortletResponse response, String view)
    {
        //this.setDefaultViewPage("page-view");
        PortletWindow window = (PortletWindow)request.getAttribute(PortalReservedParameters.PORTLET_WINDOW_ATTRIBUTE);
        RequestContext context = (RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
        MutableNavigationalState state = (MutableNavigationalState)context.getPortalURL().getNavigationalState();
        if (window != null)
            state.clearParameters(window);           
        this.setLogicalView(request, response, view, PortletMode.VIEW);       
    }
View Full Code Here

        {
            return url.createPortletURL(portletWindow, renderParms, actionScopeID, actionScopeRendered, cacheLevel, resourceID, privateRenderParms, publicRenderParameters, portletMode, windowState, urlType, secure);
        }
        else
        {
            MutableNavigationalState navState = (MutableNavigationalState)url.getNavigationalState();
            // block possible other concurrent processEvent trying to do the same
            synchronized (navState)
            {
                navState.setTargetted(portletWindow);
                navState.setMode(portletWindow, portletMode);
                navState.setState(portletWindow, windowState);
                navState.setActionScopeId(portletWindow, actionScopeID);
                navState.setActionScopeRendered(portletWindow, actionScopeRendered);
                navState.setCacheLevel(portletWindow, cacheLevel);
                navState.setResourceId(portletWindow, resourceID);
                navState.setPrivateRenderParametersMap(portletWindow, privateRenderParms);               
                if (publicRenderParameters == null)
                {
                    navState.setParametersMap(portletWindow, renderParms);
                }
                else
                {
                    if (renderParameters == null)
                    {
                        navState.setParametersMap(portletWindow, null);
                    }
                    else
                    {
                        for (String key : publicRenderParameters.keySet())
                        {
                            renderParameters.remove(key);
                        }
                        navState.setParametersMap(portletWindow, renderParameters);
                    }
                    navState.setPublicRenderParametersMap(portletWindow, publicRenderParameters);
                }
            }
            return null;
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.container.state.MutableNavigationalState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.