Package org.apache.jetspeed.container

Examples of org.apache.jetspeed.container.PortletWindow


     */
    public void doView( RenderRequest request, RenderResponse response ) throws PortletException, IOException
    {
        RequestContext context = getRequestContext(request);
        response.setContentType(context.getMimeType());       
        PortletWindow window = context.getPortalURL().getNavigationalState().getMaximizedWindow();
        boolean maximized = (window != null);
        boolean solo = false;

        if (maximized)
        {
View Full Code Here


        portalURL.setCharacterEncoding("UTF-8");
        MockRequestContext requestContext = new MockRequestContext();
        requestContext.setRequest(request);
        portalURL.getNavigationalState().sync(requestContext);

        PortletWindow window = new MockPortletWindow("111");

        HashMap<String,String[]> parameters = new HashMap<String, String[]>();
        parameters.put("test",new String[]{"one","two","three"});

        Map<String, String[]> privateRenderParameters = Collections.emptyMap();
View Full Code Here

    protected void doTestUrl(PortalURL portalURL, HttpServletRequest request)
    {
        portalURL.setRequest(request);
        portalURL.setCharacterEncoding("UTF-8");
       
        PortletWindow window = new MockPortletWindow("111");
        NavigationalState nav = portalURL.getNavigationalState();
        MockRequestContext requestContext = new MockRequestContext();
        requestContext.addPortletWindow(window);
        requestContext.setRequest(request);
        nav.sync(requestContext);
       
        // Check that they come out correctly
        assertTrue("window mode is not set", nav.getMode(window).equals(PortletMode.EDIT));
        assertTrue("window state is not set", nav.getState(window).equals(WindowState.MAXIMIZED));
        PortletWindow target = nav.getPortletWindowOfAction();
        assertNotNull("target window is null", target);
        assertEquals("target window should equal window 111", target.getId().getStringId(), "111");
       
        PortletWindow maximizedWindow = nav.getMaximizedWindow();
        assertNotNull("maximized window is null", maximizedWindow);
        assertEquals("maximized window should equal window 111", maximizedWindow.getId().getStringId(), "111");
       
        Map<String,String[]> parameters = nav.getParameterMap(target);
        assertTrue("There should be one parameter",parameters.size()==1);
        String[] values = parameters.get("test");
        assertNotNull("parameter name has no values", values);
View Full Code Here

                        requestStates.setMaximizedWindow(context.getPortletWindow(requestState.getWindowId()));
                    }
                }
                else
                {
                    PortletWindow maximizedWindow = context.resolvePortletWindow(pageState.maximizedWindowId);
                    if (maximizedWindow == null || !maximizedWindow.isValid())
                    {
                        // gone: remove sessionState
                        pageState.windowStates.remove(pageState.maximizedWindowId);
                        pageState.maximizedWindowId = null;
                    }
                    else
                    {
                        requestStates.setMaximizedWindow(maximizedWindow);
                    }
                }
            }
            else if ( !requestMaximizedWindowId.equals( pageState.maximizedWindowId ))
            {
                // When can a non-maximized window request maximized state while another already has it?
                // Maybe from a decoration portlet which always needs to be viewable?
                requestState = requestStates.getPortletWindowNavigationalState(pageState.maximizedWindowId);
                sessionState = pageState.windowStates.get(pageState.maximizedWindowId);
                if ( requestState == null || requestState.getWindowState() == null )
                {
                    // need to clear it ourselves first
                    sessionState.setWindowState(null);
                }
            }
        }
       
        if ( requestStates.getMaximizedWindow() != null )
        {
            // store the new MAXIMIZED window
            pageState.maximizedWindowId = requestStates.getMaximizedWindow().getId().toString();
        }
       
        // now synchronize requestStates and sessionStates
        Iterator<String> iter = requestStates.getWindowIdIterator();
        String actionWindowId = requestStates.getActionWindow() != null ? requestStates.getActionWindow().getWindowId() : null;
        boolean actionRequestState = false;
        while ( iter.hasNext() )
        {
            requestState = requestStates.getPortletWindowNavigationalState(iter.next());
            sessionState = pageState.windowStates.get(requestState.getWindowId());
            if ( sessionState == null )
            {
                if ( storeParameters )
                {
                    sessionState = new PortletWindowExtendedNavigationalState();
                }
                else
                {
                    sessionState = new PortletWindowBaseNavigationalState();
                }
                sessionState.setActionScopedRequestAttributes(requestState.isActionScopedRequestAttributes());
                pageState.windowStates.put(requestState.getWindowId(),sessionState);
            }

            actionRequestState = actionWindowId != null && actionWindowId.equals(requestState.getWindowId());
            boolean changed = syncStates(actionRequestState, requestStates, requestState, sessionState);     
            if (changed)
            {
                removeFromCache(context, requestState.getWindowId(), cache);
                removeFromCache(context, page.getId(), decorationCache);
                if (storeParameters)
                {
                    ((PortletWindowExtendedNavigationalState)sessionState).resetDecoratorActionEncodings();
                }
            }
        }

        // now copy missing requestStates from the pageState
        synchronized(pageState.windowStates)
        {
            iter = pageState.windowStates.keySet().iterator();
            String windowId;
            while ( iter.hasNext() )
            {
                windowId = iter.next();
                requestState = requestStates.getPortletWindowNavigationalState(windowId);
                if ( requestState == null )
                {
                    PortletWindow window = context.resolvePortletWindow(windowId);
                    if (window != null)
                    {
                        requestState = new PortletWindowRequestNavigationalState(windowId);
                        requestState.setPortletDefinition(window.getPortletDefinition());
                        sessionState = pageState.windowStates.get(windowId);
                        requestState.setActionScopedRequestAttributes(sessionState.isActionScopedRequestAttributes());
                        requestStates.addPortletWindowNavigationalState(windowId, requestState);
                        boolean changed = syncStates(false, requestStates, requestState, sessionState);
                        if (changed)
View Full Code Here

    {
        if ( request.getUserPrincipal() == null )
        {
            return null;
        }
        PortletWindow portletWindow = (PortletWindow)window;
        return getUserInfoMap(portletWindow.getPortletDefinition().getApplication().getName(), portletWindow.getRequestContext());       
    }
View Full Code Here

     */
    public WindowState getWindowState() throws Exception
    {
        try
        {
            PortletWindow window = getPortletWindow(getCurrentFragment());
            if (!window.isValid())
            {
                // return a sensible default value to allow a mimimum level of processing to continue
                return WindowState.NORMAL;
            }
            return getRequestContext().getPortalURL().getNavigationalState().getState(window);
View Full Code Here

     */
    public WindowState getMappedWindowState() throws Exception
    {
        try
        {
            PortletWindow window = getPortletWindow(getCurrentFragment());
            if (!window.isValid())
            {
                // return a sensible default value to allow a mimimum level of processing to continue
                return WindowState.NORMAL;
            }
            return getRequestContext().getPortalURL().getNavigationalState().getMappedState(window);
View Full Code Here

    {
        boolean targetResolved = true;
        for (Iterator<Map.Entry<String,PortletWindowRequestNavigationalState>> entryIter = requestStates.getPortletWindowRequestNavigationalStates().entrySet().iterator(); entryIter.hasNext(); )
        {
            Map.Entry<String,PortletWindowRequestNavigationalState> entry = entryIter.next();
            PortletWindow window = requestContext.resolvePortletWindow(entry.getKey());
            if (window == null || !window.isValid())
            {
                entryIter.remove();
                if (requestStates.getTargetWindowId() != null && entry.getKey().equals(requestStates.getTargetWindowId()))
                {
                    requestStates.setTargetWindowId(null);
                    if (PortalURL.URLType.RENDER != requestStates.getURLType())
                    {
                        targetResolved = false;
                    }
                }
            }
            else
            {
                entry.getValue().setPortletDefinition(window.getPortletDefinition());
                if (requestStates.getTargetWindowId() != null && entry.getKey().equals(requestStates.getTargetWindowId()))
                {
                    if (PortalURL.URLType.ACTION == requestStates.getURLType())
                    {
                        requestStates.setActionWindow(window);
View Full Code Here

     */
    public PortletMode getPortletMode() throws Exception
    {
        try
        {
            PortletWindow window = getPortletWindow(getCurrentFragment());
            if (!window.isValid())
            {
                // return a sensible default value to allow a mimimum level of processing to continue
                return PortletMode.VIEW;
            }
            return getRequestContext().getPortalURL().getNavigationalState().getMode(window);
View Full Code Here

     */
    public PortletMode getMappedPortletMode() throws Exception
    {
        try
        {
            PortletWindow window = getPortletWindow(getCurrentFragment());
            if (!window.isValid())
            {
                // return a sensible default value to allow a mimimum level of processing to continue
                return PortletMode.VIEW;
            }
            return getRequestContext().getPortalURL().getNavigationalState().getMappedMode(window);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.container.PortletWindow

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.