Examples of PortletMode


Examples of javax.portlet.PortletMode

      {
         return PortletMode.VIEW;
      }
      else
      {
         return new PortletMode(portletModeName);
      }
   }
View Full Code Here

Examples of javax.portlet.PortletMode

      {
         return PortletMode.VIEW;
      }
      else
      {
         return new PortletMode(portletModeName);
      }
   }
View Full Code Here

Examples of javax.portlet.PortletMode

    public void processAction(UIPortlet<S, C> uicomponent, WebuiRequestContext context) throws Exception {
        try {
            // The PortletMode and WindowState can change during a portlet invocation, so we need
            // to be able to compare the results before and after invoking the portlet to know if
            // we need to broadcast a change event or not.
            PortletMode currentPortletMode = uicomponent.getCurrentPortletMode();
            WindowState currentWindowState = uicomponent.getCurrentWindowState();

            String action = context.getRequestParameter(PortalRequestContext.UI_COMPONENT_ACTION);
            if (action != null) {
                Event<UIComponent> event = uicomponent.createEvent(action, Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
                return;
            }

            String portletMode = context.getRequestParameter(org.exoplatform.portal.Constants.PORTAL_PORTLET_MODE);
            if (portletMode != null) {
                Event<UIComponent> event = uicomponent.createEvent("ChangePortletMode", Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
            }

            String windowState = context.getRequestParameter(org.exoplatform.portal.Constants.PORTAL_WINDOW_STATE);
            if (windowState != null) {
                Event<UIComponent> event = uicomponent.createEvent("ChangeWindowState", Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
            }

            /*
             * Check the type of the incoming request, can be either an ActionURL or a RenderURL one
             *
             * In case of a RenderURL, the parameter state map must be invalidated and this is done in the associated
             * ActionListener
             *
             * If no action type is specified we assume the default, which is to render
             */
            String portletActionType = context.getRequestParameter(Constants.TYPE_PARAMETER);
            if (portletActionType != null) {
                if (portletActionType.equals(Constants.PORTAL_PROCESS_ACTION)) {
                    Event<UIComponent> event = uicomponent.createEvent("ProcessAction", Event.Phase.PROCESS, context);
                    if (event != null)
                        event.broadcast();
                } else if (portletActionType.equals(Constants.PORTAL_SERVE_RESOURCE)) {
                    Event<UIComponent> event = uicomponent.createEvent("ServeResource", Event.Phase.PROCESS, context);
                    if (event != null)
                        event.broadcast();
                }
            } else {
                Event<UIComponent> event = uicomponent.createEvent("Render", Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
            }

            // These two checks needs to go after the ProcessAction, ServeResource or Render broadcast events.
            // The mode or state can change during the invocation and we need to be able to broadcast the change
            // event if this occurs.
            if (currentPortletMode != null && !currentPortletMode.equals(uicomponent.getCurrentPortletMode())) {
                context.setAttribute(UIPortletActionListener.CHANGE_PORTLET_MODE_EVENT, uicomponent.getCurrentPortletMode()
                        .toString());
                Event<UIComponent> event = uicomponent.createEvent("ChangePortletMode", Event.Phase.PROCESS, context);
                if (event != null)
                    event.broadcast();
View Full Code Here

Examples of javax.portlet.PortletMode

             */
            WindowState state = new WindowState(getWindowStateOrDefault(navResponse));
            setNextState(uiPortlet, state);

            // update the portlet with the next mode to display
            PortletMode mode = new PortletMode(getPortletModeOrDefault(navResponse));
            setNextMode(uiPortlet, mode);

            StateString navState = navResponse.getNavigationalState();
            if (navState != null) {
                uiPortlet.setNavigationalState(navResponse.getNavigationalState());
View Full Code Here

Examples of javax.portlet.PortletMode

            // update the portlet with the next mode to display
            // Note: we should only update the Mode if the UpdateNavigationalStateResponse.getMode is not null,
            // otherwise it means the mode has not changed and we should use the current value.
            if (navStateResponse.getMode() != null) {
                PortletMode mode = new PortletMode(getPortletModeOrDefault(navStateResponse));
                setNextMode(uiPortlet, mode);
            }

            /*
             * Cache the render parameters in the UI portlet component to handle the navigational state. Each time a portlet is
View Full Code Here

Examples of javax.portlet.PortletMode

            } else if (portletMode.equals(PortletMode.EDIT.toString())) {
                uiPortlet.setCurrentPortletMode(PortletMode.EDIT);
            } else if (portletMode.equals(PortletMode.VIEW.toString())) {
                uiPortlet.setCurrentPortletMode(PortletMode.VIEW);
            } else {
                PortletMode customMode = new PortletMode(portletMode);
                uiPortlet.setCurrentPortletMode(customMode);
            }
            event.getRequestContext().addUIComponentToUpdateByAjax(uiPortlet);
        }
View Full Code Here

Examples of javax.portlet.PortletMode

        if (actionForward == null)
        {
            return; // no parameters
        }
       
        PortletMode mode = null;
        StringTokenizer tokenizer = new StringTokenizer(actionForward, ForwardConstants.DELIMITER);
        while (tokenizer.hasMoreTokens())
        {
            String token = tokenizer.nextToken();
            if (token.startsWith(ForwardConstants.MODE_PREFIX))
            {
                mode = setPortletMode(token.substring(ForwardConstants.MODE_PREFIX.length()), url);
            }
            else if (token.startsWith(ForwardConstants.STATE_PREFIX))
            {
                setWindowState(token.substring(ForwardConstants.STATE_PREFIX.length()), url);               
            }
            else
            {
                if (mode == null)
                {
                    mode = request.getPortletMode();
                }
                if (mode.equals(PortletMode.VIEW))
                {
                    url.setParameter(FrameworkConstants.VIEW_VIEW_MODE, token);
                }
                else if (mode.equals(PortletMode.EDIT))
                {
                    url.setParameter(FrameworkConstants.VIEW_EDIT_MODE, token);                   
                }
                else if (mode.equals(PortletMode.HELP))
                {
                    url.setParameter(FrameworkConstants.VIEW_HELP_MODE, token);                   
                }
            }
        }                                       
View Full Code Here

Examples of javax.portlet.PortletMode

        }
    }
   
    private PortletMode setPortletMode(String forward, PortletURL url)
    {
        PortletMode mode = null;
        try
        {
            if (forward.equals(ForwardConstants.VIEW))
            {
                url.setPortletMode(PortletMode.VIEW);
View Full Code Here

Examples of javax.portlet.PortletMode

    protected void forwardToView(ActionRequest request, ActionResponse response, String forward)
    {
        if (forward == null) { return; } // stay on same page

        String logicalView = null;
        PortletMode newMode = null;
        StringTokenizer tokenizer = new StringTokenizer(forward, ForwardConstants.DELIMITER);
        while (tokenizer.hasMoreTokens())
        {
            String token = tokenizer.nextToken();
            if (token.startsWith(ForwardConstants.MODE_PREFIX))
View Full Code Here

Examples of javax.portlet.PortletMode

        }
    }

    private PortletMode setPortletMode(ActionResponse response, String forward)
    {
        PortletMode mode = null;
        try
        {
            if (forward.equals(ForwardConstants.VIEW))
            {
                response.setPortletMode(PortletMode.VIEW);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.