Package org.apache.pluto.om.portlet

Examples of org.apache.pluto.om.portlet.ContentTypeSet


    private boolean isValidContentType(String type)
    {
        type = stripCharacterEncoding(type);
        PortletEntity entity = portletWindow.getPortletEntity();
        PortletDefinition def = entity.getPortletDefinition();
        ContentTypeSet contentTypes = def.getContentTypeSet();
        Iterator it = contentTypes.iterator();
        while(it.hasNext()) {
            ContentType ct = (ContentType)it.next();
            String supportedType = ct.getContentType();
            if (supportedType.equals(type)) {
                return true;
View Full Code Here


            if (null == portlet)
            {
                return actions; // allow nothing
            }

            ContentTypeSet content = portlet.getContentTypeSet();

            if (state.equals(WindowState.NORMAL.toString()))
            {
                createAction(actions, JetspeedActions.INDEX_MINIMIZE, portlet);
                createAction(actions, JetspeedActions.INDEX_MAXIMIZE, portlet);
            }
            else if (state.equals(WindowState.MAXIMIZED.toString()))
            {
                createAction(actions, JetspeedActions.INDEX_MINIMIZE, portlet);
                createAction(actions, JetspeedActions.INDEX_NORMAL, portlet);
            }
            else
            // minimized
            {
                createAction(actions, JetspeedActions.INDEX_MAXIMIZE, portlet);
                createAction(actions, JetspeedActions.INDEX_NORMAL, portlet);
            }

            if (mode.equals(PortletMode.VIEW.toString()))
            {
                if (content.supportsPortletMode(PortletMode.EDIT) && checkAccess(Page.EDIT_ACTION))
                {
                    createAction(actions, JetspeedActions.INDEX_EDIT, portlet);
                }
                if (content.supportsPortletMode(PortletMode.HELP))
                {
                    createAction(actions, JetspeedActions.INDEX_HELP, portlet);
                }
            }
            else if (mode.equals(PortletMode.EDIT.toString()))
            {
                createAction(actions, JetspeedActions.INDEX_VIEW, portlet);
                if (content.supportsPortletMode(PortletMode.HELP))
                {
                    createAction(actions, JetspeedActions.INDEX_HELP, portlet);
                }
            }
            else
            // help
            {
                createAction(actions, JetspeedActions.INDEX_VIEW, portlet);
                if (content.supportsPortletMode(PortletMode.EDIT) && checkAccess(Page.EDIT_ACTION))
                {
                    createAction(actions, JetspeedActions.INDEX_EDIT, portlet);
                }
            }
            return actions;
View Full Code Here

            return actions;
        }

        // generate standard page actions depending on
        // portlet capabilities
        ContentTypeSet content = portlet.getContentTypeSet();
        if (mode.equals(PortletMode.VIEW.toString()))
        {
            if (content.supportsPortletMode(PortletMode.EDIT))
            {
                createAction(actions, JetspeedActions.INDEX_EDIT, portlet);
            }
            if (content.supportsPortletMode(PortletMode.HELP))
            {
                createAction(actions, JetspeedActions.INDEX_HELP, portlet);
            }
        }
        else if (mode.equals(PortletMode.EDIT.toString()))
        {
            createAction(actions, JetspeedActions.INDEX_VIEW, portlet);
            if (content.supportsPortletMode(PortletMode.HELP))
            {
                createAction(actions, JetspeedActions.INDEX_HELP, portlet);
            }
        }
        else
        // help
        {
            createAction(actions, JetspeedActions.INDEX_VIEW, portlet);
            if (content.supportsPortletMode(PortletMode.EDIT))
            {
                createAction(actions, JetspeedActions.INDEX_EDIT, portlet);
            }
        }
        return actions;
View Full Code Here

            count++;
        }
        assertTrue("InitParam Count != 1, count = " + count, count == 1);

        // Supports Content Type
        ContentTypeSet supports = portlet.getContentTypeSet();
        it = supports.iterator();
        count = 0;
        while (it.hasNext())
        {
            ContentTypeComposite contentType = (ContentTypeComposite) it.next();
            assertTrue("MimeType invalid: " + contentType.getContentType(), contentType.getContentType().equals("text/html"));
View Full Code Here

        List actions = Collections.EMPTY_LIST;
       
        PortletMode currentMode = requestContext.getPortalURL().getNavigationalState().getMode(window);
        WindowState currentState = requestContext.getPortalURL().getNavigationalState().getState(window);
        ContentTypeSet content = portlet.getContentTypeSet();
       
        if ( fragment.equals(requestContext.getPage().getRootFragment()) )
        {
            fragmentSupportsActions = true;
            actions = getPageModes(requestContext, window, content, currentMode, currentState, pageActionAccess, decoration, isAjaxRequest);
        }
        else if ( !Fragment.LAYOUT.equals(fragment.getType()) )
        {
            fragmentSupportsActions = true;
            String fragmentId = fragment.getId();
            PortletApplication pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();

            String portletName = portlet.getUniqueName();

            PortletMode currentMappedMode = pa.getMappedPortletMode(currentMode);
            WindowState currentMappedState = pa.getMappedWindowState(currentState);

            Object action;
            PortletMode mappedMode;
            PortletMode customMode;
            WindowState mappedState;
            WindowState customState;
           
            ArrayList actionTemplates = new ArrayList();
           
            DecoratorActionsFactory actionsAdapter = getDecoratorActionsAdapter(decoration);
           
            Iterator iter = actionsAdapter.getSupportedActions(requestContext, pa, window, currentMappedMode, currentMappedState, decoration).iterator();
           
            String currentModeAction = null;
            String currentStateAction = null;

            while ( iter.hasNext() )
            {
                action = iter.next();
                if ( action instanceof PortletMode )
                {
                    mappedMode = (PortletMode)action;
                    customMode = pa.getCustomPortletMode(mappedMode);
                   
                    if ( customMode != null )
                    {
                        boolean equalsCurrentMode = customMode.equals(currentMode);
                        if ( equalsCurrentMode )
                        {
                            currentModeAction = mappedMode.toString();
                        }
                        if ( ! equalsCurrentMode || isAjaxRequest )
                        {
                            if ( content.supportsPortletMode(customMode)
                                 && (!PortletMode.EDIT.equals(customMode) || pageActionAccess.isEditAllowed())
                                 && pageActionAccess.checkPortletMode(fragmentId, portletName, mappedMode)
                                 )
                            {
                                actionTemplates.add(new DecoratorActionTemplate(mappedMode, customMode));
View Full Code Here

            wildcard = type.substring(0, index);
        }

        PortletEntity entity = portletWindow.getPortletEntity();
        PortletDefinition def = entity.getPortletDefinition();
        ContentTypeSet contentTypes = def.getContentTypeSet();
        Iterator it = contentTypes.iterator();
        while(it.hasNext()) {
            ContentType ct = (ContentType)it.next();
            if(ct.getContentType().equals(type)) {
                return true;
            }
View Full Code Here

            count++;
        }
        assertTrue("InitParam Count != 1, count = " + count, count == 1);

        // Supports Content Type
        ContentTypeSet supports = portlet.getContentTypeSet();
        it = supports.iterator();
        count = 0;
        while (it.hasNext())
        {
            ContentTypeComposite contentType = (ContentTypeComposite) it.next();
            assertTrue("MimeType invalid: " + contentType.getContentType(), contentType.getContentType().equals("text/html"));
View Full Code Here

            count++;
        }
        assertTrue("InitParam Count != 1, count = " + count, count == 1);

        // Supports Content Type
        ContentTypeSet supports = portlet.getContentTypeSet();
        it = supports.iterator();
        count = 0;
        while (it.hasNext())
        {
            ContentTypeComposite contentType = (ContentTypeComposite) it.next();
            assertTrue("MimeType invalid: " + contentType.getContentType(), contentType.getContentType().equals("text/html"));
View Full Code Here

        List actions = Collections.EMPTY_LIST;
       
        PortletMode currentMode = requestContext.getPortalURL().getNavigationalState().getMode(window);
        WindowState currentState = requestContext.getPortalURL().getNavigationalState().getState(window);
        ContentTypeSet content = portlet.getContentTypeSet();
       
        if ( fragment.equals(requestContext.getPage().getRootFragment()) )
        {
            fragmentSupportsActions = true;
            actions = getPageModes(requestContext, window, content, currentMode, currentState, pageActionAccess, decoration, isAjaxRequest);
        }
        else if ( !Fragment.LAYOUT.equals(fragment.getType()) )
        {
            fragmentSupportsActions = true;
            String fragmentId = fragment.getId();
            PortletApplication pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();

            String portletName = portlet.getUniqueName();

            PortletMode currentMappedMode = pa.getMappedPortletMode(currentMode);
            WindowState currentMappedState = pa.getMappedWindowState(currentState);

            Object action;
            PortletMode mappedMode;
            PortletMode customMode;
            WindowState mappedState;
            WindowState customState;
           
            ArrayList actionTemplates = new ArrayList();
           
            DecoratorActionsFactory actionsAdapter = getDecoratorActionsAdapter(decoration);
           
            Iterator iter = actionsAdapter.getSupportedActions(requestContext, pa, window, currentMappedMode, currentMappedState, decoration).iterator();
           
            String currentModeAction = null;
            String currentStateAction = null;

            while ( iter.hasNext() )
            {
                action = iter.next();
                if ( action instanceof PortletMode )
                {
                    mappedMode = (PortletMode)action;
                    customMode = pa.getCustomPortletMode(mappedMode);
                   
                    if ( customMode != null )
                    {
                        boolean equalsCurrentMode = customMode.equals(currentMode);
                        if ( equalsCurrentMode )
                        {
                            currentModeAction = mappedMode.toString();
                        }
                        if ( ! equalsCurrentMode || isAjaxRequest )
                        {
                            if ( content.supportsPortletMode(customMode)
                                 && (!PortletMode.EDIT.equals(customMode) || pageActionAccess.isEditAllowed())
                                 && pageActionAccess.checkPortletMode(fragmentId, portletName, mappedMode)
                                 )
                            {
                                actionTemplates.add(new DecoratorActionTemplate(mappedMode, customMode));
View Full Code Here

        List actions = Collections.EMPTY_LIST;
       
        PortletMode currentMode = requestContext.getPortalURL().getNavigationalState().getMode(window);
        WindowState currentState = requestContext.getPortalURL().getNavigationalState().getState(window);
        ContentTypeSet content = portlet.getContentTypeSet();
       
        if ( fragment.equals(requestContext.getPage().getRootFragment()) )
        {
            fragmentSupportsActions = true;
            actions = getPageModes(requestContext, window, content, currentMode, currentState, pageActionAccess, decoration, isAjaxRequest);
        }
        else if ( !Fragment.LAYOUT.equals(fragment.getType()) )
        {
            fragmentSupportsActions = true;
            String fragmentId = fragment.getId();
            PortletApplication pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();

            String portletName = portlet.getUniqueName();

            PortletMode currentMappedMode = pa.getMappedPortletMode(currentMode);
            WindowState currentMappedState = pa.getMappedWindowState(currentState);

            Object action;
            PortletMode mappedMode;
            PortletMode customMode;
            WindowState mappedState;
            WindowState customState;
           
            ArrayList actionTemplates = new ArrayList();
           
            DecoratorActionsFactory actionsAdapter = getDecoratorActionsAdapter(decoration);
           
            List supportedActions = actionsAdapter.getSupportedActions(requestContext, pa, window, currentMappedMode, currentMappedState, decoration);
            Iterator iter = supportedActions.iterator();
           
            String currentModeAction = null;
            String currentStateAction = null;

            while ( iter.hasNext() )
            {
                action = iter.next();
                if ( action instanceof PortletMode )
                {
                    mappedMode = (PortletMode)action;
                    customMode = pa.getCustomPortletMode(mappedMode);
                   
                    if ( customMode != null )
                    {
                        boolean equalsCurrentMode = customMode.equals(currentMode);
                        if ( equalsCurrentMode )
                        {
                            currentModeAction = mappedMode.toString();
                        }
                        if ( ! equalsCurrentMode || isAjaxRequest )
                        {
                            if ( (content.supportsPortletMode(customMode) || isAutoSwitchableCustomMode(content, customMode))
                                 && (!PortletMode.EDIT.equals(customMode) || pageActionAccess.isEditAllowed())
                                 && pageActionAccess.checkPortletMode(fragmentId, portletName, mappedMode)
                                 )
                            {
                                actionTemplates.add(new DecoratorActionTemplate(mappedMode, customMode));
View Full Code Here

TOP

Related Classes of org.apache.pluto.om.portlet.ContentTypeSet

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.